inline anonymous enum
I would to use inline anonymous enums with C#
For example instead writing:
public class PutPaySheetRequest
{
public PutPaySheetMode Mode { get; set; }
public enum PutPaySheetMode { Live, Test };
}
I would write:
public class PutPaySheetRequest
{
public enum {Live,Test} Mode { get; set; }
}
1 comment
-
qstream
commented
This way, how we can compare the property value with some value from this enum? and how to declare it in method params?
Do you have any idea?public class PutPaySheetRequest
{
public enum {Live,Test} Mode { get; set; }
public void Test2(mode??){}//object? int?
public void Test1(){
//how to say this?
var newMode = Live;//?? how to say this?
if(Mode == newMode) {}
}