wasSharp
/Reflection.cs |
@@ -8,7 +8,6 @@ |
using System.Collections.Generic; |
using System.Linq; |
using System.Reflection; |
using wasSharp; |
|
namespace wasSharp |
{ |
@@ -122,7 +121,8 @@ |
var field = typeof (T).GetRuntimeFields().ToArray() |
.AsParallel().SelectMany(f => f.GetCustomAttributes( |
typeof (NameAttribute), false), ( |
f, a) => new {Field = f, Att = a}).SingleOrDefault(a => Strings.StringEquals(((NameAttribute) a.Att) |
f, a) => new {Field = f, Att = a}) |
.SingleOrDefault(a => Strings.StringEquals(((NameAttribute) a.Att) |
.Name, name, StringComparison.Ordinal)); |
return field != null ? (T) field.Field.GetValue(Activator.CreateInstance<T>()) : default(T); |
} |