wasSharpNET
/Reflection.cs |
@@ -64,7 +64,7 @@ |
var getMethod = pi.GetGetMethod(); |
if (getMethod.ReturnType.IsArray) |
{ |
var array = (Array) getMethod.Invoke(@object, null); |
var array = (Array)getMethod.Invoke(@object, null); |
foreach (var sp in |
array.Cast<object>().SelectMany(element => wasGetProperties(element, @namespace))) |
{ |
@@ -94,18 +94,18 @@ |
public static void wasSetInfoValue<TK, TV>(TK info, ref TV @object, object value) |
{ |
object o = @object; |
var fi = (object) info as FieldInfo; |
var fi = (object)info as FieldInfo; |
if (fi != null) |
{ |
fi.SetValue(o, value); |
@object = (TV) o; |
@object = (TV)o; |
return; |
} |
var pi = (object) info as PropertyInfo; |
var pi = (object)info as PropertyInfo; |
if (pi != null) |
{ |
pi.SetValue(o, value, null); |
@object = (TV) o; |
@object = (TV)o; |
} |
} |
|
@@ -120,12 +120,12 @@ |
/// <returns>the value of the field or property</returns> |
public static object wasGetInfoValue<T>(T info, object value) |
{ |
var fi = (object) info as FieldInfo; |
var fi = (object)info as FieldInfo; |
if (fi != null) |
{ |
return fi.GetValue(value); |
} |
var pi = (object) info as PropertyInfo; |
var pi = (object)info as PropertyInfo; |
if (pi != null) |
{ |
if (pi.GetIndexParameters().Any()) |
@@ -137,4 +137,4 @@ |
return null; |
} |
} |
} |
} |