You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
@ -243,13 +243,17 @@ namespace System
|
||||
return result;
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern int InternalCompareTo(Object o1, Object o2);
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern RuntimeType InternalGetUnderlyingType(RuntimeType enumType);
|
||||
|
||||
@ -264,8 +268,10 @@ namespace System
|
||||
private static extern void GetEnumValuesAndNames(RuntimeTypeHandle enumType, ObjectHandleOnStack values, ObjectHandleOnStack names, bool getNames);
|
||||
#endif
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern Object InternalBoxEnum(RuntimeType enumType, long value);
|
||||
#endregion
|
||||
@ -554,13 +560,14 @@ namespace System
|
||||
// Delegate rest of error checking to the other functions
|
||||
TypeCode typeCode = Convert.GetTypeCode(value);
|
||||
|
||||
#if !MONO
|
||||
// NetCF doesn't support char and boolean conversion
|
||||
if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8 &&
|
||||
((typeCode == TypeCode.Boolean) || (typeCode == TypeCode.Char)))
|
||||
{
|
||||
throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), "value");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
switch (typeCode)
|
||||
{
|
||||
@ -747,17 +754,19 @@ namespace System
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
#endif
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private extern bool InternalHasFlag(Enum flags);
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
#if MONO
|
||||
private extern int get_hashcode ();
|
||||
#else
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
private extern CorElementType InternalGetCorElementType();
|
||||
#endif
|
||||
#endregion
|
||||
@ -1223,5 +1232,37 @@ namespace System
|
||||
return InternalBoxEnum(rtType, value ? 1 : 0);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#if MONO
|
||||
public static TEnum Parse<TEnum>(string value) where TEnum : struct
|
||||
{
|
||||
return Parse<TEnum>(value, false);
|
||||
}
|
||||
|
||||
public static TEnum Parse<TEnum>(string value, bool ignoreCase) where TEnum : struct
|
||||
{
|
||||
EnumResult parseResult = new EnumResult() { canThrow = true };
|
||||
if (TryParseEnum(typeof(TEnum), value, ignoreCase, ref parseResult))
|
||||
return (TEnum)parseResult.parsedEnum;
|
||||
else
|
||||
throw parseResult.GetEnumParseException();
|
||||
}
|
||||
|
||||
public static bool TryParse(Type enumType, String value, bool ignoreCase, out object result)
|
||||
{
|
||||
result = null;
|
||||
EnumResult parseResult = new EnumResult();
|
||||
bool retValue;
|
||||
|
||||
if (retValue = TryParseEnum(enumType, value, ignoreCase, ref parseResult))
|
||||
result = parseResult.parsedEnum;
|
||||
return retValue;
|
||||
}
|
||||
|
||||
public static bool TryParse(Type enumType, String value, out object result)
|
||||
{
|
||||
return TryParse(enumType, value, false, out result);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user