Last active
January 1, 2016 13:49
-
-
Save rightfold/8153485 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private enum Kind { Get, Set }; | |
private static string InterfaceGetOrSetMethod(PropertyInfo propertyInfo, Kind kind) | |
{ | |
var kindString = Kind == Kind.Get ? "get" : "set"; | |
if (propertyInfo.GetMethod == null) | |
return ""; | |
var accessModifier = propertyInfo.Accessmodifier(); | |
var methodAccessModifier = propertyInfo.GetMethod.Accessmodifier(); | |
if (methodAccessModifier == accessModifier) | |
return kindString + ";"; | |
return methodAccessModifier.ToString().ToLower() + kindString + ";"; | |
} | |
public static string InterfaceGetMethod(this PropertyInfo propertyInfo) | |
{ | |
return InterfaceGetOrSetMethod(propertyInfo, Kind.Get); | |
} | |
public static string InterfaceSetMethod(this PropertyInfo propertyInfo) | |
{ | |
return InterfaceGetOrSetMethod(propertyInfo, Kind.Set); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment