wasSharp – Diff between revs 35 and 37

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 35 Rev 37
Line 142... Line 142...
142 public static string GetStructureMemberName<T>(T structure, object item) where T : struct 142 public static string GetStructureMemberName<T>(T structure, object item) where T : struct
143 { 143 {
144 var f = typeof(T).GetRuntimeFields(); 144 var f = typeof(T).GetRuntimeFields();
145 var p = typeof(T).GetRuntimeProperties(); 145 var p = typeof(T).GetRuntimeProperties();
Line 146... Line -...
146   -  
147 dynamic r = null; -  
148   146  
-   147 if (f != null)
149 if (f != null) 148 {
150 r = f.AsParallel() 149 var r = f.AsParallel()
151 .SelectMany(o => o.GetCustomAttributes(typeof(NameAttribute), false), 150 .SelectMany(o => o.GetCustomAttributes(typeof(NameAttribute), false),
152 (o, a) => new { Field = o, Att = a }) 151 (o, a) => new { Field = o, Att = a })
-   152 .SingleOrDefault(q => q.Field.GetValue(structure).Equals(item));
-   153 if (r != null)
-   154 return ((NameAttribute)r.Att).Name;
Line 153... Line 155...
153 .SingleOrDefault(q => q.Field.GetValue(structure).Equals(item)); 155 }
-   156  
154   157 if (p != null)
155 if (p != null) 158 {
156 r = p.AsParallel() 159 var r = p.AsParallel()
157 .SelectMany(o => o.GetCustomAttributes(typeof(NameAttribute), false), 160 .SelectMany(o => o.GetCustomAttributes(typeof(NameAttribute), false),
-   161 (o, a) => new { Property = o, Att = a })
-   162 .SingleOrDefault(q => q.Property.GetValue(structure).Equals(item));
-   163 if (r != null)
Line 158... Line 164...
158 (o, a) => new { Property = o, Att = a }) 164 return ((NameAttribute)r.Att).Name;
159 .SingleOrDefault(q => q.Property.GetValue(structure).Equals(item)); 165 }
Line 160... Line 166...
160   166  
161 return r != null ? ((NameAttribute)r.Att).Name : string.Empty; 167 return string.Empty;
162 } 168 }