7 instantiations of TypeName
System.Reflection.Metadata (7)
System\Reflection\Metadata\TypeName.cs (3)
463return new TypeName(fullName: _fullName, 528return new TypeName(fullName: null, AssemblyName, elementOrGenericType: this, declaringType: _declaringType, genericTypeArguments: typeArguments); 532=> new TypeName(
System\Reflection\Metadata\TypeNameParser.cs (4)
207TypeName result = new(fullName, assemblyName, declaringType: declaringType); 210result = new(fullName: null, assemblyName, elementOrGenericType: result, declaringType, genericArgs); 220result = new(fullName: null, assemblyName, elementOrGenericType: result, rankOrModifier: parsedModifier); 267declaringType = new(fullTypeName, assemblyName, declaringType: declaringType, nestedNameLength: fullNameLength);
331 references to TypeName
illink (12)
Microsoft.VisualBasic.Forms (2)
Microsoft\VisualBasic\MyServices\ClipboardProxy.vb (2)
195''' <inheritdoc cref="Clipboard.TryGetData(Of T)(String, Func(Of TypeName, Type), ByRef T)" /> 196Public Function TryGetData(Of T)(format As String, resolver As Func(Of TypeName, Type), <Out> ByRef data As T) As Boolean
Microsoft.VisualBasic.Tests (1)
Microsoft\VisualBasic\MyServices\ClipboardProxyTests.cs (1)
154public static Type Resolver(TypeName typeName) =>
System.Formats.Nrbf (61)
System\Formats\Nrbf\ArrayRectangularPrimitiveRecord.cs (2)
22private TypeName? _typeName; 35public override TypeName TypeName
System\Formats\Nrbf\ArraySingleObjectRecord.cs (1)
24public override TypeName TypeName
System\Formats\Nrbf\ArraySinglePrimitiveRecord.cs (1)
36public override TypeName TypeName => TypeNameHelpers.GetPrimitiveSZArrayTypeName(TypeNameHelpers.GetPrimitiveType<T>());
System\Formats\Nrbf\ArraySingleStringRecord.cs (1)
25public override TypeName TypeName => TypeNameHelpers.GetPrimitiveSZArrayTypeName(TypeNameHelpers.StringPrimitiveType);
System\Formats\Nrbf\BinaryLibraryRecord.cs (2)
33public override TypeName TypeName => TypeName.Parse(nameof(BinaryLibraryRecord).AsSpan());
System\Formats\Nrbf\ClassInfo.cs (2)
23private TypeName? _typeName; 34internal TypeName TypeName
System\Formats\Nrbf\ClassRecord.cs (1)
23public override TypeName TypeName => ClassInfo.TypeName;
System\Formats\Nrbf\ClassTypeInfo.cs (2)
20internal ClassTypeInfo(TypeName typeName) => TypeName = typeName; 22internal TypeName TypeName { get; }
System\Formats\Nrbf\JaggedArrayRecord.cs (2)
26private TypeName? _typeName; 43public override TypeName TypeName => _typeName ??= _memberTypeInfo.GetArrayTypeName(ArrayInfo);
System\Formats\Nrbf\MemberReferenceRecord.cs (1)
34public override TypeName TypeName => GetReferencedRecord().TypeName;
System\Formats\Nrbf\MemberTypeInfo.cs (3)
111internal TypeName GetArrayTypeName(ArrayInfo arrayInfo) 115TypeName elementTypeName = binaryType switch 123BinaryType.SystemClass => (TypeName)additionalInfo!,
System\Formats\Nrbf\MessageEndRecord.cs (2)
27public override TypeName TypeName => TypeName.Parse(nameof(MessageEndRecord).AsSpan());
System\Formats\Nrbf\NrbfDecoder.cs (5)
398TypeName typeName = binaryType == BinaryType.SystemClass ? (TypeName)additionalInfo! : ((ClassTypeInfo)additionalInfo!).TypeName; 414TypeName typeName = binaryType == BinaryType.SystemClass ? (TypeName)additionalInfo! : ((ClassTypeInfo)additionalInfo!).TypeName; 448else if (binaryType == BinaryType.SystemClass && ((TypeName)additionalInfo!).IsArray)
System\Formats\Nrbf\NullsRecord.cs (2)
15public override TypeName TypeName => TypeName.Parse(GetType().Name.AsSpan());
System\Formats\Nrbf\PayloadOptions.cs (1)
19/// Gets or sets configuration options for parsing <see cref="TypeName"/> instances.
System\Formats\Nrbf\PrimitiveTypeRecordOfT.cs (1)
37public override TypeName TypeName => TypeNameHelpers.GetPrimitiveTypeName(TypeNameHelpers.GetPrimitiveType<T>());
System\Formats\Nrbf\RectangularArrayRecord.cs (2)
23private TypeName? _typeName; 41public override TypeName TypeName
System\Formats\Nrbf\SerializationRecord.cs (3)
42public abstract TypeName TypeName { get; } 68private static bool Matches(Type type, TypeName typeName) 128ImmutableArray<TypeName> genericNames = typeName.GetGenericArguments();
System\Formats\Nrbf\SerializedStreamHeaderRecord.cs (2)
27public override TypeName TypeName => TypeName.Parse(nameof(SerializedStreamHeaderRecord).AsSpan());
System\Formats\Nrbf\SystemClassWithMembersAndTypesRecord.cs (1)
31TypeName typeName = classInfo.TypeName;
System\Formats\Nrbf\SZArrayOfRecords.cs (2)
17private TypeName? _typeName; 32public override TypeName TypeName
System\Formats\Nrbf\Utils\TypeNameHelpers.cs (22)
20private static readonly TypeName?[] s_primitiveTypeNames = new TypeName?[(int)UIntPtrPrimitiveType + 1]; 21private static readonly TypeName?[] s_primitiveSZArrayTypeNames = new TypeName?[(int)UIntPtrPrimitiveType + 1]; 24internal static TypeName GetPrimitiveTypeName(PrimitiveType primitiveType) 26TypeName? typeName = s_primitiveTypeNames[(int)primitiveType]; 53s_primitiveTypeNames[(int)primitiveType] = typeName = TypeName.Parse(fullName.AsSpan()).WithCoreLibAssemblyName(); 58internal static TypeName GetPrimitiveSZArrayTypeName(PrimitiveType primitiveType) 60TypeName? typeName = s_primitiveSZArrayTypeNames[(int)primitiveType]; 110internal static TypeName ParseNonSystemClassRecordTypeName(this string rawName, BinaryLibraryRecord libraryRecord, PayloadOptions payloadOptions) 133TypeName.TryParse(assemblyQualifiedName.AsSpan(), out TypeName? typeName, payloadOptions.TypeNameParseOptions); 153internal static TypeName ParseSystemRecordTypeName(this string rawName, PayloadOptions payloadOptions) 157internal static TypeName WithCoreLibAssemblyName(this TypeName systemType) 160private static TypeName With(this TypeName typeName, AssemblyNameInfo assemblyName) 170TypeName newElementType = typeName.GetElementType().With(assemblyName); 178TypeName newGenericTypeDefinition = typeName.GetGenericTypeDefinition().With(assemblyName); 193private static TypeName ParseWithoutAssemblyName(string rawName, PayloadOptions payloadOptions) 195if (!TypeName.TryParse(rawName.AsSpan(), out TypeName? typeName, payloadOptions.TypeNameParseOptions)
System.Private.Windows.Core (3)
System\Private\Windows\Core\BinaryFormat\Deserializer\DefaultTypeResolver.cs (2)
30Type ITypeResolver.GetType(TypeName typeName) 82private static Type? GetSimplyNamedTypeFromAssembly(Assembly assembly, TypeName typeName)
System\Private\Windows\Core\BinaryFormat\ITypeResolver.cs (1)
18Type GetType(TypeName typeName);
System.Reflection.Metadata (59)
System\Reflection\Metadata\TypeName.cs (45)
35private readonly TypeName? _elementOrGenericType; 36private readonly TypeName? _declaringType; 40private readonly ImmutableArray<TypeName> _genericArguments; 46TypeName? elementOrGenericType = default, 47TypeName? declaringType = default, 51ImmutableArray<TypeName>.Builder? genericTypeArguments = default, 67? ImmutableArray<TypeName>.Empty 75TypeName? elementOrGenericType, 76TypeName? declaringType, 77ImmutableArray<TypeName> genericTypeArguments, 101/// Returns assembly name which contains this type, or null if this <see cref="TypeName"/> was not 114public TypeName DeclaringType 288/// Represents the total number of <see cref="TypeName"/> instances that are used to describe 294/// as the total number of <see cref="TypeName"/> instances that would be created if 295/// you were to totally deconstruct this instance and visit each intermediate <see cref="TypeName"/> 302/// involves inspecting 8 <see cref="TypeName"/> instances total: 315/// <exception cref="OverflowException">The total number of <see cref="TypeName"/> instances that are used to describe 333foreach (TypeName genericArgument in GetGenericArguments()) 353public TypeName GetElementType() 370public TypeName GetGenericTypeDefinition() 388public static TypeName Parse(ReadOnlySpan<char> typeName, TypeNameParseOptions? options = default) 398public static bool TryParse(ReadOnlySpan<char> typeName, [NotNullWhen(true)] out TypeName? result, TypeNameParseOptions? options = default) 420/// If this <see cref="TypeName"/> represents a constructed generic type, returns an array 431ImmutableArray<TypeName> GetGenericArguments() => _genericArguments; 436/// Creates a new <see cref="TypeName" /> object that represents current simple name with provided assembly name. 441public TypeName WithAssemblyName(AssemblyNameInfo? assemblyName) 459TypeName? declaringType = IsNested 467genericTypeArguments: ImmutableArray<TypeName>.Empty, 472/// Creates a <see cref="TypeName" /> object representing a one-dimensional array 476/// A <see cref="TypeName" /> object representing a one-dimensional array 479public TypeName MakeSZArrayTypeName() => MakeElementTypeName(TypeNameParserHelpers.SZArray); 482/// Creates a <see cref="TypeName" /> object representing an array of the current type, 487/// A <see cref="TypeName" /> object representing an array of the current type, 491public TypeName MakeArrayTypeName(int rank) 497/// Creates a <see cref="TypeName" /> object that represents a pointer to the current type. 500/// A <see cref="TypeName" /> object that represents a pointer to the current type. 502public TypeName MakePointerTypeName() => MakeElementTypeName(TypeNameParserHelpers.Pointer); 505/// Creates a <see cref="TypeName" /> object that represents a managed reference to the current type. 508/// A <see cref="TypeName" /> object that represents a managed reference to the current type. 510public TypeName MakeByRefTypeName() => MakeElementTypeName(TypeNameParserHelpers.ByRef); 517/// A <see cref="TypeName" /> representing the constructed type name formed by using the elements 521public TypeName MakeGenericTypeName(ImmutableArray<TypeName> typeArguments) 531private TypeName MakeElementTypeName(int rankOrModifier) 537genericTypeArguments: ImmutableArray<TypeName>.Empty,
System\Reflection\Metadata\TypeNameParser.cs (10)
31internal static TypeName? Parse(ReadOnlySpan<char> typeName, bool throwOnError, TypeNameParseOptions? options = default) 46TypeName? parsedName = parser.ParseNextTypeName(allowFullyQualifiedName: true, ref recursiveDepth); 70private TypeName? ParseNextTypeName(bool allowFullyQualifiedName, ref int recursiveDepth) 92ImmutableArray<TypeName>.Builder? genericArgs = null; 108TypeName? genericArg = ParseNextTypeName(allowFullyQualifiedName: doubleBrackets, ref recursiveDepth); 125genericArgs = ImmutableArray.CreateBuilder<TypeName>(2); 206TypeName? declaringType = GetDeclaringType(fullName, nestedNameLengths, assemblyName); 207TypeName result = new(fullName, assemblyName, declaringType: declaringType); 252private static TypeName? GetDeclaringType(string fullTypeName, List<int>? nestedNameLengths, AssemblyNameInfo? assemblyName) 261TypeName? declaringType = null;
System\Reflection\Metadata\TypeNameParserHelpers.cs (2)
23internal static string GetGenericTypeFullName(ReadOnlySpan<char> fullTypeName, ReadOnlySpan<TypeName> genericArgs) 31foreach (TypeName genericArg in genericArgs)
System\Reflection\Metadata\TypeNameParserOptions.cs (2)
11/// Limits the maximum value of <seealso cref="TypeName.GetNodeCount">node count</seealso> that parser can handle. 15/// Setting this to a large value can render <see cref="TypeName"/> susceptible to Denial of Service
System.Resources.Extensions (3)
System\Resources\Extensions\BinaryFormat\BinaryFormattedObject.ITypeResolver.cs (1)
21Type GetType(TypeName typeName);
System\Resources\Extensions\BinaryFormat\BinaryFormattedObject.TypeResolver.cs (2)
38Type ITypeResolver.GetType(TypeName typeName) 88private static Type? GetSimplyNamedTypeFromAssembly(Assembly assembly, TypeName typeName)
System.Windows.Forms (69)
System\Resources\ResXSerializationBinder.cs (4)
40if (_typeResolver is null || !TypeName.TryParse($"{typeName}, {assemblyName}".AsSpan(), out TypeName? parsed)) 83&& TypeName.TryParse(assemblyQualifiedTypeName.AsSpan(), out TypeName? parsed)
System\Windows\Forms\Internal\TypeExtensions.cs (14)
11/// Helper methods for comparing <see cref="Type"/>s and <see cref="TypeName"/>s. 50public static bool MatchExceptAssemblyVersion(this Type type, TypeName typeName) 67private static bool MatchLessAssemblyVersion(this Type type, TypeName typeName) 114ImmutableArray<TypeName> genericNames = typeName.GetGenericArguments(); 160/// Match <see cref="TypeName"/>s using all information that had been set by the caller. 162public static bool Matches(this TypeName x, TypeName y) 196ImmutableArray<TypeName> genericNamesY = y.GetGenericArguments(); 197ImmutableArray<TypeName> genericNamesX = x.GetGenericArguments(); 238/// Convert <paramref name="type"/> to <see cref="TypeName"/>. Take into account type forwarding in order 239/// to create <see cref="TypeName"/> compatible with the type names serialized to the binary format.This 240/// method removes nullability wrapper from the top level type only because <see cref="TypeName"/> in the 243public static TypeName ToTypeName(this Type type) 252return TypeName.Parse($"{GetTypeFullName(type)}, {assemblyName}");
System\Windows\Forms\Nrbf\WinFormsSerializationRecordExtensions.cs (2)
82|| !TypeName.TryParse(innerTypeFullName, out TypeName? serializedTypeName))
System\Windows\Forms\OLE\Clipboard.cs (8)
266/// <see cref="TypeName"/> is allowed or throws a <see cref="NotSupportedException"/> if <see cref="TypeName"/> is not 294/// <see cref="TypeName"/> parameter can be matched according to the user requirements, for example, only namespace-qualified 311/// Avoid loading assemblies named in the <see cref="TypeName"/> argument of the resolver function. Resolve only types 319/// from the allowed type and match it to the <see cref="AssemblyNameInfo.FullName"/> property of <see cref="TypeName.AssemblyName"/>. 328/// <see cref="TypeName.FullName"/> property. Resolver function should either remove or type-forward these assembly 390Func<TypeName, Type> resolver, 400/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, out T)"/>
System\Windows\Forms\OLE\DataObject.Composition.BinaryFormatUtilities.cs (3)
69Func<TypeName, Type>? resolver, 161Func<TypeName, Type>? resolver, 200private static bool TypeNameIsAssignableToType(TypeName typeName, Type type, ITypeResolver resolver)
System\Windows\Forms\OLE\DataObject.Composition.Binder.cs (12)
31private readonly Func<TypeName, Type>? _resolver; 108private static Dictionary<TypeName, Type>? s_knownTypes; 110private readonly Dictionary<TypeName, Type> _userTypes = new(TypeNameComparer.Default); 121/// <see cref="TypeName"/>s read from the deserialized stream. 128public Binder(Type type, Func<TypeName, Type>? resolver, bool legacyMode) 143TypeName typeName = type.ToTypeName(); 246TypeName parsed = TypeName.Parse($"{typeName}, {assemblyName}"); 252private Type UseResolver(TypeName typeName) 270private Type? GetCachedType(string assemblyName, string fullTypeName, TypeName? typeName) 274typeName ??= TypeName.Parse($"{fullTypeName}, {assemblyName}"); 283public Type GetType(TypeName typeName)
System\Windows\Forms\OLE\DataObject.Composition.cs (1)
103Func<TypeName, Type> resolver,
System\Windows\Forms\OLE\DataObject.Composition.NativeToWinFormsAdapter.cs (7)
97Func<TypeName, Type>? resolver, 130Func<TypeName, Type>? resolver, 255Func<TypeName, Type>? resolver, 292Func<TypeName, Type>? resolver, 355Func<TypeName, Type>? resolver, 488Func<TypeName, Type>? resolver, 632Func<TypeName, Type> resolver,
System\Windows\Forms\OLE\DataObject.Composition.TypeNameComparer.cs (7)
12/// Match <see cref="TypeName"/>s by matching full namespace-qualified type names and full assembly names, 15internal sealed class TypeNameComparer : IEqualityComparer<TypeName> 21internal static IEqualityComparer<TypeName> Default { get; } = new TypeNameComparer(); 23public bool Equals(TypeName? x, TypeName? y) 38public int GetHashCode(TypeName obj) 54foreach (TypeName genericName in obj.GetGenericArguments())
System\Windows\Forms\OLE\DataObject.cs (4)
269Func<TypeName, Type> resolver, 298/// <inheritdoc cref="ITypedDataObject.TryGetData{T}(string, Func{TypeName, Type}, bool, out T)" /> 302Func<TypeName, Type>? resolver, 376Func<TypeName, Type>? resolver,
System\Windows\Forms\OLE\DataObject.DataStore.cs (1)
201Func<TypeName, Type> resolver,
System\Windows\Forms\OLE\DataObjectExtensions.cs (2)
52/// <inheritdoc cref="ITypedDataObject.TryGetData{T}(string, Func{Reflection.Metadata.TypeName, Type}, bool, out T)"/> 59Func<Reflection.Metadata.TypeName, Type> resolver,
System\Windows\Forms\OLE\ITypedDataObject.cs (4)
28/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/> 35/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/> 44/// <inheritdoc cref="TryGetData{T}(string, Func{TypeName, Type}, bool, out T)"/> 82Func<TypeName, Type> resolver,
System.Windows.Forms.Tests (121)
System\Resources\ResXSerializationBinderTests.cs (2)
88TypeName parsed = TypeName.Parse($"{typeof(Form).FullName}, {typeof(Form).Assembly.FullName}");
System\Windows\Forms\BinaryFormat\WinFormsBinaryFormattedObjectTests.cs (2)
86if (TypeName.TryParse(InnerTypeAssemblyQualifiedName, out TypeName? innerTypeName)
System\Windows\Forms\BinaryFormatUtilitiesTests.cs (14)
37private object? ReadObjectFromStream<T>(bool restrictDeserialization, Func<TypeName, Type>? resolver) 45private object? ReadObjectFromStream<T>(Func<TypeName, Type>? resolver) 51private object? ReadRestrictedObjectFromStream<T>(Func<TypeName, Type>? resolver) 88private object? RoundTripOfType<T>(object value, Func<TypeName, Type>? resolver) 436static Type ObjectListResolver(TypeName typeName) 543private static Type NullableIntArrayResolver(TypeName typeName) 574static Type TestDataResolver(TypeName typeName) 611static Type InvalidResolver(TypeName typeName) => null!; 614private static Type FontResolver(TypeName typeName) 840private static Type NotSupportedResolver(TypeName typeName) => 996internal static Type MyExactMatchResolver(TypeName typeName) 999(Type type, TypeName typeName)[] allowedTypes = 1001(typeof(MyClass1), TypeName.Parse(typeof(MyClass1).AssemblyQualifiedName)), 1002(typeof(MyClass2), TypeName.Parse(typeof(MyClass2).AssemblyQualifiedName))
System\Windows\Forms\ClipboardTests.cs (5)
772public static Type TestDataResolver(TypeName typeName) 1054TypeName.TryParse(innerTypeAssemblyQualifiedName, out TypeName? innerTypeName).Should().BeTrue(); 1055TypeName checkedResult = innerTypeName.Should().BeOfType<TypeName>().Subject;
System\Windows\Forms\DataObjectExtensionsTests.cs (2)
32private static Type Resolver(TypeName typeName) => typeof(string); 254public bool TryGetData<T>(string format, Func<TypeName, Type> resolver, bool autoConvert, [MaybeNullWhen(false), NotNullWhen(true)] out T data)
System\Windows\Forms\DataObjectTests.cs (5)
378private readonly Func<TypeName, Type>? _resolver; 382public DataObjectOverridesTryGetDataCore(string format, Func<TypeName, Type>? resolver, bool autoConvert) : base() 390public static Type Resolver(TypeName _) => typeof(string); 394Func<TypeName, Type>? resolver, 471private static Type NotSupportedResolver(TypeName typeName) => throw new NotSupportedException();
System\Windows\Forms\NativeToWinFormsAdapterTests.cs (3)
58static Type Resolver(TypeName typeName) => typeof(int); 480public static Type Resolver(TypeName typeName) 538public static Type Resolver(TypeName typeName)
System\Windows\Forms\TypeExtensionsTests.cs (46)
15public static TheoryData<Type, TypeName, bool> MatchesNameAndAssemblyLessVersionData() => new() 18{ typeof(int), TypeName.Parse(typeof(int).AssemblyQualifiedName), false }, 19{ typeof(int), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, 20{ typeof(int?), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, 21{ typeof(int?[]), TypeName.Parse($"System.Nullable`1[[System.Int32, {Mscorlib}]][], {Mscorlib}"), true}, 22{ typeof(DayOfWeek), TypeName.Parse($"System.Nullable`1[[System.DayOfWeek, {Mscorlib}]], {Mscorlib}"), false }, 23{ typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, 25{ typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, 27{ typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f1AAAAAAA"), false }, 29{ typeof(Bitmap), TypeName.Parse("System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=en-US, PublicKeyToken=b03f5f7f11d50a3a"), false }, 31{ typeof(Bitmap), TypeName.Parse("System.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, 32{ typeof(Bitmap), TypeName.Parse("System.Drawing.MyBitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, 33{ typeof(Bitmap?[]), TypeName.Parse("System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, 34{ typeof(Dictionary<string, Bitmap>), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, 35{ typeof(Dictionary<string, Bitmap?>), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, 36{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests.NonForwardedType"), false }, 38{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionstests+NonForwardedType"), false }, 40{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType"), false }, 41{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType, System.Windows.Forms.Tests"), false }, 43{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+NonForwardedType, System.windows.Forms.Tests, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), true }, 45{ typeof(NonForwardedType), TypeName.Parse("System.Windows.Forms.Tests.typeExtensionsTests+NonForwardedType, System.Windows.Forms.Tests"), false }, 46{ typeof(ForwardedType), TypeName.Parse("System.Windows.Forms.Tests.TypeExtensionsTests+ForwardedType, Abc"), true }, 51public void MatchesLessAssemblyVersion(Type type, TypeName typeName, bool matches) => 55public static TheoryData<TypeName, TypeName, bool> MatchesTypeNameData() => new() 57{ TypeName.Parse($"System.Int32, {Mscorlib}"), TypeName.Parse($"System.Int32, {Mscorlib}"), true }, 58{ TypeName.Parse($"System.Int32, {Mscorlib}"), TypeName.Parse($"System.String, {Mscorlib}"), false }, 59{ TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), true }, 60{ TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), false }, 61{ TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], {Mscorlib}"), TypeName.Parse($"System.Collections.Generic.Dictionary`2[[System.String, {Mscorlib}],[System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]], mscorlib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"), false }, 62{ TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, 63{ TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap[], System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, 64{ TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), true }, 65{ TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), TypeName.Parse($"System.Drawing.Bitmap, System.Drawing, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), false }, 70public void Matches_TypeName(TypeName x, TypeName y, bool matches) => 105TypeName name = typeof(ForwardedType).ToTypeName();
System\Windows\Forms\TypeNameComparerTests.cs (42)
14public static TheoryData<TypeName, Type> TypeNameComparerSuccess() => new() 16{ TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, 17{ TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}"), typeof(int) }, 18{ TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, 19{ TypeName.Parse($"{typeof(int[]).FullName}, {typeof(int[]).Assembly.FullName}"), typeof(int[]) }, 20{ TypeName.Parse(typeof(List<int>).AssemblyQualifiedName), typeof(List<int>) }, 21{ TypeName.Parse($"{typeof(List<int>).FullName}, {typeof(List<int>).Assembly.FullName}"), typeof(List<int>) }, 22{ TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, 23{ TypeName.Parse($"{typeof(TestType).FullName}, {typeof(TestType).Assembly.FullName}"), typeof(TestType) }, 28public void DictionaryLookupSucceeds(TypeName name, Type expected) 30Dictionary<TypeName, Type> types = new(DataObject.Composition.TypeNameComparer.Default) 32{ TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, 33{ TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, 34{ TypeName.Parse(typeof(List<int>).AssemblyQualifiedName), typeof(List<int>) }, 35{ TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, 42public static TheoryData<TypeName> TypeNameComparerFail() => 44TypeName.Parse("System.Int32[], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), 45TypeName.Parse("System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), 46TypeName.Parse("System.Int32, System.Private.CoreLib, Culture=neutral, PublicKeyToken=7cec85d7bea7798e"), 47TypeName.Parse($"System.Collections.Generic.List`1[[System.Int32, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], {typeof(List<int>).Assembly.FullName}"), 48TypeName.Parse($"{typeof(TestType).FullName}, {typeof(int).Assembly.FullName}") 53public void DictionaryLookupVersionMismatch(TypeName name) 55Dictionary<TypeName, Type> types = new(DataObject.Composition.TypeNameComparer.Default) 57{ TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, 58{ TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, 59{ TypeName.Parse(typeof(List<int>).AssemblyQualifiedName), typeof(List<int>) }, 60{ TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, 69Dictionary<TypeName, Type> types = new(DataObject.Composition.TypeNameComparer.Default) 71{ TypeName.Parse(typeof(int).AssemblyQualifiedName), typeof(int) }, 72{ TypeName.Parse(typeof(int[]).AssemblyQualifiedName), typeof(int[]) }, 73{ TypeName.Parse(typeof(List<int>).AssemblyQualifiedName), typeof(List<int>) }, 74{ TypeName.Parse(typeof(TestType).AssemblyQualifiedName), typeof(TestType) }, 77TypeName name = TypeName.Parse(typeof(int).AssemblyQualifiedName); 80name = TypeName.Parse(testName); 90comparer.Equals(null, TypeName.Parse(typeof(int).AssemblyQualifiedName)).Should().BeFalse(); 91comparer.Equals(TypeName.Parse(typeof(int).AssemblyQualifiedName), null).Should().BeFalse(); 93TypeName.Parse(typeof(int).AssemblyQualifiedName), 94TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}")).Should().BeTrue(); 102int hash = comparer.GetHashCode(TypeName.Parse(typeof(int).AssemblyQualifiedName)); 103comparer.GetHashCode(TypeName.Parse(typeof(int).AssemblyQualifiedName)).Should().Be(hash); 104comparer.GetHashCode(TypeName.Parse($"{typeof(int).FullName}, {typeof(int).Assembly.FullName}")).Should().Be(hash);