Here are simple code, extension method in order to translate a yes/no (Y/N) value read somewhere to a boolean.
public static class YesNoToBoolExtension { public static bool YesNotoBool(this string source) { return source.ToUpper() == "Y"||source.ToUpper()=="Yes"; } public static bool YesNotoBool(this char source) { return char.ToUpper(source) == 'Y'; } }
Good work ;-)
Aucun commentaire:
Enregistrer un commentaire