internal static Type GetType( string typeName, Func <AssemblyName, Assembly> assemblyResolver, Func <Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark) { if (typeName == null) { throw new ArgumentNullException("typeName"); } if (typeName.Length > 0 && typeName[0] == '\0') { throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength")); } Contract.EndContractBlock(); Type ret = null; SafeTypeNameParserHandle handle = CreateTypeNameParser(typeName, throwOnError); if (handle != null) { // If we get here the typeName must have been successfully parsed. // Let's construct the Type object. using (TypeNameParser parser = new TypeNameParser(handle)) { ret = parser.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark); } } return(ret); }
private static SafeTypeNameParserHandle CreateTypeNameParser(string typeName, bool throwOnError) { SafeTypeNameParserHandle o = null; _CreateTypeNameParser(typeName, JitHelpers.GetObjectHandleOnStack <SafeTypeNameParserHandle>(ref o), throwOnError); return(o); }
internal static Type GetType(string typeName, Func <AssemblyName, Assembly> assemblyResolver, Func <Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark) { if (typeName == null) { throw new ArgumentNullException("typeName"); } if (typeName.Length > 0 && (int)typeName[0] == 0) { throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength")); } Type type = (Type)null; SafeTypeNameParserHandle typeNameParser1 = TypeNameParser.CreateTypeNameParser(typeName, throwOnError); if (typeNameParser1 != null) { using (TypeNameParser typeNameParser2 = new TypeNameParser(typeNameParser1)) type = typeNameParser2.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark); } return(type); }
internal static Type GetType(string typeName, Func <AssemblyName, Assembly> assemblyResolver, Func <Assembly, string, bool, Type> typeResolver, bool throwOnError, bool ignoreCase, ref StackCrawlMark stackMark) { if (typeName == null) { throw new ArgumentNullException("typeName"); } if ((typeName.Length > 0) && (typeName[0] == '\0')) { throw new ArgumentException(Environment.GetResourceString("Format_StringZeroLength")); } Type type = null; SafeTypeNameParserHandle handle = CreateTypeNameParser(typeName, throwOnError); if (handle == null) { return(type); } using (TypeNameParser parser = new TypeNameParser(handle)) { return(parser.ConstructType(assemblyResolver, typeResolver, throwOnError, ignoreCase, ref stackMark)); } }
private static partial void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString);
private static partial void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
private static partial void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
private static extern void _GetNames(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
private static readonly char[] SPECIAL_CHARS = { ',', '[', ']', '&', '*', '+', '\\' }; /* see typeparse.h */ #endregion #region Constructor and Disposer private TypeNameParser(SafeTypeNameParserHandle handle) { m_NativeParser = handle; }
private static extern void _GetAssemblyName(SafeTypeNameParserHandle pTypeNameParser, StringHandleOnStack retString);
private static extern void _GetModifiers(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
private static extern void _GetTypeArguments(SafeTypeNameParserHandle pTypeNameParser, ObjectHandleOnStack retArray);
private TypeNameParser(SafeTypeNameParserHandle handle) { m_NativeParser = handle; }
protected override bool ReleaseHandle() { SafeTypeNameParserHandle._ReleaseTypeNameParser(this.handle); this.handle = IntPtr.Zero; return(true); }