コード例 #1
0
ファイル: ClrProperty.cs プロジェクト: 0xCM/Meta.Core
 /// <summary>
 /// Gets the value of the property and either casts or converts the value to the supplied type
 /// </summary>
 /// <typeparam name="V">The value's type</typeparam>
 /// <param name="o">The defining object</param>
 /// <param name="convert"></param>
 /// <returns></returns>
 public V GetValue <V>(object o, bool convert = false)
 => convert
     ? (V)Convert.ChangeType(ReflectedElement.GetValue(o), typeof(V))
     : (V)ReflectedElement.GetValue(o);
コード例 #2
0
ファイル: ClrField.cs プロジェクト: 0xCM/Meta.Core
 public object GetValue(object o)
 => ReflectedElement.GetValue(o);
コード例 #3
0
ファイル: ClrProperty.cs プロジェクト: 0xCM/Meta.Core
 /// <summary>
 /// Gets the value of the property and converts the value to the supplied type
 /// </summary>
 public object GetValue(object o, Type conversionType)
 => Convert.ChangeType(ReflectedElement.GetValue(o), conversionType);