Answer the question
In order to leave comments, you need to log in
Should I use enums here?
I was looking for projects to parse and found this code:
It seems to me that instead of classes there should be enums here?
Answer the question
In order to leave comments, you need to log in
Worth it, it will be more convenient and understandable.
namespace TryEnum
{
enum DownloadType
{
Video, Audio, Custom, Unknown, Default
}
enum ForceIpProtocol
{
IPv4, IPv6
}
enum ProxyProtocol
{
HTTPS, HTTP, SOCKS4, SOCKS5
}
}
class ClassName : IClassName
static void Create()
{
// empty...
}
class SimpleHuman : IHuman
{
public string Name { get; set; }
public int Age { get; set; }
public SimpleHuman()
{
Name = "Generic human...";
Age = 20;
}
public SimpleHuman(string name) : this()
{
Name = name;
}
public SimpleHuman(string name, int age) : this()
{
Name = name;
Age = age;
}
}
class CoolHuman : IHuman
{
public string Name { get; set; }
public int Age { get; set; }
public CoolHuman()
{
Name = "BOB!";
Age = 20;
}
public CoolHuman(string name) : this()
{
Name = name;
}
public CoolHuman(string name, int age) : this()
{
Name = name;
Age = age;
}
}
interface IHuman
{
string Name { get; set; }
int Age { get; set; }
}
class Create
{
public IHuman Human { get; set; }
public Create()
{
Human = new CoolHuman();
}
public void Hello()
{
Console.WriteLine("Hello, {0}. Today you are {1} years old", Human.Name, Human.Age);
}
}
programming is an interesting thing - does it work? Do not touch!
It seems to me that instead of classes there should be interfaces here?in the text of the question
Should I use enums here?you already decide in the Wishlist:
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question