Created
May 27, 2022 08:36
-
-
Save EngRajabi/410bba27497d0ce2e2031547d473da1e 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
public static class UserTypeTestEnumExtensions | |
{ | |
public static string StringToFast(this UnitTests.UserTypeTest states) | |
{ | |
return states switch | |
{ | |
UnitTests.UserTypeTest.Men => nameof(UnitTests.UserTypeTest.Men), | |
UnitTests.UserTypeTest.Women => nameof(UnitTests.UserTypeTest.Women), | |
UnitTests.UserTypeTest.None => nameof(UnitTests.UserTypeTest.None), | |
_ => throw new ArgumentOutOfRangeException(nameof(states), states, null) | |
}; | |
} | |
public static bool IsDefinedFast(UnitTests.UserTypeTest states) | |
{ | |
return states switch | |
{ | |
UnitTests.UserTypeTest.Men => true, | |
UnitTests.UserTypeTest.Women => true, | |
UnitTests.UserTypeTest.None => true, | |
_ => throw new ArgumentOutOfRangeException(nameof(states), states, null) | |
}; | |
} | |
public static bool IsDefinedFast(string states) | |
{ | |
return states switch | |
{ | |
nameof(UnitTests.UserTypeTest.Men) => true, | |
nameof(UnitTests.UserTypeTest.Women) => true, | |
nameof(UnitTests.UserTypeTest.None) => true, | |
_ => throw new ArgumentOutOfRangeException(nameof(states), states, null) | |
}; | |
} | |
public static string ToDisplayFast(this UnitTests.UserTypeTest states) | |
{ | |
return states switch | |
{ | |
UnitTests.UserTypeTest.Men => "مرد", | |
UnitTests.UserTypeTest.Women => "زن", | |
UnitTests.UserTypeTest.None => "None", | |
_ => throw new ArgumentOutOfRangeException(nameof(states), states, null) | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment