public string FuncWithManyEnumArgsAndDefaultValues <T>( T myT, MyEnumType arg10 = MyEnumType.Val2, MyEnumType arg11 = MyEnumType.Val3, MyEnumType arg12 = MyEnumType.Val3, MyEnumType arg13 = MyEnumType.Val3, MyEnumType arg14 = MyEnumType.Val3, MyEnumType arg15 = MyEnumType.Val3, MyEnumType arg16 = MyEnumType.Val3, MyEnumType arg17 = MyEnumType.Val3, MyEnumType arg18 = MyEnumType.Val3, MyEnumType arg19 = MyEnumType.Val3) { return(String.Format("FuncWithManyEnumArgsAndDefaultValues<{0}>: {1}", typeof(T), arg10)); }
public static string ToLocalizedString(this MyEnumType type) { // check System.Threading.Thread.CurrentThread.CurrentCulture // if you need current culture context switch (type) { case MyEnumType.One: return("Ein"); case MyEnumType.Two: return("Zwei"); case MyEnumType.Three: return("Drei"); default: throw new NotImplementedException(); } }
public void MyEnumTest([Values] MyEnumType x, [Values] bool y) { Assert.Pass(x.ToString() + "," + y.ToString()); }
private IActionResult Get(MyEnumType myEnumParam){ // here we can guarantee that myEnumParam is valid }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { variable = EnumClass.EnumClass.GetValueFromDescription <MyEnumType>(this.comboBox1.SelectedItem.ToString()); }
public static MyBaseStrategyType CreateInstance(this MyEnumType key) { return(lookup[key](/* pass any common constructor values */)); }
public static string ToCultureString(this MyEnumType type) { return(ResourceManager.GetString(type.ToString(), Culture)); }