wasSharp – Diff between revs 21 and 24

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 21 Rev 24
Line 115... Line 115...
115 /// </summary> 115 /// </summary>
116 /// <typeparam name="T">the enumeration type</typeparam> 116 /// <typeparam name="T">the enumeration type</typeparam>
117 /// <param name="name">the description of a member</param> 117 /// <param name="name">the description of a member</param>
118 /// <param name="comparison">the string comparison to use</param> 118 /// <param name="comparison">the string comparison to use</param>
119 /// <returns>the value or the default of T if case no name attribute found</returns> 119 /// <returns>the value or the default of T if case no name attribute found</returns>
-   120 public static T GetEnumValueFromName<T>(string name,
120 public static T GetEnumValueFromName<T>(string name, StringComparison comparison = StringComparison.OrdinalIgnoreCase) 121 StringComparison comparison = StringComparison.OrdinalIgnoreCase)
121 { 122 {
122 var field = typeof(T).GetRuntimeFields().ToArray() 123 var field = typeof(T).GetRuntimeFields().ToArray()
123 .AsParallel().SelectMany(f => f.GetCustomAttributes( 124 .AsParallel().SelectMany(f => f.GetCustomAttributes(
124 typeof(NameAttribute), false), ( 125 typeof(NameAttribute), false), (
125 f, a) => new {Field = f, Att = a}) 126 f, a) => new {Field = f, Att = a})