Microsoft.JScript.TypeReferences.GetConstantValue C# (CSharp) Method

GetConstantValue() static private method

static private GetConstantValue ( FieldInfo field ) : Object
field System.Reflection.FieldInfo
return Object
    internal static Object GetConstantValue(FieldInfo field) {
      if (field.GetType().Assembly == typeof(TypeReferences).Assembly ||
          !field.DeclaringType.Assembly.ReflectionOnly)
        return field.GetValue(null);
      
      Type type = field.FieldType;
      Object value = field.GetRawConstantValue();
      if (type.IsEnum)
        return MetadataEnumValue.GetEnumValue(type, value);
      return value;
    }
  }