:
1) Description . .
:
:
2) .NET enum - - Java. ( ) /. #, , - , #, VB:)
public sealed class Reason
{
public static readonly Reason ServiceNotCovered = new Reason("SNCV");
public static readonly Reason MemberNotEligible = new Reason("MNEL");
private readonly string code;
private Reason(string code)
{
this.code = code;
}
public string Code
{
get { return code; }
}
}
( , # - , VB Select ), , , . . . :
public class Reason
{
public static readonly Reason ServiceNotCovered = new ServiceReason();
public static readonly Reason MemberNotEligible = new EligibilityReason();
private readonly string code;
private Reason(string code)
{
this.code = code;
}
public string Code
{
get { return code; }
}
public abstract void DoSomething();
private class ServiceReason : Reason
{
internal ServiceReason() : base("SVNC") {}
public override void DoSomething()
{
}
}
private class EligibiltyReason : Reason
{
internal EligibiltyReason() : base("MNEL") {}
public override void DoSomething()
{
}
}
}
, , , , - .
, VB , #, , ( , ) .
, "" . , - . , - Enum.IsDefined, .