How do you return an Enum from a setter/getter function?
Currently I have this:
public enum LowerCase
{
a,
b,
}
public en
Probably you should use a base class Case and two derived classes, so that your ChooseCase property returns an object of the corresponding class:
abstract class Case
{
abstract char GetItem(int index);
}
class LowerCase : Case
{
override char GetItem(int index)
{
// Not sure for the following
Encoding ascii = Encoding.ASCII;
return ascii.GetString(ascii.GetBytes("a")[0] + index)[0];
}
}
class UpperCase : Case
{
// The same for the upper case
}
public Case ChooseCase
{
get
{
if (condition)
{
return new LowerCase();
}
else
{
return new UpperCase();
}
}
}
This is a thing you cannot do with enums, because they all derive exactly from Enum.