4 types derived from Type
System.Private.CoreLib (3)
System.Windows.Forms.Tests (1)
26410 references to Type
AnalyzerRunner (2)
ApiExplorerWebSite (2)
Aspire.Azure.AI.OpenAI (2)
Aspire.Azure.Data.Tables (2)
Aspire.Azure.Messaging.EventHubs (2)
Aspire.Azure.Messaging.EventHubs.Tests (1)
Aspire.Azure.Messaging.ServiceBus (2)
Aspire.Azure.Messaging.WebPubSub (2)
Aspire.Azure.Search.Documents (2)
Aspire.Azure.Security.KeyVault (2)
Aspire.Azure.Storage.Blobs (2)
Aspire.Azure.Storage.Queues (2)
Aspire.Confluent.Kafka.Tests (10)
Aspire.Dashboard (1)
Aspire.Dashboard.Tests (1)
Aspire.Elastic.Clients.Elasticsearch (2)
Aspire.Hosting (5)
Aspire.Hosting.Azure (1)
Aspire.Hosting.Azure.AppContainers (1)
Aspire.Hosting.Testing (7)
DistributedApplicationTestingBuilder.cs (4)
41public static Task<IDistributedApplicationTestingBuilder> CreateAsync(Type entryPoint, CancellationToken cancellationToken = default)
70public static Task<IDistributedApplicationTestingBuilder> CreateAsync(Type entryPoint, string[] args, CancellationToken cancellationToken = default)
100public static async Task<IDistributedApplicationTestingBuilder> CreateAsync(Type entryPoint, string[] args, Action<DistributedApplicationOptions, HostApplicationBuilderSettings> configureBuilder, CancellationToken cancellationToken = default)
110private sealed class SuspendingDistributedApplicationFactory(Type entryPoint, string[] args, Action<DistributedApplicationOptions, HostApplicationBuilderSettings> configureBuilder)
Aspire.Hosting.Testing.Tests (1)
Aspire.Hosting.Tests (1)
Aspire.Microsoft.Azure.Cosmos (2)
Aspire.Microsoft.Data.SqlClient (4)
Aspire.Microsoft.EntityFrameworkCore.Cosmos (2)
Aspire.Microsoft.EntityFrameworkCore.SqlServer (4)
Aspire.Milvus.Client (2)
Aspire.MongoDB.Driver (2)
Aspire.MySqlConnector (2)
Aspire.NATS.Net (2)
Aspire.Npgsql (2)
Aspire.Npgsql.EntityFrameworkCore.PostgreSQL (2)
Aspire.OpenAI (2)
Aspire.Oracle.EntityFrameworkCore (2)
Aspire.Playground.Tests (4)
Aspire.Pomelo.EntityFrameworkCore.MySql (2)
Aspire.Qdrant.Client (2)
Aspire.RabbitMQ.Client (2)
Aspire.Seq (2)
Aspire.StackExchange.Redis (9)
Aspire.StackExchange.Redis.DistributedCaching (2)
Aspire.StackExchange.Redis.OutputCaching (2)
BasicWebSite (3)
BinaryFormatTests (5)
Binding.UDS.IntegrationTests (3)
BuildActionTelemetryTable (12)
Client.ExpectedExceptions.IntegrationTests (2)
ComDisabled.Tests (3)
ConfigurationSchemaGenerator (8)
ConfigurationSchemaGenerator.Tests (2)
Contract.Data.IntegrationTests (4)
Contract.Fault.IntegrationTests (1)
ControllersFromServicesWebSite (1)
DesignSurfaceExt (13)
Diagnostics.EFCore.FunctionalTests (1)
dotnet-svcutil.xmlserializer (44)
Microsoft\Tools\ServiceModel\SvcUtil\Options.cs (16)
32private List<Type> _referencedTypes;
34private Dictionary<string, Type> _excludedTypes;
44internal List<Type> ReferencedTypes { get { return _referencedTypes; } }
123internal bool IsTypeExcluded(Type type)
134private static Type s_typeOfDateTimeOffset = typeof(DateTimeOffset);
333_parent._referencedTypes = new List<Type>();
339Dictionary<string, Type> foundCollectionTypes = AddSpecifiedTypesToDictionary(collectionTypesArgs, Options.Cmd.CollectionType);
382private Dictionary<string, Type> AddSpecifiedTypesToDictionary(IList<string> typeArgs, string cmd)
384Dictionary<string, Type> specifiedTypes = new Dictionary<string, Type>(typeArgs.Count);
394private void AddReferencedTypesFromAssembly(Assembly assembly, Dictionary<string, Type> foundCollectionTypes)
396foreach (Type type in InputModule.LoadTypes(assembly))
406private void AddMscorlib(Dictionary<string, Type> foundCollectionTypes)
477internal static bool IsTypeSpecified(Type type, Dictionary<string, Type> specifiedTypes, string cmd)
479Type foundType = null;
dotnet-svcutil-lib (2477)
CodeDomFixup\CodeDomVisitors\ConstructorFixer.cs (13)
17private static Type[][] s_validCtors = new Type[][]
19Array.Empty<Type>(),
20new Type[] { typeof(string), },
21new Type[] { typeof(InstanceContext), },
22new Type[] { typeof(string), typeof(string), },
23new Type[] { typeof(string), typeof(EndpointAddress), },
24new Type[] { typeof(InstanceContext), typeof(string), },
25new Type[] { typeof(InstanceContext), typeof(string), typeof(string), },
26new Type[] { typeof(InstanceContext), typeof(string), typeof(EndpointAddress), },
27new Type[] { typeof(Binding), typeof(EndpointAddress), },
28new Type[] { typeof(InstanceContext), typeof(Binding), typeof(EndpointAddress), },
41private static bool IsValidConstructor(CodeConstructor ctor, Type[][] validCtors)
CommandProcessorOptions.cs (21)
42public List<Type> ReferencedTypes { get; private set; }
44public List<Type> ReferencedCollectionTypes { get; private set; }
103this.ReferencedTypes = new List<Type>();
105this.ReferencedCollectionTypes = new List<Type>();
858private static Dictionary<string, Type> AddSpecifiedTypesToDictionary(IList<string> typeArgs, string cmd)
860Dictionary<string, Type> specifiedTypes = new Dictionary<string, Type>(typeArgs.Count);
872private void AddReferencedTypesFromAssembly(Assembly assembly, Dictionary<string, Type> foundCollectionTypes, Dictionary<string, Type> excludedTypes)
874foreach (Type type in TypeLoader.LoadTypes(assembly, this.Verbosity.Value))
892private void AddStdLibraries(Dictionary<string, Type> foundCollectionTypes, Dictionary<string, Type> excludedTypes)
894List<Type> coreTypes = new List<Type>
901foreach (var type in coreTypes)
911private static bool IsTypeSpecified(Type type, Dictionary<string, Type> specifiedTypes, string cmd)
917if (specifiedTypes.TryGetValue(type.FullName, out Type foundType))
945private void AddReferencedCollectionTypes(IList<string> collectionTypesArgs, Dictionary<string, Type> foundCollectionTypes)
952Type foundType = null;
971foundType = foundType ?? Type.GetType(collectionType);
FrameworkFork\Microsoft.Xml\External\Extensions.cs (4)
19public static MethodInfo GetMethod(this Type type, String name, BindingFlags bindingAttr, System.Reflection.Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
24public static MethodInfo GetMethod(this Type type, String name, BindingFlags bindingAttr, System.Reflection.Binder binder, Type[] types, ParameterModifier[] modifiers)
FrameworkFork\Microsoft.Xml\Xml\schema\GenerateConverter.cs (52)
22public static Type[] InterfaceTypes = { typeof(Boolean), typeof(DateTime), typeof(Decimal), typeof(Double), typeof(Int32), typeof(Int64), typeof(Single), typeof(String), typeof(Object) };
383List<Type> uniqueTypes = new List<Type>();
386foreach (Type tSrc in group.FindUniqueSourceTypes(null))
389foreach (Type tDst in group.FindUniqueDestinationTypes(null))
393foreach (Type t in uniqueTypes)
399foreach (Type tDst in InterfaceTypes)
401foreach (Type tSrc in InterfaceTypes)
441IList<Type> uniqueSourceTypes, uniqueDestTypes;
446foreach (Type tDst in InterfaceTypes)
459foreach (Type tSrc in InterfaceTypes)
489foreach (Type tSrc in uniqueSourceTypes)
514foreach (Type tSrc in InterfaceTypes)
529foreach (Type tDst in uniqueDestTypes)
557foreach (Type tDst in group.FindUniqueDestinationTypes(null))
588foreach (Type tSrc in uniqueSourceTypes)
600foreach (Type tDst in group.FindUniqueDestinationTypes(typeof(object)))
604foreach (Type tSrc in group.FindUniqueSourceTypes(typeof(object)))
633foreach (Type tSrc in uniqueSourceTypes)
649foreach (Type tDst in uniqueDestTypes)
664private void StartMethod(Type typeSrc, Type typeDst)
686private void StartMethodSignature(Type typeSrc, Type typeDst)
714private bool MethodHasResolver(Type typeSrc, Type typeDst)
789Type tSrc, tDst;
829private string GenerateSourceTypeMatch(Type type)
841private static string ClrTypeName(Type type)
849private static string ClrTypeToCSharpName(Type type)
869private static bool IsInterfaceMethod(Type type)
888Type clrTypeSrc = ClrTypeNameToType(rule[1]);
889Type clrTypeDst = ClrTypeNameToType(rule[2]);
901public IList<Type> FindUniqueSourceTypes(Type tDst)
903List<Type> types = new List<Type>();
914public IList<Type> FindUniqueDestinationTypes(Type tSrc)
916List<Type> types = new List<Type>();
927public IList<ConversionRule> Find(XmlTypeCode code, Type tSrc, Type tDst)
985private static Type ClrTypeNameToType(string name)
987Type type = Type.GetType("System." + name);
990type = Type.GetType("System.IO." + name);
1009private Type _clrTypeSrc,_clrTypeDst;
1012public ConversionRule(XmlTypeCode xmlType, Type clrTypeSrc, Type clrTypeDst, string convExpr)
1025public Type SourceType
1030public Type DestinationType
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (167)
263public abstract object ChangeType(bool value, Type destinationType);
264public abstract object ChangeType(int value, Type destinationType);
265public abstract object ChangeType(long value, Type destinationType);
266public abstract object ChangeType(decimal value, Type destinationType);
267public abstract object ChangeType(float value, Type destinationType);
268public abstract object ChangeType(double value, Type destinationType);
269public abstract object ChangeType(DateTime value, Type destinationType);
270public abstract object ChangeType(DateTimeOffset value, Type destinationType);
271public abstract object ChangeType(string value, Type destinationType);
272public abstract object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver);
273public abstract object ChangeType(object value, Type destinationType);
274public abstract object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver);
281private Type _clrTypeDefault;
335protected XmlBaseConverter(XmlBaseConverter converterAtomic, Type clrTypeDefault)
342protected static readonly Type ICollectionType = typeof(ICollection);
343protected static readonly Type IEnumerableType = typeof(IEnumerable);
344protected static readonly Type IListType = typeof(IList);
345protected static readonly Type ObjectArrayType = typeof(object[]);
346protected static readonly Type StringArrayType = typeof(string[]);
347protected static readonly Type XmlAtomicValueArrayType = typeof(XmlAtomicValue[]);
350protected static readonly Type DecimalType = typeof(decimal);
351protected static readonly Type Int32Type = typeof(int);
352protected static readonly Type Int64Type = typeof(long);
353protected static readonly Type StringType = typeof(string);
354protected static readonly Type XmlAtomicValueType = typeof(XmlAtomicValue);
355protected static readonly Type ObjectType = typeof(object);
356protected static readonly Type ByteType = typeof(byte);
357protected static readonly Type Int16Type = typeof(short);
358protected static readonly Type SByteType = typeof(sbyte);
359protected static readonly Type UInt16Type = typeof(ushort);
360protected static readonly Type UInt32Type = typeof(uint);
361protected static readonly Type UInt64Type = typeof(ulong);
362protected static readonly Type XPathItemType = typeof(XPathItem);
363protected static readonly Type DoubleType = typeof(double);
364protected static readonly Type SingleType = typeof(float);
365protected static readonly Type DateTimeType = typeof(DateTime);
366protected static readonly Type DateTimeOffsetType = typeof(DateTimeOffset);
367protected static readonly Type BooleanType = typeof(bool);
368protected static readonly Type ByteArrayType = typeof(Byte[]);
369protected static readonly Type XmlQualifiedNameType = typeof(XmlQualifiedName);
370protected static readonly Type UriType = typeof(Uri);
371protected static readonly Type TimeSpanType = typeof(TimeSpan);
372protected static readonly Type XPathNavigatorType = typeof(XPathNavigator);
475public override object ChangeType(bool value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
476public override object ChangeType(DateTime value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
477public override object ChangeType(DateTimeOffset value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
478public override object ChangeType(decimal value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
479public override object ChangeType(double value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
480public override object ChangeType(int value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
481public override object ChangeType(long value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
482public override object ChangeType(float value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
483public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver) { return (object)ChangeType((object)value, destinationType, nsResolver); }
484public override object ChangeType(string value, Type destinationType) { return this.ChangeType(value, destinationType, null); }
485public override object ChangeType(object value, Type destinationType) { return this.ChangeType(value, destinationType, null); }
537protected Type DefaultClrType
545protected static bool IsDerivedFrom(Type derivedType, Type baseType)
561protected Exception CreateInvalidClrMappingException(Type sourceType, Type destinationType)
598protected virtual object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1022Type sourceType = value.GetType();
1068Type sourceType = value.GetType();
1107Type sourceType = value.GetType();
1153Type sourceType = value.GetType();
1169public override object ChangeType(decimal value, Type destinationType)
1184public override object ChangeType(int value, Type destinationType)
1199public override object ChangeType(long value, Type destinationType)
1214public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
1230public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1235Type sourceType = value.GetType();
1279private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1281Type sourceType = value.GetType();
1292private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1363Type sourceType = value.GetType();
1411Type sourceType = value.GetType();
1446Type sourceType = value.GetType();
1461public override object ChangeType(double value, Type destinationType)
1475public override object ChangeType(float value, Type destinationType)
1489public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
1504public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1509Type sourceType = value.GetType();
1589Type sourceType = value.GetType();
1634Type sourceType = value.GetType();
1723Type sourceType = value.GetType();
1738public override object ChangeType(DateTime value, Type destinationType)
1752public override object ChangeType(DateTimeOffset value, Type destinationType)
1766public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
1781public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1786Type sourceType = value.GetType();
1843Type sourceType = value.GetType();
1913Type sourceType = value.GetType();
1927public override object ChangeType(bool value, Type destinationType)
1940public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
1954public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
1959Type sourceType = value.GetType();
2058Type sourceType = value.GetType();
2096public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
2134public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2139Type sourceType = value.GetType();
2253private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2255Type sourceType = value.GetType();
2261private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2346Type sourceType = value.GetType();
2359public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
2372public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2377Type sourceType = value.GetType();
2430Type sourceType = value.GetType();
2452Type sourceType = value.GetType();
2474Type sourceType = value.GetType();
2495Type sourceType = value.GetType();
2517Type sourceType = value.GetType();
2539Type sourceType = value.GetType();
2561Type sourceType = value.GetType();
2583Type sourceType = value.GetType();
2637Type sourceType = value.GetType();
2668public override object ChangeType(bool value, Type destinationType)
2678public override object ChangeType(DateTime value, Type destinationType)
2688public override object ChangeType(DateTimeOffset value, Type destinationType)
2698public override object ChangeType(decimal value, Type destinationType)
2708public override object ChangeType(double value, Type destinationType)
2718public override object ChangeType(int value, Type destinationType)
2728public override object ChangeType(long value, Type destinationType)
2738public override object ChangeType(float value, Type destinationType)
2748public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
2779public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2784Type sourceType = value.GetType();
2882private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2884Type sourceType = value.GetType();
2890private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2904protected override object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
2906Type sourceType = value.GetType();
2924private bool SupportsType(Type clrType)
3019public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3024Type sourceType = value.GetType();
3060Type sourceType = value.GetType();
3076Type sourceType = value.GetType();
3091Type sourceType = value.GetType();
3107Type sourceType = value.GetType();
3123Type sourceType = value.GetType();
3139Type sourceType = value.GetType();
3155Type sourceType = value.GetType();
3171Type sourceType = value.GetType();
3190public override object ChangeType(bool value, Type destinationType)
3200public override object ChangeType(DateTime value, Type destinationType)
3210public override object ChangeType(DateTimeOffset value, Type destinationType)
3220public override object ChangeType(decimal value, Type destinationType)
3230public override object ChangeType(double value, Type destinationType)
3240public override object ChangeType(int value, Type destinationType)
3250public override object ChangeType(long value, Type destinationType)
3260public override object ChangeType(float value, Type destinationType)
3270public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver nsResolver)
3281public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3286Type sourceType = value.GetType();
3364private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3366Type sourceType = value.GetType();
3372private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3406public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3431protected XmlListConverter(XmlBaseConverter atomicConverter, Type clrTypeDefault) : base(atomicConverter, clrTypeDefault)
3462public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3475protected override object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3477Type sourceType = value.GetType();
3504Type itemTypeDst = destinationType.GetElementType();
3554private bool IsListType(Type type)
3657private new Exception CreateInvalidClrMappingException(Type sourceType, Type destinationType)
3704public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver nsResolver)
3709Type sourceType = value.GetType();
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeExporter.cs (7)
120internal static CodeAttributeDeclaration FindAttributeDeclaration(Type type, CodeAttributeDeclarationCollection metadata)
180internal void ExportRoot(StructMapping mapping, Type includeType)
239internal CodeTypeDeclaration ExportEnum(EnumMapping mapping, Type type)
265internal void AddTypeMetadata(CodeAttributeDeclarationCollection metadata, Type type, string defaultName, string name, string ns, bool includeInSchema)
293internal static void AddIncludeMetadata(CodeAttributeDeclarationCollection metadata, StructMapping mapping, Type type)
306internal static void ExportConstant(CodeTypeDeclaration codeClass, ConstantMapping constant, Type type, bool init, long enumValue)
321internal static object PromoteType(Type type, object value)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (81)
31internal static Type[] EmptyTypeArray = new Type[] { };
41private Dictionary<Tuple<Type, string>, Queue<LocalBuilder>> _freeLocals;
51internal static bool IsNullableGenericType(Type type)
56internal static void AssertHasInterface(Type type, Type iType)
61internal void BeginMethod(Type returnType, string methodName, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
68internal void BeginMethod(Type returnType, MethodBuilderInfo methodBuilderInfo, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
78private void InitILGeneration(Type[] argTypes, string[] argNames, bool isStatic)
85_freeLocals = new Dictionary<Tuple<Type, string>, Queue<LocalBuilder>>();
155private Dictionary<Type, LocalBuilder> _tmpLocals = new Dictionary<Type, LocalBuilder>();
156internal LocalBuilder GetTempLocal(Type type)
167internal Type GetVariableType(object var)
231private bool TryDequeueLocal(Type type, string name, out LocalBuilder local)
238Tuple<Type, string> key = new Tuple<Type, string>(type, name);
255internal LocalBuilder DeclareLocal(Type type, string name)
267internal LocalBuilder DeclareOrGetLocal(Type type, string name)
324Type varType = GetVariableType(forState.End);
540internal void BeginCatchBlock(Type exception)
663internal void InitObj(Type valueType)
668internal void NewArray(Type elementType, object len)
683Type objType = GetVariableType(obj).GetElementType();
697Type arrayType = GetVariableType(obj);
701Call(typeof(Array).GetMethod("SetValue", new Type[] { typeof(object), typeof(int) }));
705Type objType = arrayType.GetElementType();
719private static bool IsStruct(Type objType)
725internal Type LoadMember(object obj, MemberInfo memberInfo)
738Type currentType = propertyInfo.DeclaringType.GetTypeInfo().BaseType;
772internal Type LoadMember(MemberInfo memberInfo)
774Type memberType = null;
810internal Type LoadMemberAddress(MemberInfo memberInfo)
812Type memberType = null;
979internal void ConvertAddress(Type source, Type target)
984internal void ConvertValue(Type source, Type target)
989internal void Castclass(Type target)
994internal void Box(Type type)
999internal void Unbox(Type type)
1064internal void Ldobj(Type type)
1066OpCode opCode = GetLdindOpCode(Type.GetTypeCode(type));
1077internal void Stobj(Type type)
1116internal void Ldtoken(Type t)
1123Type valueType = o.GetType();
1124if (o is Type)
1126Ldtoken((Type)o);
1127Call(typeof(Type).GetMethod("GetTypeFromHandle", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(RuntimeTypeHandle) }, null));
1135switch (Type.GetTypeCode(valueType))
1172new Type[] { typeof(Int32), typeof(Int32), typeof(Int32), typeof(Boolean), typeof(Byte) }
1184ConstructorInfo DateTime_ctor = typeof(DateTime).GetConstructor(new Type[] { typeof(Int64) });
1293internal void Stloc(Type type, string name)
1309internal void Ldloc(Type type, string name)
1520internal void Ldelem(Type arrayElementType)
1528OpCode opCode = GetLdelemOpCode(Type.GetTypeCode(arrayElementType));
1535internal void Ldelema(Type arrayElementType)
1602internal void Stelem(Type arrayElementType)
1608OpCode opCode = GetStelemOpCode(Type.GetTypeCode(arrayElementType));
1787private void InternalConvert(Type source, Type target, bool isAddress)
1797OpCode opCode = GetConvOpCode(Type.GetTypeCode(target));
1857static internal TypeBuilder CreateTypeBuilder(ModuleBuilder moduleBuilder, string name, TypeAttributes attributes, Type parent, Type[] interfaces)
2195internal void IsInst(Type type)
2552internal Type ArgType;
2553internal ArgBuilder(string name, int index, Type argType)
2706public void AddToFreeLocals(Dictionary<Tuple<Type, string>, Queue<LocalBuilder>> freeLocals)
2710Tuple<Type, string> key = new Tuple<Type, string>(item.Value.LocalType, item.Key);
2868public readonly Type[] ParameterTypes;
2869public MethodBuilderInfo(MethodBuilder methodBuilder, Type[] parameterTypes)
2875public void Validate(Type returnType, Type[] parameterTypes, MethodAttributes attributes)
2891private Type _sourceType;
2892private Type _targetType;
2896public CodeGeneratorConversionException(Type sourceType, Type targetType, bool isAddress, string reason)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Models.cs (18)
33internal TypeModel GetTypeModel(Type type)
38internal TypeModel GetTypeModel(Type type, bool directReference)
72internal ArrayModel GetArrayModel(Type type)
92private Type _type;
95protected TypeModel(Type type, TypeDesc typeDesc, ModelScope scope)
102internal Type Type
120internal ArrayModel(Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
130internal PrimitiveModel(Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
135internal SpecialModel(Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
140internal StructModel(Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
185private void CheckSupportedMember(TypeDesc typeDesc, MemberInfo member, Type type)
258private Type _fieldType;
262internal FieldModel(string name, Type fieldType, TypeDesc fieldTypeDesc, bool checkSpecified, bool checkShouldPersist) :
266internal FieldModel(string name, Type fieldType, TypeDesc fieldTypeDesc, bool checkSpecified, bool checkShouldPersist, bool readOnly)
276internal FieldModel(MemberInfo memberInfo, Type fieldType, TypeDesc fieldTypeDesc)
282_checkShouldPersistMethodInfo = memberInfo.DeclaringType.GetMethod("ShouldSerialize" + memberInfo.Name, new Type[0]);
327internal Type FieldType
402internal EnumModel(Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
FrameworkFork\Microsoft.Xml\Xml\Serialization\SourceInfo.cs (16)
29new Type[] { typeof(Int32) },
37public readonly Type Type;
40public SourceInfo(string source, string arg, MemberInfo memberInfo, Type type, CodeGenerator ilg)
54public void LoadAddress(Type elementType)
59public void Load(Type elementType)
64private void InternalLoad(Type elementType, bool asAddress = false)
70Type varType = ILG.GetVariableType(varA);
76Type eType = varType.GetElementType();
106new Type[] { typeof(Int32) },
117Type eType = get_Item.ReturnType;
142Type varType;
174Type memberType = (MemberInfo is FieldInfo) ?
205private void Convert(Type sourceType, Type targetType, bool asAddress)
216private void ConvertNullableValue(Type nullableType, Type targetType)
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (44)
82private Type _type;
118internal TypeDesc(Type type, bool isXsdType, XmlSchemaType dataType, string formatterName, TypeFlags flags)
124internal TypeDesc(Type type, string name, string fullName, TypeKind kind, TypeDesc baseTypeDesc, TypeFlags flags, TypeDesc arrayElementTypeDesc)
183internal Type Type
365internal TypeDesc GetNullableTypeDesc(Type type)
574internal static bool IsKnownType(Type type)
580switch (Type.GetTypeCode(type))
653private static void AddPrimitive(Type type, string dataTypeName, string formatterName, TypeFlags flags)
664private static void AddNonXsdPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, XmlSchemaFacet[] facets, TypeFlags flags)
682private static void AddSoapEncodedPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, TypeFlags flags)
710internal TypeDesc GetTypeDesc(Type type)
715internal TypeDesc GetTypeDesc(Type type, MemberInfo source)
720internal TypeDesc GetTypeDesc(Type type, MemberInfo source, bool directReference)
725internal TypeDesc GetTypeDesc(Type type, MemberInfo source, bool directReference, bool throwOnError)
747internal TypeDesc GetArrayTypeDesc(Type type)
771internal Type GetTypeFromTypeDesc(TypeDesc typeDesc)
778return de.Key as Type;
783private TypeDesc ImportTypeDesc(Type type, MemberInfo memberInfo, bool directReference)
787Type arrayElementType = null;
788Type baseType = null;
990Type t = type.DeclaringType;
997private static bool IsArraySegment(Type t)
1002internal static bool IsOptionalValue(Type type)
1021internal static string TypeName(Type t)
1039Type[] arguments = t.GetGenericArguments();
1057internal static Type GetArrayElementType(Type type, string memberInfo)
1209private static bool ShouldBeReplaced(MemberInfo memberInfoToBeReplaced, Type derivedType, out MemberInfo replacedInfo)
1212Type currentType = derivedType;
1213Type typeToBeReplaced = memberInfoToBeReplaced.DeclaringType;
1254private static TypeFlags GetConstructorFlags(Type type, ref Exception exception)
1256ConstructorInfo ctor = type.GetConstructor(new Type[0]);
1277private static Type GetEnumeratorElementType(Type type, ref TypeFlags flags)
1281MethodInfo enumerator = type.GetMethod("GetEnumerator", new Type[0]);
1305enumerator = type.GetMethod("System.Collections.IEnumerable.GetEnumerator", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[0], null);
1319Type currentType = (p == null ? typeof(object) : p.PropertyType);
1321MethodInfo addMethod = type.GetMethod("Add", new Type[] { currentType });
1326addMethod = type.GetMethod("Add", new Type[] { currentType });
1340internal static PropertyInfo GetDefaultIndexer(Type type, string memberInfo)
1358for (Type t = type; t != null; t = t.GetTypeInfo().BaseType)
1383MethodInfo addMethod = type.GetMethod("Add", new Type[] { indexer.PropertyType });
1390private static Type GetCollectionElementType(Type type, string memberInfo)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlCodeExporter.cs (4)
218Type type = value.GetType();
400Type formatter = typeof(XmlConvert);
402MethodInfo format = formatter.GetMethod("To" + pm.TypeDesc.FormatterName, new Type[] { typeof(string) });
891private void ExportMetadata(CodeAttributeDeclarationCollection metadata, Type attributeType, string name, string ns, TypeDesc typeDesc, TypeDesc dataTypeDesc, object isNullable, XmlSchemaForm form, int nestingLevel, int sequenceId)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (45)
94public void IncludeTypes(Type provider)
99private void IncludeTypes(Type provider, RecursionLimiter limiter)
103Type type = attrib.Type;
112public void IncludeType(Type type)
117private void IncludeType(Type type, RecursionLimiter limiter)
141public XmlTypeMapping ImportTypeMapping(Type type)
150public XmlTypeMapping ImportTypeMapping(Type type, string defaultNamespace)
159public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute root)
168public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute root, string defaultNamespace)
240private XmlAttributes GetAttributes(Type type, bool canBeSimpleType)
477internal static MethodInfo GetMethodFromSchemaProvider(XmlSchemaProviderAttribute provider, Type type)
491MethodInfo getMethod = getMethod = type.GetMethod(provider.MethodName, /* BindingFlags.DeclaredOnly | */ BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(XmlSchemaSet) }, null);
501private SpecialMapping ImportSpecialMapping(Type type, TypeDesc typeDesc, string ns, ImportContext context, RecursionLimiter limiter)
626private static Exception InvalidAttributeUseException(Type type)
648private NullableMapping CreateNullableMapping(TypeMapping baseMapping, Type type)
712private TypeMapping GetTypeMapping(string typeName, string ns, TypeDesc typeDesc, NameTable typeLib, Type type)
953internal string XsdTypeName(Type type)
962internal string XsdTypeName(Type type, XmlAttributes a, string name)
970Type genType = type.GetGenericTypeDefinition();
971Type[] names = genType.GetGenericArguments();
972Type[] types = type.GetGenericArguments();
999private void SetArrayMappingType(ArrayMapping mapping, string defaultNs, Type type)
1380Type choiceIdentifierType = null;
1409Type choiceIdentifierType = null;
1418private Type CheckChoiceIdentifierType(Type type, bool isArrayLike, string identifierName, string memberName)
1443private Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, XmlReflectionMember[] xmlReflectionMembers, bool isArrayLike, string accessorName)
1456private Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, StructModel structModel, bool isArrayLike, string accessorName)
1486Type enumType = member.FieldType;
1491private void CreateArrayElementsFromAttributes(ArrayMapping arrayMapping, XmlArrayItemAttributes attributes, Type arrayElementType, string arrayElementNs, RecursionLimiter limiter)
1500Type targetType = xmlArrayItem.Type != null ? xmlArrayItem.Type : arrayElementType;
1515private void ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, string ns, Type choiceIdentifierType, bool rpc, bool openModel, RecursionLimiter limiter)
1525Type accessorType = model.FieldType;
1557Type arrayElementType = TypeScope.GetArrayElementType(accessorType, model.FieldTypeDesc.FullName + "." + model.Name);
1584Type targetType = a.XmlAttribute.Type == null ? arrayElementType : a.XmlAttribute.Type;
1615Type targetType = a.XmlText.Type == null ? arrayElementType : a.XmlText.Type;
1630Type targetType = xmlElement.Type == null ? arrayElementType : xmlElement.Type;
1671Type targetType = typeof(IXmlSerializable).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlNode).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlElement);
1874Type targetType = xmlElement.Type == null ? accessorType : xmlElement.Type;
1914Type targetType = typeof(IXmlSerializable).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlNode).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlElement);
2065private void CheckAmbiguousChoice(XmlAttributes a, Type accessorType, string accessorName)
2074Type type = elements[i].Type == null ? accessorType : elements[i].Type;
2099Type type = items[i].Type == null ? accessorType : items[i].Type;
2133private object GetDefaultValue(TypeDesc fieldTypeDesc, Type t, XmlAttributes a)
2247internal static XmlTypeMapping GetTopLevelMapping(Type type, string defaultNamespace)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSchemaImporter.cs (18)
68public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type baseType)
91public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type baseType, bool baseTypeCanBeIndirect)
130public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type baseType)
139public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type baseType, bool baseTypeCanBeIndirect)
247public XmlMembersMapping ImportMembersMapping(XmlQualifiedName[] names, Type baseType, bool baseTypeCanBeIndirect)
298private ElementAccessor ImportElement(XmlQualifiedName name, Type desiredMappingType, Type baseType)
313private ElementAccessor ImportElement(XmlSchemaElement element, string identifier, Type desiredMappingType, Type baseType, string ns, bool topLevelElement)
371private TypeMapping ImportElementType(XmlSchemaElement element, string identifier, Type desiredMappingType, Type baseType, string ns)
526private TypeMapping ImportType(XmlQualifiedName name, Type desiredMappingType, Type baseType, TypeFlags flags, bool addref)
553private TypeMapping ImportType(XmlSchemaComplexType type, string typeNs, string identifier, Type desiredMappingType, Type baseType, TypeFlags flags)
600private StructMapping ImportStructType(XmlSchemaType type, string typeNs, string identifier, Type baseType, bool arrayLike)
709private StructMapping ImportStructDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, Type baseType)
1765private TypeMapping ImportDataType(XmlSchemaSimpleType dataType, string typeNs, string identifier, Type baseType, TypeFlags flags, bool isList)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationILGen.cs (24)
21internal Dictionary<string, Type> CreatedTypes = new Dictionary<string, Type>();
83MethodAttributes attributes, Type returnType, Type[] parameterTypes)
208new Type[] { typeof(Object), typeof(Object) },
225internal void GenerateSupportedTypes(Type[] types, TypeBuilder serializerContractTypeBuilder)
231new Type[] { typeof(Type) },
237Type type = types[i];
298Type baseSerializerType = baseSerializerTypeBuilder.CreateTypeInfo().AsType();
321new Type[] { typeof(XmlReader) },
338new Type[] { typeof(String), typeof(String) },
358new Type[] { typeof(object), typeof(XmlSerializationWriter) },
365new Type[] { (mapping is XmlMembersMapping) ? typeof(object[]) : typeof(object) },
384new Type[] { typeof(XmlSerializationReader) },
400Type typedSerializerType = typedSerializerTypeBuilder.CreateTypeInfo().AsType();
414new Type[] { typeof(Object), typeof(Object) },
438new Type[] { typeof(Type) },
446Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type;
476internal void GenerateSerializerContract(string className, XmlMapping[] xmlMappings, Type[] types, string readerType, string[] readMethods, string writerType, string[] writerMethods, Hashtable serializers)
554Type serializerContractType = serializerContractTypeBuilder.CreateTypeInfo().AsType();
568internal void ILGenLoad(string source, Type type)
577Type memType = memInfo is FieldInfo ? ((FieldInfo)memInfo).FieldType : ((PropertyInfo)memInfo).PropertyType;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (14)
295private Type GetPrimitiveType(XmlQualifiedName typeName, bool throwOnUnknown)
1399protected Exception CreateUnknownConstantException(string value, Type enumType)
1405protected Exception CreateInvalidCastException(Type type, object value)
1411protected Exception CreateInvalidCastException(Type type, object value, string id)
1435protected Array EnsureArrayIndex(Array a, int index, Type elementType)
1445protected Array ShrinkArray(Array a, int length, Type elementType, bool isNullable)
1657Type fallbackElementType = null;
1662Type arrayType = (Type)_types[new XmlQualifiedName(typeName, typeNs)];
1687Type elementType = null;
1692elementType = (Type)_types[qname];
1821Type itemType = null;
1827Type currItemType = currItem.GetType();
1954protected void AddReadCallback(string name, string ns, Type type, XmlSerializationReadCallback read)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriter.cs (46)
189private XmlQualifiedName GetPrimitiveTypeName(Type type)
194private XmlQualifiedName GetPrimitiveTypeName(Type type, bool throwIfUnknown)
202internal static XmlQualifiedName GetPrimitiveTypeNameInternal(Type type)
207switch (Type.GetTypeCode(type))
254Type t = o.GetType();
257switch (Type.GetTypeCode(t))
814protected Exception CreateUnknownTypeException(Type type)
861protected Exception CreateInvalidAnyTypeException(Type type)
1211protected void AddWriteCallback(Type type, string typeName, string typeNs, XmlSerializationWriteCallback callback)
1221private void WriteArray(string name, string ns, object o, Type type)
1223Type elementType = TypeScope.GetArrayElementType(type, null);
1260Type elementBaseType = elementType.GetTypeInfo().BaseType;
1352protected void WritePotentiallyReferencingElement(string n, string ns, object o, Type ambientType)
1358protected void WritePotentiallyReferencingElement(string n, string ns, object o, Type ambientType, bool suppressReference)
1364protected void WritePotentiallyReferencingElement(string n, string ns, object o, Type ambientType, bool suppressReference, bool isNullable)
1371Type t = o.GetType();
1413private void WriteReferencedElement(object o, Type ambientType)
1418private void WriteReferencedElement(string name, string ns, object o, Type ambientType)
1421Type t = o.GetType();
1438private TypeEntry GetTypeEntry(Type t)
1512internal Type type;
2379Writer.Write(typeof(Type).FullName);
3445private void WriteElementCall(string func, Type cast, string source, string name, string ns, bool isNullable, bool isAny)
3524Type type = value.GetType();
3526switch (Type.GetTypeCode(type))
3718internal static bool IsTypeDynamic(Type type)
3734Type[] parameterTypes = type.GetGenericArguments();
3739Type parameterType = parameterTypes[i];
3756internal static bool IsTypeDynamic(Type[] arguments)
3758foreach (Type t in arguments)
3834foreach (Type type in scope.Types)
3842private string WriteTypeInfo(TypeScope scope, TypeDesc typeDesc, Type type)
3857_writer.WriteLine("static " + typeof(Type).FullName + " " + typeVariable + " = " + elementTypeVariable + ".MakeArrayType();");
3862_writer.Write("static " + typeof(Type).FullName + " " + typeVariable + " = " + assemblyVariable + ".GetType(");
3871Type parameterType = Nullable.GetUnderlyingType(type);
3875_writer.WriteLine("static " + typeof(Type).FullName + " " + typeVariable + " = typeof(System.Nullable<>).MakeGenericType(new " + typeof(Type).FullName + "[] {" + parameterTypeVariable + "});");
3880_writer.Write("static " + typeof(Type).FullName + " " + typeVariable + " = " + assemblyVariable + ".GetType(");
3907"object", "string", typeof(Type).FullName,
3915private void WriteMappingInfo(TypeMapping mapping, string typeVariable, Type type)
3951private void WriteCollectionInfo(string typeVariable, TypeDesc typeDesc, Type type)
3974private string WriteAssemblyInfo(Type type)
3993private string WriteMemberInfo(Type type, string escapedName, string typeVariable, string memberName)
4043_writer.Write("new " + typeof(Type).FullName + "[] { ");
4055private string WriteDefaultIndexerInit(Type type, string escapedName, bool collectionUseReflection, bool elementUseReflection)
4069_writer.Write(typeof(Type[]).FullName);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationWriterILGen.cs (91)
61internal Type GenerateEnd()
99List<Type> argTypes = new List<Type>();
126private void WriteEnumValue(EnumMapping mapping, SourceInfo source, out Type returnType)
141new Type[] { mapping.TypeDesc.Type });
148private void WritePrimitiveValue(TypeDesc typeDesc, SourceInfo source, out Type returnType)
159Type argType = typeDesc.Type;
164new Type[] { argType },
184new Type[] { typeDesc.Type },
233List<Type> argTypes = new List<Type>();
242Type argType;
258ConstructorInfo XmlQualifiedName_ctor = typeof(XmlQualifiedName).GetConstructor(new Type[] { typeof(String), typeof(String) });
286new Type[] { typeof(String), typeof(String) },
301new Type[] { typeof(string), typeof(string), typeof(object), typeof(Boolean) },
335new Type[] { typeof(Object) },
366new Type[] { typeof(object[]) },
563new Type[] { typeof(object) },
615List<Type> argTypes = new List<Type>();
700new Type[] { typeof(Int64), typeof(String[]), typeof(Int64[]), typeof(String) },
729new Type[] { typeof(IFormatProvider) },
736new Type[] { typeof(object), typeof(string) },
775List<Type> argTypes = new List<Type>();
782Type oType = ilg.GetVariableType(oVar);
836new Type[] { typeof(String), typeof(String) },
848new Type[] { typeof(String), typeof(String) },
859new Type[] { mapping.TypeDesc.Type }
865new Type[] { typeof(String) },
912new Type[] { typeof(String), typeof(String) },
924new Type[] { typeof(String), typeof(String) },
956List<Type> argTypes = new List<Type>(5);
986new Type[] { typeof(String), typeof(String) },
1001LocalBuilder tLoc = ilg.DeclareLocal(typeof(Type), "t");
1027new Type[] { typeof(String), typeof(String), typeof(Object), typeof(Boolean) },
1044new Type[] { typeof(Object) },
1064new Type[] { typeof(Boolean) },
1101new Type[] { typeof(String), typeof(String), typeof(Object), typeof(Boolean), typeof(XmlSerializerNamespaces) },
1113new Type[] { typeof(String), typeof(String) },
1240new Type[] { typeof(String), typeof(String), typeof(String) },
1282Type methodType;
1283Type argType = typeof(string);
1301new Type[] { typeof(String) },
1319new Type[] { typeof(string) },
1342new Type[] { argType },
1394List<Type> argTypes = new List<Type>();
1449new Type[] { typeof(XmlNode), typeof(Object) },
1469private static object GetConvertedDefaultValue(Type targetType, object rawDefaultValue)
1538new Type[] { typeof(String), typeof(String) },
1582Type typeIEnumerable = arrayTypeDesc.IsGenericInterface ? typeof(IEnumerable<>).MakeGenericType(arrayElementTypeDesc.Type) : typeof(IEnumerable);
1818new Type[] { typeof(string), typeof(string) },
1843new Type[] { typeof(String), typeof(String), typeof(String), typeof(String) },
1872new Type[] { typeof(String), typeof(String) },
1937new Type[] { typeof(Object) },
1958Type argType;
1972new Type[] { argType },
1987new Type[] { typeof(XmlWriter) },
2113List<Type> argTypes = new List<Type>();
2171new Type[] { typeof(Object) },
2188private void WriteElementCall(string func, Type cast, SourceInfo source, string name, string ns, bool isNullable, bool isAny)
2194new Type[] { cast, typeof(String), typeof(String), typeof(Boolean), typeof(Boolean) },
2262Type valueType = value.GetType();
2269new Type[] { valueType, valueType },
2301new Type[] { typeof(String), typeof(String), typeof(String) },
2331new Type[] { typeof(XmlSerializerNamespaces) },
2351private void WriteLocalDecl(string variableName, string initValue, Type type)
2360private void WriteTypeCompare(string variable, Type type)
2364private void WriteInstanceOf(SourceInfo source, Type type)
2368private void WriteArrayTypeCompare(string variable, Type arrayType)
2446foreach (Type type in scope.Types)
2492internal void ILGenForEnumMember(CodeGenerator ilg, Type type, string memberName)
2506internal void ILGenForCreateInstance(CodeGenerator ilg, Type type, bool ctorInaccessible, bool cast)
2527internal void ILGenForCreateInstance(CodeGenerator ilg, Type type, Type cast, bool nonPublic)
2541Type xName = type.GetTypeInfo().Assembly.GetType("System.Xml.Linq.XName");
2548new Type[] { typeof(String) },
2551ConstructorInfo XElement_ctor = type.GetConstructor(new Type[] { xName });
2573new Type[] { typeof(Type), typeof(BindingFlags), typeof(Binder), typeof(Object[]), typeof(CultureInfo) },
2588Type localType = initValue.Type;
2627internal void WriteCreateInstance(string source, bool ctorInaccessible, Type type, CodeGenerator ilg)
2633internal void WriteInstanceOf(SourceInfo source, Type type, CodeGenerator ilg)
2647Type localType = (typeName == arrayTypeDesc.CSharpName) ? arrayTypeDesc.Type : arrayTypeDesc.Type.MakeArrayType();
2656internal void WriteTypeCompare(string variable, Type type, CodeGenerator ilg)
2660ilg.Ldloc(typeof(Type), variable);
2664internal void WriteArrayTypeCompare(string variable, Type arrayType, CodeGenerator ilg)
2669ilg.Ldloc(typeof(Type), variable);
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializer.cs (30)
107public virtual bool CanSerialize(Type type) { throw new NotSupportedException(); }
109public virtual XmlSerializer GetSerializer(Type type) { throw new NotSupportedException(); }
120private Type _primitiveType;
156public XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace) :
165public XmlSerializer(Type type, XmlRootAttribute root) : this(type, null, new Type[0], root, null, null)
173public XmlSerializer(Type type, Type[] extraTypes) : this(type, null, extraTypes, null, null, null)
181public XmlSerializer(Type type, XmlAttributeOverrides overrides) : this(type, overrides, new Type[0], null, null, null)
199public XmlSerializer(Type type) : this(type, (string)null)
207public XmlSerializer(Type type, string defaultNamespace)
255internal XmlSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
284internal static TempAssembly GenerateTempAssembly(XmlMapping xmlMapping, Type type, string defaultNamespace)
288return new TempAssembly(new XmlMapping[] { xmlMapping }, new Type[] { type }, defaultNamespace, null);
291internal static TempAssembly GenerateTempAssembly(XmlMapping xmlMapping, Type type, string defaultNamespace, string location)
293return new TempAssembly(new XmlMapping[] { xmlMapping }, new Type[] { type }, defaultNamespace, location);
531return FromMappings(mappings, (Type)null);
539public static XmlSerializer[] FromMappings(XmlMapping[] mappings, Type type)
555tempAssembly = new TempAssembly(mappings, new Type[] { type }, null, null);
584private static XmlSerializer[] GetSerializersFromCache(XmlMapping[] mappings, Type type)
621TempAssembly tempAssembly = new TempAssembly(pendingMappings, new Type[] { type }, null, null);
642public static XmlSerializer[] FromTypes(Type[] types)
661public static string GetXmlSerializerAssemblyName(Type type)
671public static string GetXmlSerializerAssemblyName(Type type, string defaultNamespace)
758private static XmlTypeMapping GetKnownMapping(Type type, string ns)
776switch (Type.GetTypeCode(_primitiveType))
850switch (Type.GetTypeCode(_primitiveType))
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializerFactory.cs (12)
34public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace)
43public XmlSerializer CreateSerializer(Type type, XmlRootAttribute root)
45return CreateSerializer(type, null, new Type[0], root, null, null);
52public XmlSerializer CreateSerializer(Type type, Type[] extraTypes)
61public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides)
63return CreateSerializer(type, overrides, new Type[0], null, null, null);
80public XmlSerializer CreateSerializer(Type type)
89public XmlSerializer CreateSerializer(Type type, string defaultNamespace)
126public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides overrides, Type[] extraTypes, XmlRootAttribute root, string defaultNamespace, string location)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ClassDataContract.cs (31)
76internal ClassDataContract(Type type) : base(new ClassDataContractCriticalHelper(type))
86private ClassDataContract(Type type, XmlDictionaryString ns, string[] memberNames) : base(new ClassDataContractCriticalHelper(type, ns, memberNames))
264internal Type[] KeyValuePairGenericArguments
353internal static ClassDataContract CreateClassDataContractForKeyValue(Type type, XmlDictionaryString ns, string[] memberNames)
370Type declaringType = memberContract.MemberInfo.DeclaringType;
383internal static XmlDictionaryString GetChildNamespaceToDeclare(DataContract dataContract, Type childType, XmlDictionary dictionary)
396private static bool IsArraySegment(Type t)
408static internal bool IsNonAttributedTypeValidForSerialization(Type type)
428Type[] interfaceTypes = type.GetInterfaces();
432foreach (Type interfaceType in interfaceTypes)
449type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, Array.Empty<Type>()) != null);
473internal static bool IsKnownSerializableType(Type type)
782internal ClassDataContractCriticalHelper(Type type) : base(type)
796Type baseType = type.GetTypeInfo().BaseType;
854internal ClassDataContractCriticalHelper(Type type, XmlDictionaryString ns, string[] memberNames) : base(type)
873private void EnsureIsReferenceImported(Type type)
927Type type = this.UnderlyingType;
1170private XmlQualifiedName GetStableNameAndSetHasDataContract(Type type)
1182private void SetIsNonAttributedType(Type type)
1200Type type = this.UnderlyingType;
1205Type prevAttributeType = null;
1225private static bool IsValidCallback(MethodInfo method, ParameterInfo[] parameters, Type attributeType, MethodInfo currentCallback, ref Type prevAttributeType)
1348private void SetKeyValuePairAdapterFlags(Type type)
1354_keyValuePairCtorInfo = type.GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfKeyValuePair.MakeGenericType(_keyValuePairGenericArguments) });
1360private Type[] _keyValuePairGenericArguments;
1374internal Type[] KeyValuePairGenericArguments
1394Type type = UnderlyingType;
1399ConstructorInfo ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, Array.Empty<Type>());
1509internal Type ObjectType
1513Type type = UnderlyingType;
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (51)
38s_getTypeFromHandle = typeof(Type).GetMethod("GetTypeFromHandle");
85s_arraySetValue = typeof(Array).GetMethod("SetValue", new Type[] { typeof(object), typeof(int) });
102s_objectToString = typeof(object).GetMethod("ToString", Array.Empty<Type>());
117s_stringFormat = typeof(string).GetMethod("Format", new Type[] { typeof(string), typeof(object[]) });
125private Type _delegateType;
180internal void BeginMethod(DynamicMethod dynamicMethod, Type delegateType, string methodName, Type[] argTypes, bool allowPrivateMemberAccess)
190internal void BeginMethod(string methodName, Type delegateType, bool allowPrivateMemberAccess)
194Type[] paramTypes = new Type[parameters.Length];
202private void BeginMethod(Type returnType, string methodName, Type[] argTypes, bool allowPrivateMemberAccess)
219private void InitILGeneration(string methodName, Type[] argTypes)
272internal Type GetVariableType(object var)
282internal LocalBuilder DeclareLocal(Type type, string name, object initialValue)
290internal LocalBuilder DeclareLocal(Type type, string name)
295internal LocalBuilder DeclareLocal(Type type, string name, bool isPinned)
382internal void ForEach(LocalBuilder local, Type elementType, Type enumeratorType,
417Type type = GetVariableType(value);
629internal void InitObj(Type valueType)
636internal void NewArray(Type elementType, object len)
646Type objType = GetVariableType(obj).GetElementType();
660Type arrayType = GetVariableType(obj);
667Type objType = arrayType.GetElementType();
681private static bool IsStruct(Type objType)
686internal Type LoadMember(MemberInfo memberInfo)
688Type memberType = null;
766internal void LoadDefaultValue(Type type)
856internal void ConvertAddress(Type source, Type target)
861internal void ConvertValue(Type source, Type target)
867internal void Castclass(Type target)
874internal void Box(Type type)
881internal void Unbox(Type type)
923internal void Ldobj(Type type)
940internal void Stobj(Type type)
962internal void Ldtoken(Type t)
971Type valueType = o.GetType();
972if (o is Type)
974Ldtoken((Type)o);
1266internal void Ldelem(Type arrayElementType)
1283internal void Ldelema(Type arrayElementType)
1330internal void Stelem(Type arrayElementType)
1504private void InternalConvert(Type source, Type target, bool isAddress)
1595internal void EmitStackTop(Type stackTopType)
1703internal void ToString(Type type)
1721internal Type ArgType;
1722internal ArgBuilder(int index, Type argType)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CollectionDataContract.cs (73)
162internal CollectionDataContract(Type type) : base(new CollectionDataContractCriticalHelper(type))
172private CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo addMethod, ConstructorInfo constructor)
183private CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo addMethod, ConstructorInfo constructor, bool isConstructorCheckRequired)
194private CollectionDataContract(Type type, string invalidCollectionInSharedContractMessage) : base(new CollectionDataContractCriticalHelper(type, invalidCollectionInSharedContractMessage))
214private static Type[] KnownInterfaces
236public Type ItemType
571private static Type[] s_knownInterfaces;
573private Type _itemType;
594internal static Type[] KnownInterfaces
601s_knownInterfaces = new Type[]
617private void Init(CollectionKind kind, Type itemType, CollectionDataContractAttribute collectionContractAttribute)
677internal CollectionDataContractCriticalHelper(Type type) : base(type)
688internal CollectionDataContractCriticalHelper(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo addMethod, ConstructorInfo constructor) : base(type)
707internal CollectionDataContractCriticalHelper(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo addMethod, ConstructorInfo constructor, bool isConstructorCheckRequired)
713internal CollectionDataContractCriticalHelper(Type type, string invalidCollectionInSharedContractMessage) : base(type)
724internal Type ItemType
885private DataContract GetSharedTypeContract(Type type)
898internal static bool IsCollectionInterface(Type type)
902return ((IList<Type>)KnownInterfaces).Contains(type);
905internal static bool IsCollection(Type type)
907Type itemType;
911internal static bool IsCollection(Type type, out Type itemType)
916internal static bool IsCollection(Type type, bool constructorRequired)
918Type itemType;
922private static bool IsCollectionHelper(Type type, out Type itemType, bool constructorRequired)
933internal static bool TryCreate(Type type, out DataContract dataContract)
935Type itemType;
939internal static bool CreateGetOnlyCollectionDataContract(Type type, out DataContract dataContract)
941Type itemType;
953internal static bool TryCreateGetOnlyCollectionDataContract(Type type, out DataContract dataContract)
956Type itemType;
980internal static MethodInfo GetTargetMethodWithName(string name, Type type, Type interfaceType)
982Type t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault();
988private static bool IsArraySegment(Type t)
993private static bool IsCollectionOrTryCreate(Type type, bool tryCreate, out DataContract dataContract, out Type itemType, bool constructorRequired)
1005Type baseType = type.GetTypeInfo().BaseType;
1027Type interfaceTypeToCheck = type.GetTypeInfo().IsGenericType ? type.GetGenericTypeDefinition() : type;
1028Type[] knownInterfaces = KnownInterfaces;
1036Type[] genericArgs = type.GetGenericArguments();
1048var collectionType = Globals.TypeOfICollectionGeneric.MakeGenericType(itemType);
1086defaultCtor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Array.Empty<Type>());
1094Type knownInterfaceType = null;
1097Type[] interfaceTypes = type.GetInterfaces();
1098foreach (Type interfaceType in interfaceTypes)
1100Type interfaceTypeToCheck = interfaceType.GetTypeInfo().IsGenericType ? interfaceType.GetGenericTypeDefinition() : interfaceType;
1101Type[] knownInterfaces = KnownInterfaces;
1131GetCollectionMethods(type, knownInterfaceType, new Type[] { itemType },
1149Type[] addMethodTypeArray = null;
1159addMethodTypeArray = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject };
1169addMethodTypeArray = new Type[] { itemType };
1189internal static bool IsCollectionDataContract(Type type)
1194private static bool HandleIfInvalidCollection(Type type, bool tryCreate, bool hasCollectionDataContract, bool createContractWithException, string message, string param, ref DataContract dataContract)
1218private static void FindCollectionMethodsOnInterface(Type type, Type interfaceType, ref MethodInfo addMethod, ref MethodInfo getEnumeratorMethod)
1220Type t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault();
1228private static void GetCollectionMethods(Type type, Type interfaceType, Type[] addMethodTypeArray, bool addMethodOnInterface, out MethodInfo getEnumeratorMethod, out MethodInfo addMethod)
1240Type[] parentInterfaceTypes = interfaceType.GetInterfaces();
1241foreach (Type parentInterfaceType in parentInterfaceTypes)
1265getEnumeratorMethod = type.GetMethod(Globals.GetEnumeratorMethodName, BindingFlags.Instance | BindingFlags.Public, Array.Empty<Type>());
1268Type ienumerableInterface = interfaceType.GetInterfaces().Where(t => t.FullName.StartsWith("System.Collections.Generic.IEnumerable")).FirstOrDefault();
1276private static bool IsKnownInterface(Type type)
1278Type typeToCheck = type.GetTypeInfo().IsGenericType ? type.GetGenericTypeDefinition() : type;
1279foreach (Type knownInterfaceType in KnownInterfaces)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (96)
109internal static DataContract GetDataContract(Type type)
114internal static DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type type)
119internal static DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type type, SerializationMode mode)
137internal static DataContract GetDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type type)
142internal static DataContract GetGetOnlyCollectionDataContract(int id, RuntimeTypeHandle typeHandle, Type type, SerializationMode mode)
158internal static DataContract GetGetOnlyCollectionDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type type)
198public static DataContract GetBuiltInDataContract(Type type)
238internal static void ThrowInvalidDataContractException(string message, Type type)
259public Type UnderlyingType
271public Type OriginalUnderlyingType { get; set; }
285internal Type TypeForInitialization
529private static Dictionary<Type, DataContract> s_typeToBuiltInContract;
542private Type _underlyingType;
558private Type _typeForInitialization;
567internal static DataContract GetDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type type)
588internal static DataContract GetGetOnlyCollectionDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type type)
677private static DataContract CreateDataContract(int id, RuntimeTypeHandle typeHandle, Type type)
688type = Type.GetTypeFromHandle(typeHandle);
692var originalType = type;
755private static bool IsTypeSerializable(Type type)
760private static DataContract CreateGetOnlyCollectionDataContract(int id, RuntimeTypeHandle typeHandle, Type type)
769type = Type.GetTypeFromHandle(typeHandle);
781internal static Type GetDataContractAdapterType(Type type)
808public static DataContract GetBuiltInDataContract(Type type)
816s_typeToBuiltInContract = new Dictionary<Type, DataContract>();
846static public bool TryCreateBuiltInDataContract(Type type, out DataContract dataContract)
1085internal static void ThrowInvalidDataContractException(string message, Type type)
1114internal DataContractCriticalHelper(Type type)
1121internal Type UnderlyingType
1135internal Type TypeForInitialization
1146private void SetTypeForInitialization(Type classType)
1238MethodInfo method = UnderlyingType.GetMethod(Globals.ParseMethodName, BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(string) });
1281static internal bool IsTypeSerializable(Type type)
1283return IsTypeSerializable(type, new HashSet<Type>());
1286private static bool IsTypeSerializable(Type type, HashSet<Type> previousCollectionTypes)
1288Type itemType;
1313private static void ValidatePreviousCollectionTypes(Type collectionType, Type itemType, HashSet<Type> previousCollectionTypes)
1326internal static Type UnwrapRedundantNullableType(Type type)
1328Type nullableType = type;
1337internal static Type UnwrapNullableType(Type type)
1401internal static XmlQualifiedName GetStableName(Type type)
1407internal static XmlQualifiedName GetStableName(Type type, out bool hasDataContract)
1409return GetStableName(type, new HashSet<Type>(), out hasDataContract);
1419internal static XmlQualifiedName GetStableName(Type type, HashSet<Type> previousCollectionTypes, out bool hasDataContract)
1445private static XmlQualifiedName GetDCTypeStableName(Type type, DataContractAttribute dataContractAttribute)
1473private static XmlQualifiedName GetNonDCTypeStableName(Type type, HashSet<Type> previousCollectionTypes)
1477Type itemType;
1498private static bool TryGetBuiltInXmlAndArrayTypeStableName(Type type, HashSet<Type> previousCollectionTypes, out XmlQualifiedName stableName)
1517Type itemType = type.GetElementType();
1530internal static bool TryGetDCAttribute(Type type, out DataContractAttribute dataContractAttribute)
1572internal static XmlQualifiedName GetCollectionStableName(Type type, Type itemType, out CollectionDataContractAttribute collectionContractAttribute)
1574return GetCollectionStableName(type, itemType, new HashSet<Type>(), out collectionContractAttribute);
1577internal static XmlQualifiedName GetCollectionStableName(Type type, Type itemType, HashSet<Type> previousCollectionTypes, out CollectionDataContractAttribute collectionContractAttribute)
1621private static string GetArrayPrefix(ref Type itemType)
1656internal static XmlQualifiedName GetDefaultStableName(Type type)
1661private static string GetDefaultStableLocalName(Type type)
1690Type[] genParams = type.GetGenericArguments();
1693Type genParam = genParams[i];
1718private static string GetDefaultDataContractNamespace(Type type)
1773internal static string GetDefaultStableNamespace(Type type)
1791private static void CheckExplicitDataContractNamespaceUri(string dataContractNs, Type type)
1811internal static string GetClrTypeFullName(Type type)
2000private static string ExpandGenericParameters(string format, Type type)
2051static internal bool IsTypeNullable(Type type)
2060internal static DataContractDictionary ImportKnownTypeAttributes(Type type)
2063Dictionary<Type, Type> typesChecked = new Dictionary<Type, Type>();
2068private static void ImportKnownTypeAttributes(Type type, Dictionary<Type, Type> typesChecked, ref DataContractDictionary knownDataContracts)
2110MethodInfo method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, Array.Empty<Type>());
2123foreach (Type ty in (IEnumerable<Type>)types)
2168internal static void CheckAndAdd(Type type, Dictionary<Type, Type> typesChecked, ref DataContractDictionary nameToDataContractTable)
2216static internal bool IsTypeVisible(Type t)
2221foreach (Type genericType in t.GetGenericArguments())
2268private static bool IsTypeVisibleInSerializationModule(Type type)
2346internal GenericNameProvider(Type type)
2412Type paramType = o as Type;
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContractSerializer.cs (38)
22private Type _rootType;
30private ReadOnlyCollection<Type> _knownTypeCollection;
31internal IList<Type> knownTypeList;
37public DataContractSerializer(Type type)
38: this(type, (IEnumerable<Type>)null)
42public DataContractSerializer(Type type, IEnumerable<Type> knownTypes)
48public DataContractSerializer(Type type, string rootName, string rootNamespace)
53public DataContractSerializer(Type type, string rootName, string rootNamespace, IEnumerable<Type> knownTypes)
60public DataContractSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace)
65public DataContractSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace, IEnumerable<Type> knownTypes)
73internal DataContractSerializer(Type type, IEnumerable<Type> knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences)
79public DataContractSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace,
80IEnumerable<Type> knownTypes,
89public DataContractSerializer(Type type, DataContractSerializerSettings settings)
99private void Initialize(Type type,
100IEnumerable<Type> knownTypes,
112this.knownTypeList = new List<Type>();
113foreach (Type knownType in knownTypes)
129private void Initialize(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace,
130IEnumerable<Type> knownTypes,
144public ReadOnlyCollection<Type> KnownTypes
152_knownTypeCollection = new ReadOnlyCollection<Type>(knownTypeList);
156_knownTypeCollection = new ReadOnlyCollection<Type>(Array.Empty<Type>());
311Type declaredType = contract.UnderlyingType;
312Type graphType = (graph == null) ? declaredType : graph.GetType();
365internal static DataContract GetDataContract(DataContract declaredTypeContract, Type declaredType, Type objectType)
451internal override Type GetSerializeType(object graph)
456internal override Type GetDeserializeType()
461internal static object SurrogateToDataContractType(ISerializationSurrogateProvider serializationSurrogateProvider, object oldObj, Type surrogatedDeclaredType, ref Type objType)
471internal static Type GetSurrogatedType(ISerializationSurrogateProvider serializationSurrogateProvider, Type type)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContractSet.cs (30)
22private ICollection<Type> _referencedTypes;
23private ICollection<Type> _referencedCollectionTypes;
27internal DataContractSet(IDataContractSurrogate dataContractSurrogate, ICollection<Type> referencedTypes, ICollection<Type> referencedCollectionTypes)
97internal void Add(Type type)
104internal static void EnsureTypeNotGeneric(Type type)
219internal XmlQualifiedName GetStableName(Type clrType)
223Type dcType = DataContractSurrogateCaller.GetDataContractType(_dataContractSurrogate, clrType);
232internal DataContract GetDataContract(Type clrType)
239Type dcType = DataContractSurrogateCaller.GetDataContractType(_dataContractSurrogate, clrType);
257Type dataMemberType = dataMember.MemberType;
262Type dcType = DataContractSurrogateCaller.GetDataContractType(_dataContractSurrogate, dataMemberType);
358foreach (Type type in _referencedTypes)
377foreach (Type type in _referencedCollectionTypes)
391private void AddReferencedType(Dictionary<XmlQualifiedName, object> referencedTypes, Type type)
414Type referencedType = value as Type;
420List<Type> types = new List<Type>();
428List<Type> types = (List<Type>)value;
438internal bool TryGetReferencedType(XmlQualifiedName stableName, DataContract dataContract, out Type type)
443internal bool TryGetReferencedCollectionType(XmlQualifiedName stableName, DataContract dataContract, out Type type)
448private bool TryGetReferencedType(XmlQualifiedName stableName, DataContract dataContract, bool useReferencedCollectionTypes, out Type type)
454type = value as Type;
460List<Type> types = (List<Type>)value;
465Type conflictingType = types[i];
495private static bool IsTypeReferenceable(Type type)
497Type itemType;
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContractSurrogateCaller.cs (14)
14internal static Type GetDataContractType(IDataContractSurrogate surrogate, Type type)
18Type dcType = surrogate.GetDataContractType(type);
24internal static Type GetDataContractType(ISerializationSurrogateProvider surrogateProvider, Type type)
31internal static object GetObjectToSerialize(ISerializationSurrogateProvider surrogateProvider, object obj, Type objType, Type membertype)
40internal static object GetDeserializedObject(ISerializationSurrogateProvider surrogateProvider, object obj, Type objType, Type memberType)
49internal static object GetCustomDataToExport(IDataContractSurrogate surrogate, MemberInfo memberInfo, Type dataContractType)
54internal static object GetCustomDataToExport(IDataContractSurrogate surrogate, Type clrType, Type dataContractType)
61internal static void GetKnownCustomDataTypes(IDataContractSurrogate surrogate, Collection<Type> customDataTypes)
66internal static Type GetReferencedTypeOnImport(IDataContractSurrogate surrogate, string typeName, string typeNamespace, object customData)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\Globals.cs (142)
60private static Type s_typeOfObject;
61internal static Type TypeOfObject
73private static Type s_typeOfValueType;
74internal static Type TypeOfValueType
86private static Type s_typeOfArray;
87internal static Type TypeOfArray
99private static Type s_typeOfException;
100internal static Type TypeOfException
112private static Type s_typeOfString;
113internal static Type TypeOfString
125private static Type s_typeOfInt;
126internal static Type TypeOfInt
138private static Type s_typeOfULong;
139internal static Type TypeOfULong
151private static Type s_typeOfVoid;
152internal static Type TypeOfVoid
164private static Type s_typeOfByteArray;
165internal static Type TypeOfByteArray
177private static Type s_typeOfTimeSpan;
178internal static Type TypeOfTimeSpan
190private static Type s_typeOfGuid;
191internal static Type TypeOfGuid
203private static Type s_typeOfDateTimeOffset;
204internal static Type TypeOfDateTimeOffset
216private static Type s_typeOfDateTimeOffsetAdapter;
217internal static Type TypeOfDateTimeOffsetAdapter
229private static Type s_typeOfUri;
230internal static Type TypeOfUri
242private static Type s_typeOfTypeEnumerable;
243internal static Type TypeOfTypeEnumerable
249s_typeOfTypeEnumerable = typeof(IEnumerable<Type>);
255private static Type s_typeOfStreamingContext;
256internal static Type TypeOfStreamingContext
268private static Type s_typeOfXmlFormatClassWriterDelegate;
269internal static Type TypeOfXmlFormatClassWriterDelegate
281private static Type s_typeOfXmlFormatCollectionWriterDelegate;
282internal static Type TypeOfXmlFormatCollectionWriterDelegate
294private static Type s_typeOfXmlFormatClassReaderDelegate;
295internal static Type TypeOfXmlFormatClassReaderDelegate
307private static Type s_typeOfXmlFormatCollectionReaderDelegate;
308internal static Type TypeOfXmlFormatCollectionReaderDelegate
320private static Type s_typeOfXmlFormatGetOnlyCollectionReaderDelegate;
321internal static Type TypeOfXmlFormatGetOnlyCollectionReaderDelegate
333private static Type s_typeOfKnownTypeAttribute;
334internal static Type TypeOfKnownTypeAttribute
349private static Type s_typeOfDataContractAttribute;
350internal static Type TypeOfDataContractAttribute
366private static Type s_typeOfContractNamespaceAttribute;
367internal static Type TypeOfContractNamespaceAttribute
379private static Type s_typeOfDataMemberAttribute;
380internal static Type TypeOfDataMemberAttribute
392private static Type s_typeOfEnumMemberAttribute;
393internal static Type TypeOfEnumMemberAttribute
405private static Type s_typeOfCollectionDataContractAttribute;
406internal static Type TypeOfCollectionDataContractAttribute
418private static Type s_typeOfObjectArray;
419internal static Type TypeOfObjectArray
431private static Type s_typeOfOnSerializingAttribute;
432internal static Type TypeOfOnSerializingAttribute
444private static Type s_typeOfOnSerializedAttribute;
445internal static Type TypeOfOnSerializedAttribute
457private static Type s_typeOfOnDeserializingAttribute;
458internal static Type TypeOfOnDeserializingAttribute
470private static Type s_typeOfOnDeserializedAttribute;
471internal static Type TypeOfOnDeserializedAttribute
484private static Type s_typeOfFlagsAttribute;
485internal static Type TypeOfFlagsAttribute
497private static Type s_typeOfIXmlSerializable;
498internal static Type TypeOfIXmlSerializable
510private static Type s_typeOfXmlSchemaProviderAttribute;
511internal static Type TypeOfXmlSchemaProviderAttribute
523private static Type s_typeOfXmlRootAttribute;
524internal static Type TypeOfXmlRootAttribute
536private static Type s_typeOfXmlQualifiedName;
537internal static Type TypeOfXmlQualifiedName
606private static Type s_typeOfIPropertyChange;
607internal static Type TypeOfIPropertyChange
619private static Type s_typeOfIExtensibleDataObject;
620internal static Type TypeOfIExtensibleDataObject
632private static Type s_typeOfExtensionDataObject;
633internal static Type TypeOfExtensionDataObject
645private static Type s_typeOfNullable;
646internal static Type TypeOfNullable
658private static Type s_typeOfIDictionaryGeneric;
659internal static Type TypeOfIDictionaryGeneric
671private static Type s_typeOfIDictionary;
672internal static Type TypeOfIDictionary
684private static Type s_typeOfIListGeneric;
685internal static Type TypeOfIListGeneric
697private static Type s_typeOfIList;
698internal static Type TypeOfIList
710private static Type s_typeOfICollectionGeneric;
711internal static Type TypeOfICollectionGeneric
723private static Type s_typeOfICollection;
724internal static Type TypeOfICollection
736private static Type s_typeOfIEnumerableGeneric;
737internal static Type TypeOfIEnumerableGeneric
749private static Type s_typeOfIEnumerable;
750internal static Type TypeOfIEnumerable
762private static Type s_typeOfIEnumeratorGeneric;
763internal static Type TypeOfIEnumeratorGeneric
775private static Type s_typeOfIEnumerator;
776internal static Type TypeOfIEnumerator
788private static Type s_typeOfKeyValuePair;
789internal static Type TypeOfKeyValuePair
801private static Type s_typeOfKeyValuePairAdapter;
802internal static Type TypeOfKeyValuePairAdapter
814private static Type s_typeOfKeyValue;
815internal static Type TypeOfKeyValue
827private static Type s_typeOfIDictionaryEnumerator;
828internal static Type TypeOfIDictionaryEnumerator
840private static Type s_typeOfDictionaryEnumerator;
841internal static Type TypeOfDictionaryEnumerator
853private static Type s_typeOfGenericDictionaryEnumerator;
854internal static Type TypeOfGenericDictionaryEnumerator
866private static Type s_typeOfDictionaryGeneric;
867internal static Type TypeOfDictionaryGeneric
879private static Type s_typeOfHashtable;
880internal static Type TypeOfHashtable
892private static Type s_typeOfListGeneric;
893internal static Type TypeOfListGeneric
905private static Type s_typeOfXmlElement;
906internal static Type TypeOfXmlElement
918private static Type s_typeOfXmlSerializableServices;
919internal static Type TypeOfXmlSerializableServices
931private static Type s_typeOfXmlNodeArray;
932internal static Type TypeOfXmlNodeArray
944private static Type s_typeOfXmlSchemaSet;
945internal static Type TypeOfXmlSchemaSet
959private static Type s_typeOfDBNull;
960internal static Type TypeOfDBNull
967s_typeOfDBNull = Type.GetType("System.DBNull, System.Data.Common, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", false);
1007private static bool TypeSequenceEqual(Type[] seq1, Type[] seq2)
1019private static MethodBase FilterMethodBases(MethodBase[] methodBases, Type[] parameterTypes, string methodName)
1029internal static ConstructorInfo GetConstructor(this Type type, BindingFlags bindingFlags, Type[] parameterTypes)
1036internal static MethodInfo GetMethod(this Type type, string methodName, BindingFlags bindingFlags, Type[] parameterTypes)
1045private static Type s_typeOfScriptObject;
1055internal static bool TypeOfScriptObject_IsAssignableFrom(Type type)
1060internal static void SetScriptObjectJsonSerializer(Type typeOfScriptObject, Func<object, string> serializeFunc, Func<string, object> deserializeFunc)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\PrimitiveDataContract.cs (7)
35protected PrimitiveDataContract(Type type, XmlDictionaryString name, XmlDictionaryString ns) : base(new PrimitiveDataContractCriticalHelper(type, name, ns))
40static internal PrimitiveDataContract GetPrimitiveDataContract(Type type)
100_helper.XmlFormatWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
102_helper.XmlFormatWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
120_helper.XmlFormatContentWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType });
122_helper.XmlFormatContentWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType });
180internal PrimitiveDataContractCriticalHelper(Type type, XmlDictionaryString name, XmlDictionaryString ns) : base(type)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\SchemaExporter.cs (4)
17internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
32private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
58MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
113internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatGeneratorStatics.cs (23)
33s_writeStartElementMethod2 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
49s_writeStartElementMethod3 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
65s_writeEndElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteEndElement", Globals.ScanAllMembers, Array.Empty<Type>());
81s_writeNamespaceDeclMethod = typeof(XmlWriterDelegator).GetMethod("WriteNamespaceDecl", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString) });
97s_dictionaryEnumeratorCtor = Globals.TypeOfDictionaryEnumerator.GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfIDictionaryEnumerator });
159s_isStartElementMethod2 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
175s_isStartElementMethod0 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, Array.Empty<Type>());
191s_getUninitializedObjectMethod = typeof(XmlFormatReaderGenerator).GetMethod("UnsafeGetUninitializedObject", Globals.ScanAllMembers, new Type[] { typeof(int) });
222s_hashtableCtor = Globals.TypeOfHashtable.GetConstructor(Globals.ScanAllMembers, Array.Empty<Type>());
268s_storeCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("StoreCollectionMemberInfo", Globals.ScanAllMembers, new Type[] { typeof(object) });
348s_internalDeserializeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("InternalDeserialize", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(int), typeof(RuntimeTypeHandle), typeof(string), typeof(string) });
444s_readIfNullOrRefMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReadIfNullOrRef", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(Type), typeof(bool) });
637s_createSerializationExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("CreateSerializationException", Globals.ScanAllMembers, new Type[] { typeof(string) });
653s_createUnexpectedStateExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("CreateUnexpectedStateException", Globals.ScanAllMembers, new Type[] { typeof(XmlNodeType), typeof(XmlReaderDelegator) });
701s_writeNullMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("WriteNull", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(Type), typeof(bool) });
733s_incrementCollectionCountMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("IncrementCollectionCount", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(ICollection) });
831s_isMemberTypeSameAsMemberValue = typeof(XmlObjectSerializerWriteContext).GetMethod("IsMemberTypeSameAsMemberValue", Globals.ScanAllMembers, new Type[] { typeof(object), typeof(Type) });
1006s_getTypeHandleMethod = typeof(Type).GetMethod("get_TypeHandle");
1036s_throwInvalidDataContractExceptionMethod = typeof(DataContract).GetMethod("ThrowInvalidDataContractException", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(Type) });
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatReaderGenerator.cs (22)
82private Type _objectType;
203Type type = _objectType = classContract.UnderlyingType;
308Type memberType = dataMember.MemberType;
379private LocalBuilder ReadValue(Type type, string name, string ns)
469private void InternalDeserialize(LocalBuilder value, Type type, string name, string ns)
473Type declaredType = type;
486Type innerType = innerValue.LocalType, outerType = outerValue.LocalType;
491Type type = Globals.TypeOfNullable.MakeGenericType(innerType);
492_ilg.New(type.GetConstructor(new Type[] { innerType }));
495_ilg.Call(outerType.GetConstructor(new Type[] { innerType }));
500Type type = collectionContract.UnderlyingType;
501Type itemType = collectionContract.ItemType;
512constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, Array.Empty<Type>());
639Type type = collectionContract.UnderlyingType;
640Type itemType = collectionContract.ItemType;
699private bool TryReadPrimitiveArray(Type type, Type itemType, LocalBuilder size)
746private LocalBuilder ReadCollectionItem(CollectionDataContract collectionContract, Type itemType, string itemName, string itemNs)
853static internal object UnsafeGetUninitializedObject(Type type)
870var type = DataContract.GetDataContractForInitialization(id).TypeForInitialization;
874static internal object TryGetUninitializedObjectWithFormatterServices(Type type)
877var formatterServiceType = typeof(string).GetTypeInfo().Assembly.GetType("System.Runtime.Serialization.FormatterServices");
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlFormatWriterGenerator.cs (24)
128private void InitArgs(Type objType)
242Type memberType = member.MemberType;
316Type itemType = collectionContract.ItemType;
360Type enumeratorType = null;
361Type[] keyValueTypes = null;
371keyValueTypes = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject };
378MethodInfo moveNextMethod = enumeratorType.GetMethod(Globals.MoveNextMethodName, BindingFlags.Instance | BindingFlags.Public, Array.Empty<Type>());
379MethodInfo getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Array.Empty<Type>());
391Type ienumeratorInterface = Globals.TypeOfIEnumerator;
395Type[] interfaceTypes = enumeratorType.GetInterfaces();
396foreach (Type interfaceType in interfaceTypes)
413Type elementType = getCurrentMethod.ReturnType;
425Type ctorParam = Globals.TypeOfIEnumeratorGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(keyValueTypes));
426ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { ctorParam });
460private bool TryWritePrimitive(Type type, LocalBuilder value, MemberInfo memberInfo, LocalBuilder arrayItemIndex, LocalBuilder ns, LocalBuilder name, int nameIndex)
506private bool TryWritePrimitiveArray(Type type, Type itemType, LocalBuilder value, LocalBuilder itemName, LocalBuilder itemNamespace)
545_ilg.Call(typeof(XmlWriterDelegator).GetMethod(writeArrayMethod, Globals.ScanAllMembers, new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) }));
553Type memberType = memberValue.LocalType;
617private void InternalSerialize(MethodInfo methodInfo, LocalBuilder memberValue, Type memberType, bool writeXsiType)
636Type memberType = memberValue.LocalType;
642Type innerType = memberType.GetGenericArguments()[0];
662private bool NeedsPrefix(Type type, XmlDictionaryString ns)
667private void WriteStartElement(Type type, XmlDictionaryString ns, LocalBuilder namespaceLocal, LocalBuilder nameLocal, int nameIndex)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerContext.cs (17)
26protected IList<Type> serializerKnownTypeList;
125internal DataContract GetDataContract(Type type)
130internal virtual DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type type)
142internal virtual DataContract GetDataContractSkipValidation(int typeId, RuntimeTypeHandle typeHandle, Type type)
167internal virtual void CheckIfTypeSerializable(Type memberType, bool isMemberTypeSerializable)
173internal virtual Type GetSurrogatedType(Type type)
200internal static DataContractDictionary GetDataContractsForKnownTypes(IList<Type> knownTypeList)
204Dictionary<Type, Type> typesChecked = new Dictionary<Type, Type>();
207Type knownType = knownTypeList[i];
216internal bool IsKnownType(DataContract dataContract, DataContractDictionary knownDataContracts, Type declaredType)
234internal bool IsKnownType(DataContract dataContract, Type declaredType)
240internal Type ResolveNameFromKnownTypes(XmlQualifiedName typeName)
276Type dataContractType = _dataContractResolver.ResolveName(typeName, typeNs, null, KnownTypeResolver);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (7)
69internal static void ThrowNullValueReturnedForGetOnlyCollectionException(Type type)
78internal static void ThrowArrayExceededSizeException(int arraySize, Type type)
113internal virtual object InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, string name, string ns)
119internal virtual object InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, string name, string ns)
126protected bool TryHandleNullOrRef(XmlReaderDelegator reader, Type declaredType, string name, string ns, ref object retObj)
333internal string ReadIfNullOrRef(XmlReaderDelegator xmlReader, Type memberType, bool isMemberTypeSerializable)
432internal object GetExistingObject(string id, Type type, string name, string ns)
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerReadContextComplex.cs (14)
44return InternalDeserializeWithSurrogate(xmlReader, Type.GetTypeFromHandle(declaredTypeHandle), null /*surrogateDataContract*/, name, ns);
48return InternalDeserializeInSharedTypeMode(xmlReader, declaredTypeID, Type.GetTypeFromHandle(declaredTypeHandle), name, ns);
52internal override object InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, string name, string ns)
67internal override object InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract dataContract, string name, string ns)
82private object InternalDeserializeInSharedTypeMode(XmlReaderDelegator xmlReader, int declaredTypeID, Type declaredType, string name, string ns)
94Type type;
120private object InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract surrogateDataContract, string name, string ns)
137private Type ResolveDataContractTypeInSharedTypeMode(string assemblyName, string typeName, out Assembly assembly)
142private DataContract ResolveDataContractInSharedTypeMode(string assemblyName, string typeName, out Assembly assembly, out Type type)
164Type type;
171internal override void CheckIfTypeSerializable(Type memberType, bool isMemberTypeSerializable)
186internal override Type GetSurrogatedType(Type type)
195Type surrogateType = DataContractSerializer.GetSurrogatedType(_serializationSurrogateProvider, type);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (17)
117Type declaredType = Globals.TypeOfObject;
137SerializeWithXsiType(xmlWriter, obj, objTypeHandle, null /*type*/, declaredTypeID, declaredTypeHandle, Type.GetTypeFromHandle(declaredTypeHandle));
158internal virtual void SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
161Type declaredType = rootTypeDataContract.UnderlyingType;
177protected virtual void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
204objectType = Type.GetTypeFromHandle(objectTypeHandle);
256protected void SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, bool verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
296internal virtual bool WriteClrTypeInfo(XmlWriterDelegator xmlWriter, Type dataContractType, string clrTypeName, string clrAssemblyName)
441internal void WriteNull(XmlWriterDelegator xmlWriter, Type memberType, bool isMemberTypeSerializable)
448internal void WriteNull(XmlWriterDelegator xmlWriter, Type memberType, bool isMemberTypeSerializable, XmlDictionaryString name, XmlDictionaryString ns)
495internal static bool IsMemberTypeSameAsMemberValue(object obj, Type memberType)
526internal static void ThrowRequiredMemberMustBeEmitted(string memberName, Type type)
589private void WriteResolvedTypeInfo(XmlWriterDelegator writer, Type objectType, Type declaredType)
598private bool ResolveType(Type objectType, Type declaredType, out XmlDictionaryString typeName, out XmlDictionaryString typeNamespace)
FrameworkFork\System.ServiceModel\Extensions\ReflectionExtensions.cs (34)
14public static Assembly Assembly(this Type type)
18public static Type BaseType(this Type type)
22public static bool ContainsGenericParameters(this Type type)
26public static ConstructorInfo GetConstructor(this Type type, BindingFlags bindingAttr, object binder, Type[] types, object[] modifiers)
30public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingAttr)
34public static Type[] GetGenericArguments(this Type type)
38public static Type[] GetInterfaces(this Type type)
42public static bool IsAbstract(this Type type)
46public static bool IsAssignableFrom(this Type type, Type otherType)
50public static bool IsClass(this Type type)
54public static bool IsDefined(this Type type, Type attributeType, bool inherit)
58public static bool IsEnum(this Type type)
62public static bool IsGenericType(this Type type)
66public static bool IsInterface(this Type type)
70public static bool IsInstanceOfType(this Type type, object o)
74public static bool IsMarshalByRef(this Type type)
78public static bool IsNotPublic(this Type type)
82public static bool IsSealed(this Type type)
86public static bool IsValueType(this Type type)
90public static InterfaceMapping GetInterfaceMap(this Type type, Type interfaceType)
94public static MemberInfo[] GetMember(this Type type, string name, BindingFlags bindingAttr)
98public static MemberInfo[] GetMembers(this Type type, BindingFlags bindingAttr)
102public static MethodInfo GetMethod(this Type type, string name)
107public static MethodInfo GetMethod(this Type type, string name, Type[] types)
114public static TypeCode GetTypeCode(this Type type)
191public static Type ReflectedType(this MethodInfo mi)
FrameworkFork\System.ServiceModel\System\IdentityModel\Tokens\LocalIdKeyIdentifierClause.cs (12)
13private readonly Type[] _ownerTypes;
16: this(localId, (Type[])null)
20public LocalIdKeyIdentifierClause(string localId, Type ownerType)
21: this(localId, ownerType == null ? (Type[])null : new Type[] { ownerType })
25public LocalIdKeyIdentifierClause(string localId, byte[] derivationNonce, int derivationLength, Type ownerType)
26: this(null, derivationNonce, derivationLength, ownerType == null ? (Type[])null : new Type[] { ownerType })
30internal LocalIdKeyIdentifierClause(string localId, Type[] ownerTypes)
35internal LocalIdKeyIdentifierClause(string localId, byte[] derivationNonce, int derivationLength, Type[] ownerTypes)
55public Type OwnerType
66public bool Matches(string localId, Type ownerType)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ClientClassGenerator.cs (28)
34private static Type s_clientBaseType = typeof(ClientBase<>);
35private static Type s_duplexClientBaseType = typeof(DuplexClientBase<>);
36private static Type s_instanceContextType = typeof(InstanceContext);
37private static Type s_objectType = typeof(object);
38private static Type s_objectArrayType = typeof(object[]);
39private static Type s_exceptionType = typeof(Exception);
40private static Type s_boolType = typeof(bool);
41private static Type s_stringType = typeof(string);
42private static Type s_endpointAddressType = typeof(EndpointAddress);
43private static Type s_uriType = typeof(Uri);
44private static Type s_bindingType = typeof(Binding);
45private static Type s_sendOrPostCallbackType = typeof(SendOrPostCallback);
46private static Type s_asyncCompletedEventArgsType = typeof(AsyncCompletedEventArgs);
47private static Type s_eventHandlerType = typeof(EventHandler<>);
48private static Type s_voidType = typeof(void);
49private static Type s_asyncResultType = typeof(IAsyncResult);
50private static Type s_asyncCallbackType = typeof(AsyncCallback);
66private static Type[][] s_clientCtorParamTypes = new Type[][]
68new Type[] { },
69new Type[] { s_stringType, },
70new Type[] { s_stringType, s_stringType, },
71new Type[] { s_stringType, s_endpointAddressType, },
72new Type[] { s_bindingType, s_endpointAddressType, },
84private static Type[] s_eventArgsCtorParamTypes = new Type[]
121Type[] duplexCtorTypes1 = DebugCheckTable_InsertAtStart(s_clientCtorParamTypes[i], s_objectType);
122Type[] duplexCtorTypes2 = DebugCheckTable_InsertAtStart(s_clientCtorParamTypes[i], s_instanceContextType);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\MessageContractImporter.cs (8)
50static internal void ImportMessageBinding(WsdlImporter importer, WsdlEndpointConversionContext endpointContext, Type schemaImporterType)
1226private static bool CheckAndAddPart(XmlQualifiedName typeNameFound, XmlQualifiedName typeNameRequired, string name, string ns, Type type, MessageDescription description, bool isReply)
1627Type type = typeof(DataContractSerializerSchemaImporter);
1680internal static bool TryGetFailedReferenceType(Exception ex, out Type failedReferenceType)
1687failedReferenceType = ex.Data[FailedReferenceTypeExceptionKey] as Type;
1702Type failedReferenceType;
1946_xmlImporter.Extensions.Add(extTypeName, Type.GetType(extTypeName, true /*throwOnError*/));
1984Type type = typeof(XmlSerializerSchemaImporter);
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\TypeLoader.cs (86)
22private static Type[] s_messageContractMemberAttributes = {
27private static Type[] s_formatterAttributes = {
32private static Type[] s_knownTypesMethodParamType = new Type[] { typeof(CustomAttributeProvider) };
37private static readonly Type s_OperationContractAttributeType = typeof(OperationContractAttribute);
45private readonly Dictionary<Type, ContractDescription> _contracts;
46private readonly Dictionary<Type, MessageDescriptionItems> _messages;
51_contracts = new Dictionary<Type, ContractDescription>();
52_messages = new Dictionary<Type, MessageDescriptionItems>();
56private ContractDescription LoadContractDescriptionHelper(Type contractType, Type serviceType, object serviceImplementation)
70Type actualContractType = ServiceReflector.GetContractTypeAndAttribute(contractType, out actualContractAttribute);
102private void EnsureNoInheritanceWithContractClasses(Type actualContractType)
107for (Type service = actualContractType.BaseType(); service != null; service = service.BaseType())
118private void EnsureNoOperationContractsOnNonServiceContractTypes(Type actualContractType)
120foreach (Type t in actualContractType.GetInterfaces())
124for (Type u = actualContractType.BaseType(); u != null; u = u.BaseType())
130private void EnsureNoOperationContractsOnNonServiceContractTypes_Helper(Type aParentType)
138Type operationContractProviderType = ServiceReflector.GetOperationContractProviderType(methodInfo);
156public ContractDescription LoadContractDescription(Type contractType)
163public ContractDescription LoadContractDescription(Type contractType, Type serviceType)
171public ContractDescription LoadContractDescription(Type contractType, Type serviceType, object serviceImplementation)
182Type channelType = typeof(IOutputChannel);
197Type channelType = typeof(IRequestChannel);
212private void AddBehaviors(ContractDescription contractDesc, Type implType, bool implIsCallback, ContractReflectionInfo reflectionInfo)
230Type targetIface = implIsCallback ? opDesc.DeclaringContract.CallbackContractType : opDesc.DeclaringContract.ContractType;
246delegate (Type currentType, KeyedByTypeCollection<IOperationBehavior> behaviors)
260delegate (Type currentType, KeyedByTypeCollection<IOperationBehavior> behaviors)
273Type targetInterface = implIsCallback ? reflectionInfo.callbackiface : reflectionInfo.iface;
305private void GetIContractBehaviorsFromInterfaceType(Type interfaceType, KeyedByTypeCollection<IContractBehavior> behaviors)
315private static void UpdateContractDescriptionWithAttributesFromServiceType(ContractDescription description, Type serviceType)
319delegate (Type currentType, KeyedByTypeCollection<IContractBehavior> behaviors)
331IEnumerable<Type> knownTypes = GetKnownTypes(customAttributes, reflectionInfo.iface);
332foreach (Type knownType in knownTypes)
345foreach (Type knownType in knownTypes)
356private IEnumerable<Type> GetKnownTypes(object[] knownTypeAttributes, CustomAttributeProvider provider)
363Type type = knownTypeAttribute.DeclaringType;
374if (!typeof(IEnumerable<Type>).IsAssignableFrom(method.ReturnType))
377return (IEnumerable<Type>)method.Invoke(null, new object[] { provider });
381List<Type> knownTypes = new List<Type>();
392private KeyedByTypeCollection<IOperationBehavior> GetIOperationBehaviorAttributesFromType(OperationDescription opDesc, Type targetIface, Type implType)
427Type ifaceType, Type implType, bool useImplAttrs)
502private static MethodInfo GetCorrespondingMethodFromType(Type type, MethodInfo methodInfo)
581internal void AddBehaviorsSFx(ServiceEndpoint serviceEndpoint, Type contractType)
593internal void AddBehaviorsFromImplementationType(ServiceEndpoint serviceEndpoint, Type implementationType)
610Type targetIface = serviceEndpoint.Contract.CallbackContractType;
618delegate (Type currentType, KeyedByTypeCollection<IOperationBehavior> behaviors)
631Type t = behavior.GetType();
673Type contractToGetMethodsFrom,
701internal static void EnsureCallbackType(Type callbackType)
710internal static void EnsureSubcontract(ServiceContractAttribute svcContractAttr, Type contractType)
712Type callbackType = svcContractAttr.CallbackContract;
714List<Type> types = ServiceReflector.GetInheritedContractTypes(contractType);
717Type inheritedContractType = types[i];
738private ContractDescription CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, out ContractReflectionInfo reflectionInfo, object serviceImplementation)
750Type callbackType = contractAttr.CallbackContract;
765List<Type> types = ServiceReflector.GetInheritedContractTypes(contractType);
766List<Type> inheritedCallbackTypes = new List<Type>();
769Type inheritedContractType = types[i];
863Type taskTResult;
988IEnumerable<Type> knownTypes = GetKnownTypes(methodAttributes, methodInfo);
989foreach (Type knownType in knownTypes)
1118Type taskTResult,
1157Type responseType = isTask ? taskTResult : methodInfo.ReturnType;
1202Type returnType,
1252private static MessagePartDescription CreateParameterPartDescription(XmlName defaultName, string defaultNS, int index, CustomAttributeProvider attrProvider, Type type)
1266internal MessageDescription CreateTypedMessageDescription(Type typedMessageType,
1293for (Type baseType = typedMessageType; baseType != null && baseType != typeof(object) && baseType != typeof(ValueType); baseType = baseType.BaseType())
1358Type memberType;
1413private MessagePartDescription CreateMessagePartDescription(Type bodyType,
1449private MessageHeaderDescription CreateMessageHeaderDescription(Type headerParameterType,
1520internal static Type GetParameterType(ParameterInfo parameterInfo)
1522Type parameterType = parameterInfo.ParameterType;
1958internal Type iface;
1959internal Type callbackiface;
1975Type serviceType,
1983for (Type currentType = serviceType; currentType != null; currentType = currentType.BaseType())
1989public delegate void ServiceInheritanceCallback<IBehavior, TBehaviorCollection>(Type currentType, KeyedByTypeCollection<IBehavior> behaviors);
2001Type type,
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\DataContractSerializerOperationFormatter.cs (27)
20internal static DataContractSerializer CreateSerializer(Type type, int maxItems)
25internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, int maxItems)
32internal static DataContractSerializer CreateSerializer(Type type, string rootName, string rootNs, int maxItems)
37internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, string rootName, string rootNs, int maxItems)
46internal static DataContractSerializer CreateSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNs, int maxItems)
51internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, XmlDictionaryString rootName, XmlDictionaryString rootNs, int maxItems)
63private static Type s_typeOfIQueryable = typeof(IQueryable);
64private static Type s_typeOfIQueryableGeneric = typeof(IQueryable<>);
65private static Type s_typeOfIEnumerable = typeof(IEnumerable);
66private static Type s_typeOfIEnumerableGeneric = typeof(IEnumerable<>);
70private IList<Type> _knownTypes;
81foreach (Type type in description.KnownTypes)
84_knownTypes = new List<Type>();
132private void ValidateDataContractType(Type type)
250KeyValuePair<Type, ArrayList>[] multipleHeaderValues = null;
282multipleHeaderValues = new KeyValuePair<Type, ArrayList>[parameters.Length];
285multipleHeaderValues[headerDescription.Index] = new KeyValuePair<System.Type, System.Collections.ArrayList>(headerDescription.TypedHeader ? TypedHeaderManager.GetMessageHeaderType(headerDescription.Type) : headerDescription.Type, new ArrayList());
327Type dataContractType = DataContractSerializerOperationFormatter.GetSubstituteDataContractType(headerDescription.Type, out isQueryable);
451internal static Type GetSubstituteDataContractType(Type type, out bool isQueryable)
509private IList<Type> _knownTypes;
511private Type _contractType;
515IList<Type> knownTypes, DataContractSerializerOperationBehavior behavior)
527public Type ContractType
FrameworkFork\System.ServiceModel\System\ServiceModel\MessageHeaderT.cs (13)
61internal Type GetGenericArgument()
81private static Dictionary<Type, TypedHeaderManager> s_cache = new Dictionary<Type, TypedHeaderManager>();
83private static Type s_GenericAdapterType = typeof(GenericAdapter<>);
85internal static object Create(Type t, object content, bool mustUnderstand, bool relay, string actor)
90internal static object GetContent(Type t, object typedHeaderInstance, out bool mustUnderstand, out bool relay, out string actor)
95internal static Type GetMessageHeaderType(Type contentType)
99internal static Type GetHeaderType(Type headerParameterType)
107private static TypedHeaderManager GetTypedHeaderManager(Type t)
149protected abstract Type GetMessageHeaderType();
180protected override Type GetMessageHeaderType()
FrameworkFork\System.ServiceModel\System\ServiceModel\Security\WSSecurityTokenSerializer.cs (13)
60public WSSecurityTokenSerializer(SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes)
65public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes)
70public WSSecurityTokenSerializer(SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes,
76public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes,
359internal Type[] GetTokenTypes(string tokenTypeUri)
376protected internal virtual string GetTokenTypeUri(Type tokenType)
445private Type[] _tokenTypes = null;
455public Type TokenType { get { return GetTokenTypes()[0]; } }
459protected abstract Type[] GetTokenTypesCore();
461public Type[] GetTokenTypes()
468public bool SupportsCore(Type tokenType)
470Type[] tokenTypes = GetTokenTypes();
484protected static SecurityKeyIdentifierClause CreateDirectReference(XmlElement issuedTokenXml, string idAttributeLocalName, string idAttributeNamespace, Type tokenType)
FrameworkFork\System.Web.Services\Services\Description\XmlFormatExtensionAttribute.cs (18)
16private Type[] _types;
29public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1) : this(elementName, ns, new Type[] { extensionPoint1 })
33public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2 })
37public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3 })
41public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3, Type extensionPoint4) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3, extensionPoint4 })
49public XmlFormatExtensionAttribute(string elementName, string ns, Type[] extensionPoints)
60public Type[] ExtensionPoints
62get { return _types == null ? new Type[0] : _types; }
FormatterWebSite (4)
GetDocument.Insider (15)
HealthChecksSample (3)
IIS.Microbenchmarks (7)
illink (124)
src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (103)
14 /// <see cref="System.Reflection.IntrospectionExtensions.GetTypeInfo(System.Type)"/>
18 /// <see cref="System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"/>
22 /// <see cref="System.Type.TypeHandle"/>
57 /// <see cref="System.Array.CreateInstance(System.Type, int)"/>
61 /// <see cref="System.Type.MakeGenericType(System.Type[])"/>
66 /// <item><see cref="System.Type.GetType(string)"/></item>
67 /// <item><see cref= "System.Type.GetType(string, bool)" /></item>
68 /// <item><see cref="System.Type.GetType(string, bool, bool)"/></item>
69 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?)"/></item>
70 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool)"/></item>
71 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool, bool)"/></item>
76 /// <item><see cref="System.Type.GetConstructor(System.Type[])"/></item>
77 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Type[])"/></item>
78 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
79 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder?, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
84 /// <see cref="System.Type.GetConstructors(System.Reflection.BindingFlags)"/>
88 /// <item><see cref="System.Type.GetMethod(string)"/></item>
89 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags)"/></item>
90 /// <item><see cref="System.Type.GetMethod(string, System.Type[])"/></item>
91 /// <item><see cref="System.Type.GetMethod(string, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
92 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Type[])"/></item>
93 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
94 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
95 /// <item><see cref="System.Type.GetMethod(string, int, System.Type[])"/></item>
96 /// <item><see cref="System.Type.GetMethod(string, int, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
97 /// <item><see cref="System.Type.GetMethod(string, int, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
98 /// <item><see cref="System.Type.GetMethod(string, int, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
103 /// <see cref="System.Type.GetMethod(System.Reflection.BindingFlags)"/>
108 /// <item><see cref="System.Type.GetField(string)"/></item>
109 /// <item><see cref="System.Type.GetField(string, System.Reflection.BindingFlags)"/></item>
114 /// <see cref="System.Type.GetFields(System.Reflection.BindingFlags)"/>
119 /// <item><see cref="System.Type.GetProperty(string)"/></item>
120 /// <item><see cref="System.Type.GetProperty(string, System.Reflection.BindingFlags)"/></item>
121 /// <item><see cref="System.Type.GetProperty(string, System.Type?)"/></item>
122 /// <item><see cref="System.Type.GetProperty(string, System.Type[])"/></item>
123 /// <item><see cref="System.Type.GetProperty(string, System.Type?, System.Type[])"/></item>
124 /// <item><see cref="System.Type.GetProperty(string, System.Type?, System.Type[], System.Reflection.ParameterModifier[])"/></item>
125 /// <item><see cref="System.Type.GetProperty(string, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
130 /// <see cref="System.Type.GetProperties(System.Reflection.BindingFlags)"/>
135 /// <item><see cref="System.Type.GetEvent(string)"/></item>
136 /// <item><see cref="System.Type.GetEvent(string, System.Reflection.BindingFlags)"/></item>
141 /// <see cref="System.Type.GetEvents(System.Reflection.BindingFlags)"/>
146 /// <item><see cref="System.Type.GetNestedType(string)"/></item>
147 /// <item><see cref="System.Type.GetNestedType(string, System.Reflection.BindingFlags)"/></item>
152 /// <see cref="System.Type.GetNestedTypes(System.Reflection.BindingFlags)"/>
157 /// <item><see cref="System.Type.GetMember(string)"/></item>
158 /// <item><see cref="System.Type.GetMember(string, System.Reflection.BindingFlags)"/></item>
159 /// <item><see cref="System.Type.GetMember(string, System.Reflection.MemberTypes, System.Reflection.BindingFlags)"/></item>
164 /// <see cref="System.Type.GetMembers(System.Reflection.BindingFlags)"/>
169 /// <item><see cref="System.Type.GetInterface(string)"/></item>
170 /// <item><see cref="System.Type.GetInterface(string, bool)"/></item>
175 /// <see cref="System.Type.AssemblyQualifiedName"/>
179 /// <see cref="System.Type.UnderlyingSystemType"/>
183 /// <see cref="System.Type.BaseType"/>
187 /// <see cref="System.Linq.Expressions.Expression.Call(System.Type, string, System.Type[]?, System.Linq.Expressions.Expression[]?))"/>
191 /// <see cref="System.Linq.Expressions.Expression.Field(System.Linq.Expressions.Expression?, System.Type, string)"/>
197 /// <item><see cref="System.Linq.Expressions.Expression.Property(System.Linq.Expressions.Expression?, System.Type, string)"/></item>
202 /// <see cref="System.Linq.Expressions.Expression.New(System.Type)"/>
206 /// <see cref="System.Enum.GetValues(System.Type)"/>
210 /// <see cref="System.Runtime.InteropServices.Marshal.SizeOf(System.Type)"/>
214 /// <see cref="System.Runtime.InteropServices.Marshal.OffsetOf(System.Type, string)"/>
218 /// <see cref="System.Runtime.InteropServices.Marshal.PtrToStructure(nint, System.Type)"/>
222 /// <see cref="System.Runtime.InteropServices.Marshal.DestroyStructure(nint, System.Type)"/>
226 /// <see cref="System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(nint, System.Type)"/>
230 /// <item><see cref="System.Activator.CreateInstance(System.Type)"/></item>
231 /// <item><see cref="System.Activator.CreateInstance(System.Type, bool)"/></item>
232 /// <item><see cref="System.Activator.CreateInstance(System.Type, object[])"/></item>
233 /// <item><see cref="System.Activator.CreateInstance(System.Type, object[], object[])"/></item>
234 /// <item><see cref="System.Activator.CreateInstance(System.Type, System.Reflection.BindingFlags, System.Reflection.Binder, object[], System.Globalization.CultureInfo)"/></item>
235 /// <item><see cref="System.Activator.CreateInstance(System.Type, System.Reflection.BindingFlags, System.Reflection.Binder, object[], System.Globalization.CultureInfo, object[])"/></item>
320 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeEvent(System.Type, string)"/>
324 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeField(System.Type, string)"/>
328 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeMethod(System.Type, string, System.Type[])"/>
332 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperty(System.Type, string)"/>
340 /// <see cref="System.Reflection.MethodInfo.MakeGenericMethod(System.Type[])"/>
344 /// <see cref="System.Nullable.GetUnderlyingType(System.Type)"/>
ILLink.RoslynAnalyzer (103)
src\tools\illink\src\ILLink.Shared\TrimAnalysis\IntrinsicId.cs (103)
14 /// <see cref="System.Reflection.IntrospectionExtensions.GetTypeInfo(System.Type)"/>
18 /// <see cref="System.Type.GetTypeFromHandle(System.RuntimeTypeHandle)"/>
22 /// <see cref="System.Type.TypeHandle"/>
57 /// <see cref="System.Array.CreateInstance(System.Type, int)"/>
61 /// <see cref="System.Type.MakeGenericType(System.Type[])"/>
66 /// <item><see cref="System.Type.GetType(string)"/></item>
67 /// <item><see cref= "System.Type.GetType(string, bool)" /></item>
68 /// <item><see cref="System.Type.GetType(string, bool, bool)"/></item>
69 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?)"/></item>
70 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool)"/></item>
71 /// <item><see cref="System.Type.GetType(string, System.Func{System.Reflection.AssemblyName, System.Reflection.Assembly?}?, System.Func{System.Reflection.Assembly?, string, bool, System.Type?}?, bool, bool)"/></item>
76 /// <item><see cref="System.Type.GetConstructor(System.Type[])"/></item>
77 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Type[])"/></item>
78 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
79 /// <item><see cref="System.Type.GetConstructor(System.Reflection.BindingFlags, System.Reflection.Binder?, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
84 /// <see cref="System.Type.GetConstructors(System.Reflection.BindingFlags)"/>
88 /// <item><see cref="System.Type.GetMethod(string)"/></item>
89 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags)"/></item>
90 /// <item><see cref="System.Type.GetMethod(string, System.Type[])"/></item>
91 /// <item><see cref="System.Type.GetMethod(string, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
92 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Type[])"/></item>
93 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
94 /// <item><see cref="System.Type.GetMethod(string, System.Reflection.BindingFlags, System.Reflection.Binder, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
95 /// <item><see cref="System.Type.GetMethod(string, int, System.Type[])"/></item>
96 /// <item><see cref="System.Type.GetMethod(string, int, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
97 /// <item><see cref="System.Type.GetMethod(string, int, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
98 /// <item><see cref="System.Type.GetMethod(string, int, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Reflection.CallingConventions, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
103 /// <see cref="System.Type.GetMethod(System.Reflection.BindingFlags)"/>
108 /// <item><see cref="System.Type.GetField(string)"/></item>
109 /// <item><see cref="System.Type.GetField(string, System.Reflection.BindingFlags)"/></item>
114 /// <see cref="System.Type.GetFields(System.Reflection.BindingFlags)"/>
119 /// <item><see cref="System.Type.GetProperty(string)"/></item>
120 /// <item><see cref="System.Type.GetProperty(string, System.Reflection.BindingFlags)"/></item>
121 /// <item><see cref="System.Type.GetProperty(string, System.Type?)"/></item>
122 /// <item><see cref="System.Type.GetProperty(string, System.Type[])"/></item>
123 /// <item><see cref="System.Type.GetProperty(string, System.Type?, System.Type[])"/></item>
124 /// <item><see cref="System.Type.GetProperty(string, System.Type?, System.Type[], System.Reflection.ParameterModifier[])"/></item>
125 /// <item><see cref="System.Type.GetProperty(string, System.Reflection.BindingFlags, System.Reflection.Binder?, System.Type?, System.Type[], System.Reflection.ParameterModifier[]?)"/></item>
130 /// <see cref="System.Type.GetProperties(System.Reflection.BindingFlags)"/>
135 /// <item><see cref="System.Type.GetEvent(string)"/></item>
136 /// <item><see cref="System.Type.GetEvent(string, System.Reflection.BindingFlags)"/></item>
141 /// <see cref="System.Type.GetEvents(System.Reflection.BindingFlags)"/>
146 /// <item><see cref="System.Type.GetNestedType(string)"/></item>
147 /// <item><see cref="System.Type.GetNestedType(string, System.Reflection.BindingFlags)"/></item>
152 /// <see cref="System.Type.GetNestedTypes(System.Reflection.BindingFlags)"/>
157 /// <item><see cref="System.Type.GetMember(string)"/></item>
158 /// <item><see cref="System.Type.GetMember(string, System.Reflection.BindingFlags)"/></item>
159 /// <item><see cref="System.Type.GetMember(string, System.Reflection.MemberTypes, System.Reflection.BindingFlags)"/></item>
164 /// <see cref="System.Type.GetMembers(System.Reflection.BindingFlags)"/>
169 /// <item><see cref="System.Type.GetInterface(string)"/></item>
170 /// <item><see cref="System.Type.GetInterface(string, bool)"/></item>
175 /// <see cref="System.Type.AssemblyQualifiedName"/>
179 /// <see cref="System.Type.UnderlyingSystemType"/>
183 /// <see cref="System.Type.BaseType"/>
187 /// <see cref="System.Linq.Expressions.Expression.Call(System.Type, string, System.Type[]?, System.Linq.Expressions.Expression[]?))"/>
191 /// <see cref="System.Linq.Expressions.Expression.Field(System.Linq.Expressions.Expression?, System.Type, string)"/>
197 /// <item><see cref="System.Linq.Expressions.Expression.Property(System.Linq.Expressions.Expression?, System.Type, string)"/></item>
202 /// <see cref="System.Linq.Expressions.Expression.New(System.Type)"/>
206 /// <see cref="System.Enum.GetValues(System.Type)"/>
210 /// <see cref="System.Runtime.InteropServices.Marshal.SizeOf(System.Type)"/>
214 /// <see cref="System.Runtime.InteropServices.Marshal.OffsetOf(System.Type, string)"/>
218 /// <see cref="System.Runtime.InteropServices.Marshal.PtrToStructure(nint, System.Type)"/>
222 /// <see cref="System.Runtime.InteropServices.Marshal.DestroyStructure(nint, System.Type)"/>
226 /// <see cref="System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer(nint, System.Type)"/>
230 /// <item><see cref="System.Activator.CreateInstance(System.Type)"/></item>
231 /// <item><see cref="System.Activator.CreateInstance(System.Type, bool)"/></item>
232 /// <item><see cref="System.Activator.CreateInstance(System.Type, object[])"/></item>
233 /// <item><see cref="System.Activator.CreateInstance(System.Type, object[], object[])"/></item>
234 /// <item><see cref="System.Activator.CreateInstance(System.Type, System.Reflection.BindingFlags, System.Reflection.Binder, object[], System.Globalization.CultureInfo)"/></item>
235 /// <item><see cref="System.Activator.CreateInstance(System.Type, System.Reflection.BindingFlags, System.Reflection.Binder, object[], System.Globalization.CultureInfo, object[])"/></item>
320 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeEvent(System.Type, string)"/>
324 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeField(System.Type, string)"/>
328 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeMethod(System.Type, string, System.Type[])"/>
332 /// <see cref="System.Reflection.RuntimeReflectionExtensions.GetRuntimeProperty(System.Type, string)"/>
340 /// <see cref="System.Reflection.MethodInfo.MakeGenericMethod(System.Type[])"/>
344 /// <see cref="System.Nullable.GetUnderlyingType(System.Type)"/>
Infrastructure.Common (3)
InMemory.FunctionalTests (38)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (23)
42private List<KeyValuePair<Type, object>>? MaybeExtra;
70private object? ExtraFeatureGet(Type key)
87private void ExtraFeatureSet(Type key, object? value)
108MaybeExtra = new List<KeyValuePair<Type, object>>(2);
114MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
118MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
126object? IFeatureCollection.this[Type key]
391private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
395yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
399yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
403yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
407yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
411yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
415yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
419yield return new KeyValuePair<Type, object>(typeof(IConnectionSocketFeature), _currentIConnectionSocketFeature);
423yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
427yield return new KeyValuePair<Type, object>(typeof(IStreamDirectionFeature), _currentIStreamDirectionFeature);
431yield return new KeyValuePair<Type, object>(typeof(IStreamIdFeature), _currentIStreamIdFeature);
435yield return new KeyValuePair<Type, object>(typeof(IStreamAbortFeature), _currentIStreamAbortFeature);
439yield return new KeyValuePair<Type, object>(typeof(IStreamClosedFeature), _currentIStreamClosedFeature);
443yield return new KeyValuePair<Type, object>(typeof(IConnectionMetricsTagsFeature), _currentIConnectionMetricsTagsFeature);
455IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
InProcessWebSite (1)
KeyManagementSimulator (3)
Microsoft.Analyzers.Extra (1)
Microsoft.Analyzers.Extra.Tests (3)
Microsoft.Arcade.Common (1)
Microsoft.Arcade.Test.Common (2)
Microsoft.AspNetCore (1)
Microsoft.AspNetCore.Analyzer.Testing (2)
Microsoft.AspNetCore.App.Analyzers.Test (3)
Microsoft.AspNetCore.Authentication (1)
Microsoft.AspNetCore.Authentication.Abstractions (3)
Microsoft.AspNetCore.Authentication.OpenIdConnect (1)
Microsoft.AspNetCore.Authentication.Test (24)
Microsoft.AspNetCore.Components (124)
RenderTree\Renderer.Log.cs (5)
14private static partial void InitializingChildComponent(ILogger logger, int componentId, Type componentType, int parentComponentId, Type parentComponentType);
17private static partial void InitializingRootComponent(ILogger logger, int componentId, Type componentType);
35private static partial void RenderingComponent(ILogger logger, int componentId, Type componentType);
46private static partial void DisposingComponent(ILogger logger, int componentId, Type componentType);
Microsoft.AspNetCore.Components.Analyzers.Tests (1)
Microsoft.AspNetCore.Components.Authorization (3)
Microsoft.AspNetCore.Components.Authorization.Tests (7)
Microsoft.AspNetCore.Components.Endpoints (224)
FormMapping\Factories\ComplexType\ComplexTypeExpressionConverterFactoryOfT.cs (20)
16internal override CompiledComplexTypeConverter<T> CreateConverter(Type type, FormDataMapperOptions options)
24private CompiledComplexTypeConverter<T>.ConverterDelegate CreateConverterBody(Type type, FormDataMapperOptions options)
159Array.Empty<Type>(),
185Array.Empty<Type>(),
287Array.Empty<Type>(),
297Array.Empty<Type>(),
304Array.Empty<Type>(),
314Array.Empty<Type>(),
343var propertyConverterType = typeof(FormDataConverter<>).MakeGenericType(property.Type);
379Array.Empty<Type>(),
388Type.EmptyTypes,
398Array.Empty<Type>(),
406Array.Empty<Type>(),
443var constructorParameterConverterType = typeof(FormDataConverter<>).MakeGenericType(constructorParameter.Type);
483Array.Empty<Type>(),
491Type.EmptyTypes,
501Array.Empty<Type>(),
509Array.Empty<Type>(),
552Expression.Not(Expression.Call(readerParam, nameof(FormDataReader.CurrentPrefixExists), Array.Empty<Type>())),
575Expression.Parameter(typeof(Type), "type"),
FormMapping\Metadata\FormDataMetadataFactory.cs (31)
26public FormDataTypeMetadata? GetOrCreateMetadataFor(Type type, FormDataMapperOptions options)
267internal bool HasMetadataFor(Type type) => _context.TypeMetadata.ContainsKey(type);
269private void DetectCyclesAndMarkMetadataTypesAsRecursive(Type type, FormDataTypeMetadata result)
303void ReportRecursiveChain(Type type)
315public Dictionary<Type, FormDataTypeMetadata> TypeMetadata { get; set; } = new();
317public List<Type> CurrentTypes { get; set; } = new();
340internal void Track(Type type)
345internal void Untrack(Type type)
354public static partial void StartResolveMetadataGraph(ILogger logger, Type type);
357public static partial void EndResolveMetadataGraph(ILogger logger, Type type);
360public static partial void MetadataFound(ILogger<FormDataMetadataFactory> logger, Type type);
363public static partial void NoMetadataFound(ILogger<FormDataMetadataFactory> logger, Type type);
366public static partial void RecursiveTypeFound(ILogger<FormDataMetadataFactory> logger, Type type, string chain);
369public static partial void PrimitiveType(ILogger<FormDataMetadataFactory> logger, Type type);
372public static partial void DictionaryType(ILogger<FormDataMetadataFactory> logger, Type type);
375public static partial void CollectionType(ILogger<FormDataMetadataFactory> logger, Type type);
378public static partial void ObjectType(ILogger<FormDataMetadataFactory> logger, Type type);
381public static partial void ConstructorFound(ILogger<FormDataMetadataFactory> logger, Type type, string parameters);
384public static partial void ConstructorParameter(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type parameterType);
387public static partial void CandidateProperty(ILogger<FormDataMetadataFactory> logger, string name, Type propertyType);
405public static partial void MetadataComputed(ILogger<FormDataMetadataFactory> logger, Type type);
408public static partial void GenericTypeDefinitionNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
411public static partial void MultiplePublicConstructorsFound(ILogger<FormDataMetadataFactory> logger, Type type);
414public static partial void InterfacesNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
417public static partial void AbstractClassesNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
420public static partial void NoPublicConstructorFound(ILogger<FormDataMetadataFactory> logger, Type type);
423public static partial void ConstructorParameterTypeNotSupported(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type parameterType);
426public static partial void PropertyTypeNotSupported(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type propertyType);
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
Microsoft.AspNetCore.Components.Endpoints.Tests (41)
Binding\FormDataMapperTests.cs (15)
23public void CanDeserialize_PrimitiveTypes(string value, Type type, object expected)
93public void PrimitiveTypes_MissingValues_DoNotAddErrors(string _, Type type, object __)
159public void CanDeserialize_NullablePrimitiveTypes(string value, Type type, object expected)
176public void CanDeserialize_NullValues(Type type)
520elementConverter.OnTryReadDelegate = (ref FormDataReader context, Type type, FormDataMapperOptions options, out int result, out bool found) =>
2096public static TheoryData<string, Type, object> NullableBasicTypes
2100var result = new TheoryData<string, Type, object>
2138public static TheoryData<Type> NullNullableBasicTypes
2142var result = new TheoryData<Type>
2180public static TheoryData<string, Type, object> PrimitiveTypesData
2184var result = new TheoryData<string, Type, object>
2223private object CallDeserialize(FormDataReader reader, FormDataMapperOptions options, Type type)
2521internal delegate bool OnTryRead(ref FormDataReader context, Type type, FormDataMapperOptions options, out int result, out bool found);
2524(ref FormDataReader context, Type type, FormDataMapperOptions options, out int result, out bool found) =>
2527internal override bool TryRead(ref FormDataReader context, Type type, FormDataMapperOptions options, out int result, out bool found) =>
TypeNameHashTest.cs (4)
42var type = new { Foo = "bar" }.GetType();
58var type = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).GetType();
72var type = typeof(Nullable<>).GetGenericArguments()[0];
76Assert.Equal($"Cannot compute a hash for a type without a {nameof(Type.FullName)}.", ex.Message);
Microsoft.AspNetCore.Components.Forms (9)
Microsoft.AspNetCore.Components.Forms.Tests (8)
Microsoft.AspNetCore.Components.Performance (10)
Microsoft.AspNetCore.Components.QuickGrid (4)
Microsoft.AspNetCore.Components.SdkAnalyzers.Tests (1)
Microsoft.AspNetCore.Components.Server (38)
Microsoft.AspNetCore.Components.Server.Tests (16)
Microsoft.AspNetCore.Components.Tests (47)
Routing\RouteTableFactoryTests.cs (9)
96var routeTable = RouteTableFactory.Create(new List<Type> { typeof(MyComponent), }, _serviceProvider);
113var routeTable = RouteTableFactory.Create(new List<Type> { typeof(MyComponent), typeof(MyInheritedComponent) }, _serviceProvider);
456public void CorrectlyMatchesVariableLengthSegments(string path, string expectedValue, string first, string second, Type handler)
929var handler = typeof(int);
981var handler = typeof(int);
1128readonly IList<(string Template, Type Handler)> _routeTemplates = new List<(string, Type)>();
1129readonly Type _handler = typeof(object);
1131public TestRouteTableBuilder AddRoute(string template, Type handler = null)
Microsoft.AspNetCore.Components.Web (38)
Microsoft.AspNetCore.Components.Web.Tests (11)
Microsoft.AspNetCore.Components.WebAssembly (42)
Microsoft.AspNetCore.Components.WebAssembly.Tests (4)
Microsoft.AspNetCore.Components.WebView (6)
Microsoft.AspNetCore.Components.WebView.Maui (1)
Microsoft.AspNetCore.Components.WebView.WindowsForms (2)
Microsoft.AspNetCore.Components.WebView.Wpf (1)
Microsoft.AspNetCore.ConcurrencyLimiter.Microbenchmarks (7)
Microsoft.AspNetCore.Connections.Abstractions (6)
Microsoft.AspNetCore.DataProtection (37)
Microsoft.AspNetCore.DataProtection.Extensions (11)
Microsoft.AspNetCore.DataProtection.Tests (13)
Microsoft.AspNetCore.Diagnostics (14)
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (9)
Microsoft.AspNetCore.Diagnostics.Middleware (1)
Microsoft.AspNetCore.Diagnostics.Tests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (91)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (11)
Microsoft.AspNetCore.Grpc.Microbenchmarks (7)
Microsoft.AspNetCore.Grpc.Swagger (21)
Microsoft.AspNetCore.Grpc.Swagger.Tests (3)
Microsoft.AspNetCore.HeaderParsing (2)
Microsoft.AspNetCore.Hosting (42)
Internal\StartupLoader.cs (12)
41public static StartupMethods LoadMethods(IServiceProvider hostingServiceProvider, [DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName, object? instance = null)
55var type = configureContainerMethod.MethodInfo != null ? configureContainerMethod.GetContainerType() : typeof(object);
69static Type CreateConfigureServicesDelegateBuilder(Type type)
238public static Type FindStartupType(string startupAssemblyName, string environmentName)
260var type =
294internal static ConfigureBuilder FindConfigureDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName)
300internal static ConfigureContainerBuilder FindConfigureContainerDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName)
306internal static bool HasConfigureServicesIServiceProviderDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName)
311internal static ConfigureServicesBuilder FindConfigureServicesDelegate([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string environmentName)
318private static MethodInfo? FindMethod([DynamicallyAccessedMembers(StartupLinkerOptions.Accessibility)] Type startupType, string methodName, string environmentName, Type? returnType = null, bool required = true)
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.Hosting.Abstractions (2)
Microsoft.AspNetCore.Hosting.Tests (25)
StartupManagerTests.cs (17)
27var type = typeof(VoidReturningStartupServicesFiltersStartup);
49var type = typeof(VoidReturningStartupServicesFiltersStartup);
70var type = typeof(IServiceProviderReturningStartupServicesFiltersStartup);
95var type = typeof(ConfigureContainerStartupServicesFiltersStartup);
117var type = typeof(ConfigureContainerStartupServicesFiltersStartup);
139var type = typeof(ConfigureServicesAndConfigureContainerStartup);
297var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "WithServices");
319var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "WithScopedServices");
346var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", environment);
366var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "Boom");
378var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", environment);
393var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", environment);
414var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "TwoConfigures");
429var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "PrivateConfigure");
443var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "TwoConfigureServices");
456var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "WithNullConfigureServices");
473var type = StartupLoader.FindStartupType("Microsoft.AspNetCore.Hosting.Tests", "WithConfigureServices");
Microsoft.AspNetCore.Html.Abstractions (1)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Abstractions (65)
Extensions\UseMiddlewareExtensions.cs (18)
51[DynamicallyAccessedMembers(MiddlewareAccessibility)] Type middleware,
106private readonly Type _middleware;
113[DynamicallyAccessedMembers(MiddlewareAccessibility)] Type middleware,
160private readonly Type _middlewareType;
162public InterfaceMiddlewareBinder(Type middlewareType)
206var parameterType = parameters[i].ParameterType;
229var parameterType = parameters[i].ParameterType;
230var declaringType = methodInfo.DeclaringType!;
246private static UnaryExpression GetMethodArgument(ParameterInfo parameter, ParameterExpression providerArg, Type parameterType, Type? declaringType)
256parameterTypeExpression.Add(Expression.Constant(parameterType, typeof(Type)));
257parameterTypeExpression.Add(Expression.Constant(declaringType, typeof(Type)));
295var middleware = typeof(T);
306var parameterType = parameter.ParameterType;
328private static object GetService(IServiceProvider sp, Type type, Type middleware)
335private static object GetKeyedService(IServiceProvider sp, object key, Type type, Type middleware)
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
Microsoft.AspNetCore.Http.Abstractions.Microbenchmarks (7)
Microsoft.AspNetCore.Http.Abstractions.Tests (17)
UseMiddlewareTest.cs (13)
297public IMiddleware? Create(Type middlewareType)
311public IMiddleware? Create(Type middlewareType) => null;
318private readonly Dictionary<Type, object> _services = new Dictionary<Type, object>();
320public void AddService(Type type, object value) => _services[type] = value;
322public object? GetService(Type serviceType)
339private readonly Dictionary<object, Tuple<Type, object>> _services = new Dictionary<object, Tuple<Type, object>>();
346public void AddKeyedService(object key, Type type, object value) => _services[key] = new Tuple<Type, object>(type, value);
348public object? GetKeyedService(Type serviceType, object? serviceKey)
358public object GetRequiredKeyedService(Type serviceType, object? serviceKey)
370public object? GetService(Type serviceType)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Connections.Client (2)
Microsoft.AspNetCore.Http.Extensions (276)
RequestDelegateFactory.cs (28)
55private static readonly MethodInfo GetRequiredServiceMethod = typeof(ServiceProviderServiceExtensions).GetMethod(nameof(ServiceProviderServiceExtensions.GetRequiredService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider) })!;
56private static readonly MethodInfo GetServiceMethod = typeof(ServiceProviderServiceExtensions).GetMethod(nameof(ServiceProviderServiceExtensions.GetService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider) })!;
57private static readonly MethodInfo GetRequiredKeyedServiceMethod = typeof(ServiceProviderKeyedServiceExtensions).GetMethod(nameof(ServiceProviderKeyedServiceExtensions.GetRequiredKeyedService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider), typeof(object) })!;
58private static readonly MethodInfo GetKeyedServiceMethod = typeof(ServiceProviderKeyedServiceExtensions).GetMethod(nameof(ServiceProviderKeyedServiceExtensions.GetKeyedService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider), typeof(object) })!;
65private static readonly MethodInfo ArrayEmptyOfObjectMethod = typeof(Array).GetMethod(nameof(Array.Empty), BindingFlags.Public | BindingFlags.Static)!.MakeGenericMethod(new Type[] { typeof(object) });
346var returnType = methodInfo.ReturnType;
502private static Expression MapHandlerReturnTypeToValueTask(Expression methodCall, Type returnType)
535var typeArg = coercedAwaitableInfo.AwaitableInfo.ResultType;
541var typeArg = coercedAwaitableInfo.AwaitableInfo.ResultType;
607var constructorType = factoryContext.ArgumentTypes?.Length switch
648factoryContext.ArgumentTypes = new Type[parameters.Length];
937private static Expression CreateParamCheckingResponseWritingMethodCall(Type returnType, RequestDelegateFactoryContext factoryContext)
1025private static void PopulateBuiltInResponseTypeMetadata(Type returnType, EndpointBuilder builder)
1059private static Expression AddResponseWritingToMethodCall(Expression methodCall, Type returnType, RequestDelegateFactoryContext factoryContext)
1113var typeArg = returnType.GetGenericArguments()[0];
1161var typeArg = returnType.GetGenericArguments()[0];
1368[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type bodyType,
1423private static object? CreateValueType(Type t) => RuntimeHelpers.GetUninitializedObject(t);
1552private static Expression GetValueFromProperty(MemberExpression sourceExpression, PropertyInfo itemProperty, string key, Type? returnType = null)
1561var parameterType = parameter.ParameterType;
1676var targetParseType = parameter.ParameterType.IsArray ? parameter.ParameterType.GetElementType()! : parameter.ParameterType;
1678var underlyingNullableType = Nullable.GetUnderlyingType(targetParseType);
1681var nonNullableParameterType = underlyingNullableType ?? targetParseType;
1961private static Type? GetExpressionType(Type type) =>
2017private static void AddInferredAcceptsMetadata(RequestDelegateFactoryContext factoryContext, Type type, string[] contentTypes)
2615private static NotSupportedException GetUnsupportedReturnTypeException(Type returnType)
2895public object? GetService(Type serviceType) => null;
src\Components\Endpoints\src\FormMapping\Factories\ComplexType\ComplexTypeExpressionConverterFactoryOfT.cs (20)
16internal override CompiledComplexTypeConverter<T> CreateConverter(Type type, FormDataMapperOptions options)
24private CompiledComplexTypeConverter<T>.ConverterDelegate CreateConverterBody(Type type, FormDataMapperOptions options)
159Array.Empty<Type>(),
185Array.Empty<Type>(),
287Array.Empty<Type>(),
297Array.Empty<Type>(),
304Array.Empty<Type>(),
314Array.Empty<Type>(),
343var propertyConverterType = typeof(FormDataConverter<>).MakeGenericType(property.Type);
379Array.Empty<Type>(),
388Type.EmptyTypes,
398Array.Empty<Type>(),
406Array.Empty<Type>(),
443var constructorParameterConverterType = typeof(FormDataConverter<>).MakeGenericType(constructorParameter.Type);
483Array.Empty<Type>(),
491Type.EmptyTypes,
501Array.Empty<Type>(),
509Array.Empty<Type>(),
552Expression.Not(Expression.Call(readerParam, nameof(FormDataReader.CurrentPrefixExists), Array.Empty<Type>())),
575Expression.Parameter(typeof(Type), "type"),
src\Components\Endpoints\src\FormMapping\Metadata\FormDataMetadataFactory.cs (31)
26public FormDataTypeMetadata? GetOrCreateMetadataFor(Type type, FormDataMapperOptions options)
267internal bool HasMetadataFor(Type type) => _context.TypeMetadata.ContainsKey(type);
269private void DetectCyclesAndMarkMetadataTypesAsRecursive(Type type, FormDataTypeMetadata result)
303void ReportRecursiveChain(Type type)
315public Dictionary<Type, FormDataTypeMetadata> TypeMetadata { get; set; } = new();
317public List<Type> CurrentTypes { get; set; } = new();
340internal void Track(Type type)
345internal void Untrack(Type type)
354public static partial void StartResolveMetadataGraph(ILogger logger, Type type);
357public static partial void EndResolveMetadataGraph(ILogger logger, Type type);
360public static partial void MetadataFound(ILogger<FormDataMetadataFactory> logger, Type type);
363public static partial void NoMetadataFound(ILogger<FormDataMetadataFactory> logger, Type type);
366public static partial void RecursiveTypeFound(ILogger<FormDataMetadataFactory> logger, Type type, string chain);
369public static partial void PrimitiveType(ILogger<FormDataMetadataFactory> logger, Type type);
372public static partial void DictionaryType(ILogger<FormDataMetadataFactory> logger, Type type);
375public static partial void CollectionType(ILogger<FormDataMetadataFactory> logger, Type type);
378public static partial void ObjectType(ILogger<FormDataMetadataFactory> logger, Type type);
381public static partial void ConstructorFound(ILogger<FormDataMetadataFactory> logger, Type type, string parameters);
384public static partial void ConstructorParameter(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type parameterType);
387public static partial void CandidateProperty(ILogger<FormDataMetadataFactory> logger, string name, Type propertyType);
405public static partial void MetadataComputed(ILogger<FormDataMetadataFactory> logger, Type type);
408public static partial void GenericTypeDefinitionNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
411public static partial void MultiplePublicConstructorsFound(ILogger<FormDataMetadataFactory> logger, Type type);
414public static partial void InterfacesNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
417public static partial void AbstractClassesNotSupported(ILogger<FormDataMetadataFactory> logger, Type type);
420public static partial void NoPublicConstructorFound(ILogger<FormDataMetadataFactory> logger, Type type);
423public static partial void ConstructorParameterTypeNotSupported(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type parameterType);
426public static partial void PropertyTypeNotSupported(ILogger<FormDataMetadataFactory> logger, Type type, string name, Type propertyType);
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
20public Type AwaiterType { get; }
25public Type ResultType { get; }
29Type awaiterType,
34Type resultType,
48Type type,
54var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
62var awaiterType = getAwaiterMethod.ReturnType;
65var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
93var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\ParameterBindingMethodCache.cs (29)
46private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
47private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
48private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
67public bool HasTryParseMethod(Type type)
69var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
80public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
85Func<ParameterExpression, Expression, Expression>? Finder(Type type)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
150Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
218(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
240var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
302var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
313public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
315static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
359private static ConstructorInfo? GetConstructor(Type type)
410private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
413foreach (var i in type.GetInterfaces())
431private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
442private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
456foreach (var implementedInterface in type.GetInterfaces())
480private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
491foreach (var implementedInterface in type.GetInterfaces())
513new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
520new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
532private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
568private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
709public ParameterLookupKey(string name, Type type)
716public Type Type { get; }
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.Http.Extensions.Tests (52)
Microsoft.AspNetCore.Http.Microbenchmarks (10)
Microsoft.AspNetCore.Http.Results (5)
Microsoft.AspNetCore.Http.Results.Tests (50)
ResultsOfTTests.Generated.cs (45)
19public void ResultsOfTResult1TResult2_Result_IsAssignedResult(int input, Type expectedResultType)
103public async Task ResultsOfTResult1TResult2_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
128public async Task ResultsOfTResult1TResult2_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
154public async Task ResultsOfTResult1TResult2_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
181public async Task ResultsOfTResult1TResult2_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
231public void ResultsOfTResult1TResult2TResult3_Result_IsAssignedResult(int input, Type expectedResultType)
319public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
346public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
373public async Task ResultsOfTResult1TResult2TResult3_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
401public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
430public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
459public async Task ResultsOfTResult1TResult2TResult3_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
512public void ResultsOfTResult1TResult2TResult3TResult4_Result_IsAssignedResult(int input, Type expectedResultType)
604public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
633public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
662public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
691public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
721public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
752public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
783public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
814public async Task ResultsOfTResult1TResult2TResult3TResult4_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
870public void ResultsOfTResult1TResult2TResult3TResult4TResult5_Result_IsAssignedResult(int input, Type expectedResultType)
966public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
997public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
1028public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
1059public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
1090public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsIResult_AsFifthTypeArg(int input, Type expectedResultType)
1122public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
1155public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
1188public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
1221public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
1254public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5_AcceptsNestedResultsOfT_AsFifthTypeArg(int input, Type expectedResultType)
1313public void ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_Result_IsAssignedResult(int input, Type expectedResultType)
1413public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFirstTypeArg(int input, Type expectedResultType)
1446public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsSecondTypeArg(int input, Type expectedResultType)
1479public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsThirdTypeArg(int input, Type expectedResultType)
1512public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFourthTypeArg(int input, Type expectedResultType)
1545public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsFifthTypeArg(int input, Type expectedResultType)
1578public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsIResult_AsSixthTypeArg(int input, Type expectedResultType)
1612public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFirstTypeArg(int input, Type expectedResultType)
1647public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsSecondTypeArg(int input, Type expectedResultType)
1682public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsThirdTypeArg(int input, Type expectedResultType)
1717public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFourthTypeArg(int input, Type expectedResultType)
1752public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsFifthTypeArg(int input, Type expectedResultType)
1787public async Task ResultsOfTResult1TResult2TResult3TResult4TResult5TResult6_AcceptsNestedResultsOfT_AsSixthTypeArg(int input, Type expectedResultType)
Microsoft.AspNetCore.Http.Tests (3)
Microsoft.AspNetCore.Identity (7)
Microsoft.AspNetCore.Identity.EntityFrameworkCore (16)
IdentityEntityFrameworkBuilderExtensions.cs (16)
29private static void AddStores(IServiceCollection services, Type userType, Type? roleType, Type contextType)
31var identityUserType = FindGenericBaseType(userType, typeof(IdentityUser<>));
37var keyType = identityUserType.GenericTypeArguments[0];
41var identityRoleType = FindGenericBaseType(roleType, typeof(IdentityRole<>));
47Type userStoreType;
48Type roleStoreType;
49var identityContext = FindGenericBaseType(contextType, typeof(IdentityDbContext<,,,,,,,>));
75Type userStoreType;
76var identityContext = FindGenericBaseType(contextType, typeof(IdentityUserContext<,,,,>));
94private static Type? FindGenericBaseType(Type currentType, Type genericBaseType)
96Type? type = currentType;
99var genericType = type.IsGenericType ? type.GetGenericTypeDefinition() : null;
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (2)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
Microsoft.AspNetCore.Identity.Test (2)
Microsoft.AspNetCore.Identity.UI (4)
Microsoft.AspNetCore.InternalTesting (17)
Microsoft.AspNetCore.InternalTesting.Tests (5)
Microsoft.AspNetCore.JsonPatch (53)
Internal\ListAdapter.cs (8)
29if (!TryGetListTypeArgument(list, out var typeArgument, out errorMessage))
131if (!TryGetListTypeArgument(list, out var typeArgument, out errorMessage))
168if (!TryGetListTypeArgument(list, out var typeArgument, out errorMessage))
232Type listTypeArgument,
248Type listTypeArgument,
267protected virtual bool TryGetListTypeArgument(IList list, out Type listTypeArgument, out string errorMessage)
270var listType = list.GetType();
279var genericList = ClosedGenericMatcher.ExtractGenericInterface(listType, typeof(IList<>));
Microsoft.AspNetCore.JsonPatch.Tests (6)
Microsoft.AspNetCore.Localization.FunctionalTests (1)
Microsoft.AspNetCore.Mvc (6)
Microsoft.AspNetCore.Mvc.Abstractions (124)
src\Shared\ParameterBindingMethodCache.cs (29)
46private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
47private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
48private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
67public bool HasTryParseMethod(Type type)
69var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
80public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
85Func<ParameterExpression, Expression, Expression>? Finder(Type type)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
150Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
218(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
240var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
302var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
313public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
315static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
359private static ConstructorInfo? GetConstructor(Type type)
410private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
413foreach (var i in type.GetInterfaces())
431private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
442private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
456foreach (var implementedInterface in type.GetInterfaces())
480private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
491foreach (var implementedInterface in type.GetInterfaces())
513new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
520new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
532private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
568private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
709public ParameterLookupKey(string name, Type type)
716public Type Type { get; }
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.Mvc.Abstractions.Test (33)
Microsoft.AspNetCore.Mvc.ApiExplorer (37)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (29)
DefaultApiDescriptionProviderTest.cs (18)
171Type constraintType,
217Type constraintType,
636public static TheoryData<Type, string, List<FilterDescriptor>> ReturnsActionResultWithProducesAndProducesContentTypeData
656return new TheoryData<Type, string, List<FilterDescriptor>>
685Type controllerType,
733public static TheoryData<Type, string, List<FilterDescriptor>> ReturnsVoidOrTaskWithProducesContentTypeData
756return new TheoryData<Type, string, List<FilterDescriptor>>
795Type controllerType,
2295private ControllerActionDescriptor CreateActionDescriptor(string methodName = null, Type controllerType = null)
2809public List<Type> SupportedTypes { get; } = new List<Type>();
2818protected override bool CanReadType(Type type)
2837public List<Type> SupportedTypes { get; } = new List<Type>();
2844protected override bool CanWriteType(Type type)
2877public Type Type { get; set; }
2904public Type RequestType => null;
2911public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Microsoft.AspNetCore.Mvc.Core (420)
ModelBinding\ParameterBinder.Log.cs (13)
56private static partial void AttemptingToBindParameter(ILogger logger, string? parameterName, Type modelType);
59private static partial void AttemptingToBindProperty(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType);
102private static partial void DoneAttemptingToBindParameter(ILogger logger, string? parameterName, Type modelType);
105private static partial void DoneAttemptingToBindProperty(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType);
149private static partial void AttemptingToValidateParameter(ILogger logger, string? parameterName, Type modelType);
152private static partial void AttemptingToValidateProperty(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType);
199private static partial void DoneAttemptingToValidateParameter(ILogger logger, string? parameterName, Type modelType);
202private static partial void DoneAttemptingToValidateProperty(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType);
248private static partial void ParameterBinderRequestPredicateShortCircuitOfProperty(ILogger logger, Type? propertyContainerType, string? propertyName);
MvcCoreLoggerExtensions.cs (13)
150private static partial void FoundNoValueForPropertyInRequest(ILogger logger, string modelName, Type? propertyContainerType, string? modelFieldName, Type modelType);
155private static partial void FoundNoValueForParameterInRequest(ILogger logger, string modelName, string? modelFieldName, Type modelType);
158private static partial void FoundNoValueInRequest(ILogger logger, string modelName, Type modelType);
166private static partial void CannotBindToFilesCollectionDueToUnsupportedContentType(ILogger logger, string modelName, Type modelType);
200private static partial void AttemptingToBindParameterModel(ILogger logger, string? parameterName, Type modelType, string modelName);
203private static partial void AttemptingToBindPropertyModel(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType, string modelName);
206private static partial void AttemptingToBindModel(ILogger logger, Type modelType, string modelName);
238private static partial void DoneAttemptingToBindPropertyModel(ILogger logger, Type? propertyContainerType, string? propertyName, Type modelType);
241private static partial void DoneAttemptingToBindModel(ILogger logger, Type modelType, string modelName);
244private static partial void DoneAttemptingToBindParameterModel(ILogger logger, string? parameterName, Type modelType);
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
20public Type AwaiterType { get; }
25public Type ResultType { get; }
29Type awaiterType,
34Type resultType,
48Type type,
54var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
62var awaiterType = getAwaiterMethod.ReturnType;
65var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
93var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
Microsoft.AspNetCore.Mvc.Core.Test (318)
Controllers\ControllerBinderDelegateProviderTest.cs (4)
903public static TheoryData<string, Type, Func<object, object>, object, object> SkippedPropertyData
907return new TheoryData<string, Type, Func<object, object>, object, object>
945Type propertyType,
990var boundPropertyTypes = new Dictionary<string, Type>
Microsoft.AspNetCore.Mvc.Core.TestCommon (2)
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.Cors.Test (1)
Microsoft.AspNetCore.Mvc.DataAnnotations (6)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (47)
DataAnnotationsMetadataProviderTest.cs (31)
403.Setup(s => s.Create(It.IsAny<Type>()))
438.Setup(s => s.Create(It.IsAny<Type>()))
502.Setup(s => s.Create(It.IsAny<Type>()))
574.Setup(f => f.Create(It.IsAny<Type>()))
631public void CreateDisplayMetadata_IsEnum_ReflectsModelType(Type type, bool expectedIsEnum)
665public void CreateDisplayMetadata_IsFlagsEnum_ReflectsModelType(Type type, bool expectedIsFlagsEnum)
682public static TheoryData<Type, IReadOnlyDictionary<string, string>> EnumNamesData
686return new TheoryData<Type, IReadOnlyDictionary<string, string>>
796Type type,
828var type = typeof(EnumWithDisplayNames);
841.Setup(f => f.Create(It.IsAny<Type>()))
859public static TheoryData<Type, IEnumerable<KeyValuePair<EnumGroupAndName, string>>> EnumDisplayNamesData
863return new TheoryData<Type, IEnumerable<KeyValuePair<EnumGroupAndName, string>>>
974Type type,
1230var modelType = typeof(DerivedTypeWithAllNonNullProperties);
1249var modelType = typeof(DerivedTypeWithAllNonNullProperties_WithNullableProperties);
1268var modelType = typeof(DerivedTypeWithAllNonNullProperties_WithNullableProperties);
1289var modelType = typeof(DerivedTypeWithNullableProperties);
1309var modelType = typeof(DerivedTypeWithNullableProperties_WithNonNullProperties);
1328var modelType = typeof(DerivedTypeWithNullableProperties_ShadowedProperty);
1347var modelType = typeof(TypeImplementIInterfaceWithNonNullProperty);
1366var modelType = typeof(TypeImplementIInterfaceWithNonNullProperty_AsNullable);
1386var type = typeof(NullableReferenceTypes);
1407var type = typeof(NullableReferenceTypes);
1427var modelType = typeof(TypeWithAllNonNullProperties);
1583var type = typeof(NullableReferenceTypes);
1599var type = typeof(KeyValuePair<string, object>);
1616var type = typeof(KeyValuePair<string, object>);
1635var type = typeof(NullableReferenceTypes);
1651var type = typeof(NullableReferenceTypes);
1668var type = typeof(NullableReferenceTypes);
Microsoft.AspNetCore.Mvc.Formatters.Xml (50)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (42)
Microsoft.AspNetCore.Mvc.FunctionalTests (6)
Microsoft.AspNetCore.Mvc.IntegrationTests (41)
Microsoft.AspNetCore.Mvc.Localization (9)
Microsoft.AspNetCore.Mvc.Localization.Test (8)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (39)
BsonTempDataSerializer.cs (13)
26private static readonly ConcurrentDictionary<Type, Func<JArray, object>> _arrayConverters =
27new ConcurrentDictionary<Type, Func<JArray, object>>();
28private static readonly ConcurrentDictionary<Type, Func<JObject, object>> _dictionaryConverters =
29new ConcurrentDictionary<Type, Func<JObject, object>>();
31private static readonly Dictionary<JTokenType, Type> _tokenTypeLookup = new Dictionary<JTokenType, Type>(8)
65if (_tokenTypeLookup.TryGetValue(arrayType, out var returnType))
92if (_tokenTypeLookup.TryGetValue(jTokenType, out var valueType))
156var itemType = item.GetType();
164public override bool CanSerializeType(Type type) => CanSerializeType(type, out _);
166private static bool CanSerializeType(Type typeToSerialize, out string? errorMessage)
172Type? actualType = null;
237private static bool IsSimpleType(Type type)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (16)
Microsoft.AspNetCore.Mvc.Razor (32)
Microsoft.AspNetCore.Mvc.Razor.Test (15)
Microsoft.AspNetCore.Mvc.RazorPages (42)
Microsoft.AspNetCore.Mvc.RazorPages.Test (33)
Microsoft.AspNetCore.Mvc.TagHelpers (4)
Microsoft.AspNetCore.Mvc.TagHelpers.Test (24)
InputTagHelperTest.cs (4)
561public static TheoryData<object, Type, object, NameAndId, string> TestDataSet
587return new TheoryData<object, Type, object, NameAndId, string>
619Type containerType,
2389Type containerType,
SelectTagHelperTest.cs (13)
19public static TheoryData<object, Type, Func<object>, NameAndId, string> GeneratesExpectedDataSet
57return new TheoryData<object, Type, Func<object>, NameAndId, string>
143public static TheoryData<Type, object, bool> RealModelTypeDataSet
147return new TheoryData<Type, object, bool>
166Type containerType,
248entry => (Type)entry.Key == typeof(SelectTagHelper));
255Type containerType,
347entry => (Type)entry.Key == typeof(SelectTagHelper));
435Type containerType,
527entry => (Type)entry.Key == typeof(SelectTagHelper));
621entry => (Type)entry.Key == typeof(SelectTagHelper));
629Type modelType,
697entry => (Type)entry.Key == typeof(SelectTagHelper));
Microsoft.AspNetCore.Mvc.Test (29)
Microsoft.AspNetCore.Mvc.Testing (4)
Microsoft.AspNetCore.Mvc.ViewFeatures (99)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (84)
Microsoft.AspNetCore.Mvc.Views.TestCommon (4)
Microsoft.AspNetCore.OpenApi (116)
Services\Schemas\OpenApiSchemaService.cs (3)
61var type = context.TypeInfo.Type;
129internal async Task<OpenApiSchema> GetOrCreateSchemaAsync(Type type, IServiceProvider scopedServiceProvider, IOpenApiSchemaTransformer[] schemaTransformers, ApiParameterDescription? parameterDescription = null, bool captureSchemaByRef = false, CancellationToken cancellationToken = default)
149internal async Task ApplySchemaTransformersAsync(OpenApiSchema schema, Type type, IServiceProvider scopedServiceProvider, IOpenApiSchemaTransformer[] schemaTransformers, ApiParameterDescription? parameterDescription = null, CancellationToken cancellationToken = default)
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
20public Type AwaiterType { get; }
25public Type ResultType { get; }
29Type awaiterType,
34Type resultType,
48Type type,
54var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
62var awaiterType = getAwaiterMethod.ReturnType;
65var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
93var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\ParameterBindingMethodCache.cs (29)
46private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
47private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
48private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
67public bool HasTryParseMethod(Type type)
69var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
80public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
85Func<ParameterExpression, Expression, Expression>? Finder(Type type)
149Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
150Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
218(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
240var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
302var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
313public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
315static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
359private static ConstructorInfo? GetConstructor(Type type)
410private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
413foreach (var i in type.GetInterfaces())
431private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
442private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
456foreach (var implementedInterface in type.GetInterfaces())
480private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
491foreach (var implementedInterface in type.GetInterfaces())
513new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
520new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
532private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
568private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
709public ParameterLookupKey(string name, Type type)
716public Type Type { get; }
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.OpenApi.Microbenchmarks (7)
Microsoft.AspNetCore.OpenApi.Tests (7)
Microsoft.AspNetCore.OutputCaching (3)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (7)
Microsoft.AspNetCore.OutputCaching.StackExchangeRedis (1)
Microsoft.AspNetCore.Owin (22)
OwinEnvironment.cs (6)
318public FeatureMap(Type featureInterface, Func<object, object> getter)
329public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory)
340public FeatureMap(Type featureInterface, Func<object, object> getter, Action<object, object> setter)
352public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory, Action<object, object> setter)
365public FeatureMap(Type featureInterface, Func<object, object> getter, Func<object> defaultFactory, Action<object, object> setter, Func<object> featureFactory)
374private Type FeatureInterface { get; set; }
OwinFeatureCollection.cs (15)
337public object this[Type key]
343private bool SupportsInterface(Type key)
365public object Get(Type key)
375public void Set(Type key, object value)
398public IEnumerator<KeyValuePair<Type, object>> GetEnumerator()
400yield return new KeyValuePair<Type, object>(typeof(IHttpRequestFeature), this);
401yield return new KeyValuePair<Type, object>(typeof(IHttpResponseFeature), this);
402yield return new KeyValuePair<Type, object>(typeof(IHttpResponseBodyFeature), this);
403yield return new KeyValuePair<Type, object>(typeof(IHttpConnectionFeature), this);
404yield return new KeyValuePair<Type, object>(typeof(IHttpRequestIdentifierFeature), this);
405yield return new KeyValuePair<Type, object>(typeof(IHttpRequestLifetimeFeature), this);
406yield return new KeyValuePair<Type, object>(typeof(IHttpAuthenticationFeature), this);
407yield return new KeyValuePair<Type, object>(typeof(IOwinEnvironmentFeature), this);
412yield return new KeyValuePair<Type, object>(typeof(ITlsConnectionFeature), this);
416yield return new KeyValuePair<Type, object>(typeof(IHttpWebSocketFeature), this);
Microsoft.AspNetCore.Razor.Runtime (5)
Microsoft.AspNetCore.RequestDecompression.Microbenchmarks (7)
Microsoft.AspNetCore.RequestDecompression.Tests (1)
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (7)
Microsoft.AspNetCore.ResponseCompression (4)
Microsoft.AspNetCore.ResponseCompression.Microbenchmarks (7)
Microsoft.AspNetCore.Routing (52)
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
Microsoft.AspNetCore.Routing.Abstractions (21)
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
Microsoft.AspNetCore.Routing.Microbenchmarks (9)
Microsoft.AspNetCore.Routing.Tests (11)
Microsoft.AspNetCore.Security.Microbenchmarks (7)
Microsoft.AspNetCore.Server.HttpSys (6)
Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks (7)
Microsoft.AspNetCore.Server.IIS (78)
Core\IISHttpContext.Features.cs (55)
8private static readonly Type IHttpRequestFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpRequestFeature);
9private static readonly Type IHttpRequestBodyDetectionFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpRequestBodyDetectionFeature);
10private static readonly Type IHttpResponseFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpResponseFeature);
11private static readonly Type IHttpResponseBodyFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpResponseBodyFeature);
12private static readonly Type IHttpRequestIdentifierFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpRequestIdentifierFeature);
13private static readonly Type IServiceProvidersFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IServiceProvidersFeature);
14private static readonly Type IHttpRequestLifetimeFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpRequestLifetimeFeature);
15private static readonly Type IHttpConnectionFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpConnectionFeature);
16private static readonly Type IHttpAuthenticationFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.Authentication.IHttpAuthenticationFeature);
17private static readonly Type IQueryFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IQueryFeature);
18private static readonly Type IFormFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IFormFeature);
19private static readonly Type IHttpUpgradeFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpUpgradeFeature);
20private static readonly Type IResponseCookiesFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IResponseCookiesFeature);
21private static readonly Type IItemsFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IItemsFeature);
22private static readonly Type ITlsConnectionFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.ITlsConnectionFeature);
23private static readonly Type ITlsHandshakeFeatureType = typeof(global::Microsoft.AspNetCore.Connections.Features.ITlsHandshakeFeature);
24private static readonly Type IHttpWebSocketFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpWebSocketFeature);
25private static readonly Type ISessionFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.ISessionFeature);
26private static readonly Type IHttpBodyControlFeatureType = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpBodyControlFeature);
27private static readonly Type IISHttpContextType = typeof(IISHttpContext);
28private static readonly Type IServerVariablesFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IServerVariablesFeature);
29private static readonly Type IHttpMaxRequestBodySizeFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpMaxRequestBodySizeFeature);
30private static readonly Type IHttpResponseTrailersFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpResponseTrailersFeature);
31private static readonly Type IHttpResetFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpResetFeature);
32private static readonly Type IConnectionLifetimeNotificationFeature = typeof(global::Microsoft.AspNetCore.Connections.Features.IConnectionLifetimeNotificationFeature);
33private static readonly Type IHttpActivityFeature = typeof(global::Microsoft.AspNetCore.Http.Features.IHttpActivityFeature);
34private static readonly Type IHttpSysRequestInfoFeature = typeof(global::Microsoft.AspNetCore.Server.HttpSys.IHttpSysRequestInfoFeature);
35private static readonly Type IHttpSysRequestTimingFeature = typeof(global::Microsoft.AspNetCore.Server.HttpSys.IHttpSysRequestTimingFeature);
90internal object? FastFeatureGet(Type key)
208internal void FastFeatureSet(Type key, object? feature)
353private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
357yield return new KeyValuePair<Type, object>(IHttpRequestFeatureType, _currentIHttpRequestFeature);
361yield return new KeyValuePair<Type, object>(IHttpRequestBodyDetectionFeature, _currentIHttpRequestBodyDetectionFeature);
365yield return new KeyValuePair<Type, object>(IHttpResponseFeatureType, _currentIHttpResponseFeature);
369yield return new KeyValuePair<Type, object>(IHttpResponseBodyFeatureType, _currentIHttpResponseBodyFeature);
373yield return new KeyValuePair<Type, object>(IHttpRequestIdentifierFeatureType, _currentIHttpRequestIdentifierFeature);
377yield return new KeyValuePair<Type, object>(IServiceProvidersFeatureType, _currentIServiceProvidersFeature);
381yield return new KeyValuePair<Type, object>(IHttpRequestLifetimeFeatureType, _currentIHttpRequestLifetimeFeature);
385yield return new KeyValuePair<Type, object>(IHttpConnectionFeatureType, _currentIHttpConnectionFeature);
389yield return new KeyValuePair<Type, object>(IHttpAuthenticationFeatureType, _currentIHttpAuthenticationFeature);
393yield return new KeyValuePair<Type, object>(IQueryFeatureType, _currentIQueryFeature);
397yield return new KeyValuePair<Type, object>(IFormFeatureType, _currentIFormFeature);
401yield return new KeyValuePair<Type, object>(IHttpUpgradeFeatureType, _currentIHttpUpgradeFeature);
405yield return new KeyValuePair<Type, object>(IResponseCookiesFeatureType, _currentIResponseCookiesFeature);
409yield return new KeyValuePair<Type, object>(IItemsFeatureType, _currentIItemsFeature);
413yield return new KeyValuePair<Type, object>(ITlsConnectionFeatureType, _currentITlsConnectionFeature);
417yield return new KeyValuePair<Type, object>(ITlsHandshakeFeatureType, _currentITlsHandshakeFeature);
421yield return new KeyValuePair<Type, object>(IHttpWebSocketFeatureType, _currentIHttpWebSocketFeature);
425yield return new KeyValuePair<Type, object>(ISessionFeatureType, _currentISessionFeature);
429yield return new KeyValuePair<Type, object>(IHttpBodyControlFeatureType, _currentIHttpBodyControlFeature);
433yield return new KeyValuePair<Type, object>(IServerVariablesFeature, _currentIServerVariablesFeature);
437yield return new KeyValuePair<Type, object>(IHttpMaxRequestBodySizeFeature, _currentIHttpMaxRequestBodySizeFeature);
441yield return new KeyValuePair<Type, object>(IHttpResponseTrailersFeature, _currentIHttpResponseTrailersFeature);
445yield return new KeyValuePair<Type, object>(IHttpResponseTrailersFeature, _currentIHttpResetFeature);
449yield return new KeyValuePair<Type, object>(IHttpActivityFeature, _currentIHttpActivityFeature);
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.AspNetCore.Server.Kestrel.Core (45)
Internal\Http\HttpProtocol.Generated.cs (45)
81private List<KeyValuePair<Type, object>>? MaybeExtra;
131private object? ExtraFeatureGet(Type key)
148private void ExtraFeatureSet(Type key, object? value)
169MaybeExtra = new List<KeyValuePair<Type, object>>(2);
175MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
179MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
187object? IFeatureCollection.this[Type key]
804private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
808yield return new KeyValuePair<Type, object>(typeof(IHttpRequestFeature), _currentIHttpRequestFeature);
812yield return new KeyValuePair<Type, object>(typeof(IHttpResponseFeature), _currentIHttpResponseFeature);
816yield return new KeyValuePair<Type, object>(typeof(IHttpResponseBodyFeature), _currentIHttpResponseBodyFeature);
820yield return new KeyValuePair<Type, object>(typeof(IRouteValuesFeature), _currentIRouteValuesFeature);
824yield return new KeyValuePair<Type, object>(typeof(IEndpointFeature), _currentIEndpointFeature);
828yield return new KeyValuePair<Type, object>(typeof(IServiceProvidersFeature), _currentIServiceProvidersFeature);
832yield return new KeyValuePair<Type, object>(typeof(IHttpActivityFeature), _currentIHttpActivityFeature);
836yield return new KeyValuePair<Type, object>(typeof(IHttpMetricsTagsFeature), _currentIHttpMetricsTagsFeature);
840yield return new KeyValuePair<Type, object>(typeof(IItemsFeature), _currentIItemsFeature);
844yield return new KeyValuePair<Type, object>(typeof(IQueryFeature), _currentIQueryFeature);
848yield return new KeyValuePair<Type, object>(typeof(IRequestBodyPipeFeature), _currentIRequestBodyPipeFeature);
852yield return new KeyValuePair<Type, object>(typeof(IFormFeature), _currentIFormFeature);
856yield return new KeyValuePair<Type, object>(typeof(IHttpAuthenticationFeature), _currentIHttpAuthenticationFeature);
860yield return new KeyValuePair<Type, object>(typeof(IHttpRequestIdentifierFeature), _currentIHttpRequestIdentifierFeature);
864yield return new KeyValuePair<Type, object>(typeof(IHttpConnectionFeature), _currentIHttpConnectionFeature);
868yield return new KeyValuePair<Type, object>(typeof(ISessionFeature), _currentISessionFeature);
872yield return new KeyValuePair<Type, object>(typeof(IResponseCookiesFeature), _currentIResponseCookiesFeature);
876yield return new KeyValuePair<Type, object>(typeof(IHttpRequestTrailersFeature), _currentIHttpRequestTrailersFeature);
880yield return new KeyValuePair<Type, object>(typeof(IHttpResponseTrailersFeature), _currentIHttpResponseTrailersFeature);
884yield return new KeyValuePair<Type, object>(typeof(ITlsConnectionFeature), _currentITlsConnectionFeature);
888yield return new KeyValuePair<Type, object>(typeof(IHttpExtendedConnectFeature), _currentIHttpExtendedConnectFeature);
892yield return new KeyValuePair<Type, object>(typeof(IHttpUpgradeFeature), _currentIHttpUpgradeFeature);
896yield return new KeyValuePair<Type, object>(typeof(IHttpWebSocketFeature), _currentIHttpWebSocketFeature);
900yield return new KeyValuePair<Type, object>(typeof(IHttpWebTransportFeature), _currentIHttpWebTransportFeature);
904yield return new KeyValuePair<Type, object>(typeof(IBadRequestExceptionFeature), _currentIBadRequestExceptionFeature);
908yield return new KeyValuePair<Type, object>(typeof(IHttpRequestTimeoutFeature), _currentIHttpRequestTimeoutFeature);
912yield return new KeyValuePair<Type, object>(typeof(IHttp2StreamIdFeature), _currentIHttp2StreamIdFeature);
916yield return new KeyValuePair<Type, object>(typeof(IHttpRequestLifetimeFeature), _currentIHttpRequestLifetimeFeature);
920yield return new KeyValuePair<Type, object>(typeof(IHttpMaxRequestBodySizeFeature), _currentIHttpMaxRequestBodySizeFeature);
924yield return new KeyValuePair<Type, object>(typeof(IHttpMinRequestBodyDataRateFeature), _currentIHttpMinRequestBodyDataRateFeature);
928yield return new KeyValuePair<Type, object>(typeof(IHttpMinResponseDataRateFeature), _currentIHttpMinResponseDataRateFeature);
932yield return new KeyValuePair<Type, object>(typeof(IHttpBodyControlFeature), _currentIHttpBodyControlFeature);
936yield return new KeyValuePair<Type, object>(typeof(IHttpRequestBodyDetectionFeature), _currentIHttpRequestBodyDetectionFeature);
940yield return new KeyValuePair<Type, object>(typeof(IHttpResetFeature), _currentIHttpResetFeature);
944yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
956IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (8)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (34)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (23)
42private List<KeyValuePair<Type, object>>? MaybeExtra;
70private object? ExtraFeatureGet(Type key)
87private void ExtraFeatureSet(Type key, object? value)
108MaybeExtra = new List<KeyValuePair<Type, object>>(2);
114MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
118MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
126object? IFeatureCollection.this[Type key]
391private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
395yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
399yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
403yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
407yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
411yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
415yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
419yield return new KeyValuePair<Type, object>(typeof(IConnectionSocketFeature), _currentIConnectionSocketFeature);
423yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
427yield return new KeyValuePair<Type, object>(typeof(IStreamDirectionFeature), _currentIStreamDirectionFeature);
431yield return new KeyValuePair<Type, object>(typeof(IStreamIdFeature), _currentIStreamIdFeature);
435yield return new KeyValuePair<Type, object>(typeof(IStreamAbortFeature), _currentIStreamAbortFeature);
439yield return new KeyValuePair<Type, object>(typeof(IStreamClosedFeature), _currentIStreamClosedFeature);
443yield return new KeyValuePair<Type, object>(typeof(IConnectionMetricsTagsFeature), _currentIConnectionMetricsTagsFeature);
455IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (23)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (23)
42private List<KeyValuePair<Type, object>>? MaybeExtra;
70private object? ExtraFeatureGet(Type key)
87private void ExtraFeatureSet(Type key, object? value)
108MaybeExtra = new List<KeyValuePair<Type, object>>(2);
114MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
118MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
126object? IFeatureCollection.this[Type key]
391private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
395yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
399yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
403yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
407yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
411yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
415yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
419yield return new KeyValuePair<Type, object>(typeof(IConnectionSocketFeature), _currentIConnectionSocketFeature);
423yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
427yield return new KeyValuePair<Type, object>(typeof(IStreamDirectionFeature), _currentIStreamDirectionFeature);
431yield return new KeyValuePair<Type, object>(typeof(IStreamIdFeature), _currentIStreamIdFeature);
435yield return new KeyValuePair<Type, object>(typeof(IStreamAbortFeature), _currentIStreamAbortFeature);
439yield return new KeyValuePair<Type, object>(typeof(IStreamClosedFeature), _currentIStreamClosedFeature);
443yield return new KeyValuePair<Type, object>(typeof(IConnectionMetricsTagsFeature), _currentIConnectionMetricsTagsFeature);
455IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (40)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (23)
42private List<KeyValuePair<Type, object>>? MaybeExtra;
70private object? ExtraFeatureGet(Type key)
87private void ExtraFeatureSet(Type key, object? value)
108MaybeExtra = new List<KeyValuePair<Type, object>>(2);
114MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
118MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
126object? IFeatureCollection.this[Type key]
391private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
395yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
399yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
403yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
407yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
411yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
415yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
419yield return new KeyValuePair<Type, object>(typeof(IConnectionSocketFeature), _currentIConnectionSocketFeature);
423yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
427yield return new KeyValuePair<Type, object>(typeof(IStreamDirectionFeature), _currentIStreamDirectionFeature);
431yield return new KeyValuePair<Type, object>(typeof(IStreamIdFeature), _currentIStreamIdFeature);
435yield return new KeyValuePair<Type, object>(typeof(IStreamAbortFeature), _currentIStreamAbortFeature);
439yield return new KeyValuePair<Type, object>(typeof(IStreamClosedFeature), _currentIStreamClosedFeature);
443yield return new KeyValuePair<Type, object>(typeof(IConnectionMetricsTagsFeature), _currentIConnectionMetricsTagsFeature);
455IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
src\Servers\Kestrel\shared\TransportMultiplexedConnection.Generated.cs (17)
35private List<KeyValuePair<Type, object>>? MaybeExtra;
57private object? ExtraFeatureGet(Type key)
74private void ExtraFeatureSet(Type key, object? value)
95MaybeExtra = new List<KeyValuePair<Type, object>>(2);
101MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
105MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
113object? IFeatureCollection.this[Type key]
277private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
281yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
285yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
289yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
293yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
297yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
301yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
305yield return new KeyValuePair<Type, object>(typeof(ITlsConnectionFeature), _currentITlsConnectionFeature);
317IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (23)
src\Servers\Kestrel\shared\TransportConnection.Generated.cs (23)
42private List<KeyValuePair<Type, object>>? MaybeExtra;
70private object? ExtraFeatureGet(Type key)
87private void ExtraFeatureSet(Type key, object? value)
108MaybeExtra = new List<KeyValuePair<Type, object>>(2);
114MaybeExtra[i] = new KeyValuePair<Type, object>(key, value);
118MaybeExtra.Add(new KeyValuePair<Type, object>(key, value));
126object? IFeatureCollection.this[Type key]
391private IEnumerable<KeyValuePair<Type, object>> FastEnumerable()
395yield return new KeyValuePair<Type, object>(typeof(IConnectionIdFeature), _currentIConnectionIdFeature);
399yield return new KeyValuePair<Type, object>(typeof(IConnectionTransportFeature), _currentIConnectionTransportFeature);
403yield return new KeyValuePair<Type, object>(typeof(IConnectionItemsFeature), _currentIConnectionItemsFeature);
407yield return new KeyValuePair<Type, object>(typeof(IPersistentStateFeature), _currentIPersistentStateFeature);
411yield return new KeyValuePair<Type, object>(typeof(IMemoryPoolFeature), _currentIMemoryPoolFeature);
415yield return new KeyValuePair<Type, object>(typeof(IConnectionLifetimeFeature), _currentIConnectionLifetimeFeature);
419yield return new KeyValuePair<Type, object>(typeof(IConnectionSocketFeature), _currentIConnectionSocketFeature);
423yield return new KeyValuePair<Type, object>(typeof(IProtocolErrorCodeFeature), _currentIProtocolErrorCodeFeature);
427yield return new KeyValuePair<Type, object>(typeof(IStreamDirectionFeature), _currentIStreamDirectionFeature);
431yield return new KeyValuePair<Type, object>(typeof(IStreamIdFeature), _currentIStreamIdFeature);
435yield return new KeyValuePair<Type, object>(typeof(IStreamAbortFeature), _currentIStreamAbortFeature);
439yield return new KeyValuePair<Type, object>(typeof(IStreamClosedFeature), _currentIStreamClosedFeature);
443yield return new KeyValuePair<Type, object>(typeof(IConnectionMetricsTagsFeature), _currentIConnectionMetricsTagsFeature);
455IEnumerator<KeyValuePair<Type, object>> IEnumerable<KeyValuePair<Type, object>>.GetEnumerator() => FastEnumerable().GetEnumerator();
Microsoft.AspNetCore.Shared.Tests (153)
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
20public Type AwaiterType { get; }
25public Type ResultType { get; }
29Type awaiterType,
34Type resultType,
48Type type,
54var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
62var awaiterType = getAwaiterMethod.ReturnType;
65var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
93var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\PropertyHelper\PropertyHelper.cs (21)
41private static readonly ConcurrentDictionary<Type, PropertyHelper[]> PropertiesCache = new();
43private static readonly ConcurrentDictionary<Type, PropertyHelper[]> VisiblePropertiesCache = new();
50/// This constructor does not cache the helper. For caching, use <see cref="GetProperties(Type)"/>.
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
144[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
244Type openGenericDelegateType,
248var typeInput = propertyGetMethod.DeclaringType!;
249var typeOutput = propertyGetMethod.ReturnType;
251var delegateType = openGenericDelegateType.MakeGenericType(typeInput, typeOutput);
290var typeInput = setMethod.DeclaringType!;
291var parameterType = parameters[0].ParameterType;
412Type type,
413ConcurrentDictionary<Type, PropertyHelper[]>? allPropertiesCache,
414ConcurrentDictionary<Type, PropertyHelper[]>? visiblePropertiesCache)
444var declaringType = propertyHelper.Property.DeclaringType;
457Type? currentType = type;
493Type type,
494ConcurrentDictionary<Type, PropertyHelper[]>? cache)
509foreach (var @interface in type.GetInterfaces())
523[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] Type type)
562public static void ClearCache(Type[]? _)
src\Shared\TypeNameHelper\TypeNameHelper.cs (9)
17private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
46/// <param name="type">The <see cref="Type"/>.</param>
52public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
59private static void ProcessType(StringBuilder builder, Type type, in DisplayNameOptions options)
93private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
95var innerType = type;
112private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
TypeNameHelperTest.cs (23)
45public void Can_pretty_print_CLR_full_name(Type type, string expected)
54var type = typeof(ClassInGlobalNamespace<int>);
80public void Can_pretty_print_CLR_name(Type type, string expected)
102public void Returns_common_name_for_built_in_types(Type type, string expected)
115public void Can_pretty_print_array_name(Type type, bool fullName, string expected)
120public static TheoryData<Type, bool, string> GetOpenGenericsTestData()
122var openDictionaryType = typeof(Dictionary<,>);
125var closedDictionaryType = openDictionaryType.MakeGenericType(genArgsDictionary);
127var openLevelType = typeof(Level1<>.Level2<>.Level3<>);
130var closedLevelType = openLevelType.MakeGenericType(genArgsLevel);
132var openInnerType = typeof(OuterGeneric<>.InnerNonGeneric.InnerGeneric<,>.InnerGenericLeafNode<>);
135var closedInnerType = openInnerType.MakeGenericType(genArgsInnerType);
137return new TheoryData<Type, bool, string>
174public void Can_pretty_print_open_generics(Type type, bool fullName, string expected)
179public static TheoryData<Type, string> GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSetData =>
180new TheoryData<Type, string>
190public void GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSet(Type type, string expected)
199public static TheoryData<Type, string> GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSetData =>
200new TheoryData<Type, string>
210public void GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSet(Type type, string expected)
219public static TheoryData<Type, string> FullTypeNameData
223return new TheoryData<Type, string>
251public void Can_PrettyPrint_FullTypeName_WithoutGenericParametersAndNestedTypeDelimiter(Type type, string expectedTypeName)
Microsoft.AspNetCore.SignalR.Client.Core (45)
HubConnection.cs (14)
349public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task<object?>> handler, object state)
382public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task> handler, object state)
428public virtual async Task<ChannelReader<object?>> StreamAsChannelCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default)
450public virtual async Task<object?> InvokeCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default)
695private async Task<ChannelReader<object?>> StreamAsChannelCoreAsyncCore(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken)
849if (ReflectionHelper.TryGetStreamType(reader.GetType(), out var channelGenericType))
870private void InvokeStreamMethod(MethodInfo methodInfo, Type[] genericTypes, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource)
1073private async Task<object?> InvokeCoreAsyncCore(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken)
2094public Type[] ParameterTypes { get; }
2099public InvocationHandler(Type[] parameterTypes, Func<object?[], object, Task> callback, object state)
2385Type IInvocationBinder.GetReturnType(string invocationId)
2395Type IInvocationBinder.GetStreamItemType(string invocationId)
2407IReadOnlyList<Type> IInvocationBinder.GetParameterTypes(string methodName)
2412return Type.EmptyTypes;
HubConnectionExtensions.cs (4)
15private static IDisposable On(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Action<object?[]> handler)
36return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
211public static IDisposable On(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], Task> handler)
231return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
HubConnectionExtensions.OnResult.cs (4)
18private static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], TResult> handler)
37public static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], Task<TResult>> handler)
59return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
75return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
Internal\InvocationRequest.cs (6)
22public Type ResultType { get; }
28protected InvocationRequest(CancellationToken cancellationToken, Type resultType, string invocationId, ILogger logger, HubConnection hubConnection, Activity? activity)
48public static InvocationRequest Invoke(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity, out Task<object?> result)
55public static InvocationRequest Stream(CancellationToken cancellationToken, Type resultType, string invocationId,
83public Streaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity)
171public NonStreaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, Activity? activity)
Microsoft.AspNetCore.SignalR.Client.Tests (23)
HubClientProxyGeneratorTests.cs (16)
77Array.Empty<Type>(),
85It.Is<Type[]>(t => t.Length == 1 && t[0] == typeof(int)),
93It.Is<Type[]>(t => t.Length == 3 && t[0] == typeof(int) && t[1] == typeof(float) && t[2] == typeof(int?)),
101Array.Empty<Type>(),
128Array.Empty<Type>(),
136It.Is<Type[]>(t => t.Length == 1 && t[0] == typeof(int)),
144It.Is<Type[]>(t => t.Length == 3 && t[0] == typeof(int) && t[1] == typeof(float) && t[2] == typeof(int?)),
152Array.Empty<Type>(),
181Array.Empty<Type>(),
185(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
197It.Is<Type[]>(t => t.Length == 1 && t[0] == typeof(int)),
201(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
213It.Is<Type[]>(t => t.Length == 3 && t[0] == typeof(int) && t[1] == typeof(float) && t[2] == typeof(int?)),
217(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
229Array.Empty<Type>(),
233(string methodName, Type[] parameterTypes, Func<object[], object, Task> handler, object state) =>
HubConnectionTests.cs (7)
850mockConnection.Setup(c => c.On(It.IsAny<string>(), It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), It.IsAny<object>()));
852mockConnection.Setup(c => c.StreamAsChannelCoreAsync(It.IsAny<string>(), It.IsAny<Type>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>()))
854mockConnection.Setup(c => c.InvokeCoreAsync(It.IsAny<string>(), It.IsAny<Type>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>())).Returns(() => Task.FromResult(It.IsAny<object>()));
862_ = hubConnection.On("someMethod2", new Type[] { typeof(int) }, (args, obj) => Task.CompletedTask, 2);
871mockConnection.Verify(c => c.On("someMethod", It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), It.IsAny<object>()), Times.Once);
872mockConnection.Verify(c => c.On("someMethod2", It.IsAny<Type[]>(), It.IsAny<Func<object[], object, Task>>(), 2), Times.Once);
874mockConnection.Verify(c => c.StreamAsChannelCoreAsync("stream", It.IsAny<Type>(), It.IsAny<object[]>(), It.IsAny<CancellationToken>()), Times.Once);
Microsoft.AspNetCore.SignalR.Common (10)
Microsoft.AspNetCore.SignalR.Common.Tests (20)
Microsoft.AspNetCore.SignalR.Core (143)
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
20public Type AwaiterType { get; }
25public Type ResultType { get; }
29Type awaiterType,
34Type resultType,
48Type type,
54var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
62var awaiterType = getAwaiterMethod.ReturnType;
65var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
93var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\SignalR\common\Shared\ClientResultsManager.cs (8)
16private readonly ConcurrentDictionary<string, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete)> _pendingInvocations = new();
41public void AddInvocation(string invocationId, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete) invocationInfo)
75public (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Completion)? RemoveInvocation(string invocationId)
81public bool TryGetType(string invocationId, [NotNullWhen(true)] out Type? type)
92public Type GetReturnType(string invocationId)
94if (TryGetType(invocationId, out var type))
102public IReadOnlyList<Type> GetParameterTypes(string methodName)
108public Type GetStreamItemType(string streamId)
Microsoft.AspNetCore.SignalR.Microbenchmarks (16)
Microsoft.AspNetCore.SignalR.Protocols.Json (9)
Protocol\JsonHubProtocol.cs (8)
236var returnType = ProtocolHelper.TryGetReturnType(binder, invocationId);
278var itemType = binder.GetStreamItemType(id);
414var returnType = binder.GetStreamItemType(invocationId);
434var returnType = ProtocolHelper.TryGetReturnType(binder, invocationId);
814private object? BindType(ref Utf8JsonReader reader, ReadOnlySequence<byte> input, Type type)
830private object? BindType(ref Utf8JsonReader reader, Type type) => DeserializeObject(ref reader, type);
832private object?[] BindTypes(ref Utf8JsonReader reader, IReadOnlyList<Type> paramTypes)
921private object? DeserializeObject(ref Utf8JsonReader reader, Type type) => JsonSerializer.Deserialize(ref reader, type, _payloadSerializerOptions);
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (19)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (11)
Microsoft.AspNetCore.SignalR.Specification.Tests (3)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (12)
src\SignalR\common\Shared\ClientResultsManager.cs (8)
16private readonly ConcurrentDictionary<string, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete)> _pendingInvocations = new();
41public void AddInvocation(string invocationId, (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Complete) invocationInfo)
75public (Type Type, string ConnectionId, object Tcs, Action<object, CompletionMessage> Completion)? RemoveInvocation(string invocationId)
81public bool TryGetType(string invocationId, [NotNullWhen(true)] out Type? type)
92public Type GetReturnType(string invocationId)
94if (TryGetType(invocationId, out var type))
102public IReadOnlyList<Type> GetParameterTypes(string methodName)
108public Type GetStreamItemType(string streamId)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (2)
Microsoft.AspNetCore.SignalR.Tests (41)
Microsoft.AspNetCore.SignalR.Tests.Utils (3)
Microsoft.AspNetCore.TestHost (4)
Microsoft.AspNetCore.Tests (1)
Microsoft.AspNetCore.WebSockets.Microbenchmarks (7)
Microsoft.AspNetCore.WebUtilities.Microbenchmarks (7)
Microsoft.Bcl.AsyncInterfaces (2)
Microsoft.Bcl.Numerics (2)
Microsoft.Build (166)
Evaluation\Expander.cs (26)
2252internal static ItemTransformFunction GetItemTransformFunction(IElementLocation elementLocation, string functionName, Type itemType)
3159public Type ReceiverType { get; set; }
3227private Type _receiverType;
3272Type receiverType,
3377var receiverType = GetTypeForStaticMethod(typeName, functionBuilder.Name);
3429var receiverType = propertyValue?.GetType() ?? typeof(string);
3608functionResult = _receiverType.InvokeMember(_methodMethodName, _bindingFlags, Type.DefaultBinder, objectInstance, args, CultureInfo.InvariantCulture);
3714Type t = method.GetParameters()[i].ParameterType;
3738return _receiverType.InvokeMember(_methodMethodName, _bindingFlags, Type.DefaultBinder, objectInstance, args, CultureInfo.InvariantCulture) ?? "null";
4590private bool ElementsOfType(object[] args, Type type)
5028private static Type GetTypeForStaticMethod(string typeName, string simpleMethodName)
5030Type receiverType;
5031Tuple<string, Type> cachedTypeInformation;
5059receiverType = Type.GetType(assemblyQualifiedTypeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
5067AvailableStaticMethods.TryAdd(typeName, simpleMethodName, new Tuple<string, Type>(assemblyQualifiedTypeName, receiverType));
5074receiverType = Type.GetType(typeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
5108AvailableStaticMethods.TryAdd(typeName, new Tuple<string, Type>(typeName, receiverType));
5118private static Type GetTypeFromAssemblyUsingNamespace(string typeName)
5136Type foundType = GetTypeFromAssembly(typeName, candidateAssemblyName);
5159private static Type GetTypeFromAssembly(string typeName, string candidateAssemblyName)
5161Type objectType = null;
5374Type enumType = parameters[n].ParameterType;
5486private static bool IsStaticMethodAvailable(Type receiverType, string methodName)
5523Type[] types = new Type[_arguments.Length];
5647? Type.GetTypeCode(parameters[0].ParameterType)
Resources\Constants.cs (44)
176private static ConcurrentDictionary<string, Tuple<string, Type>> s_availableStaticMethods;
199internal static bool TryAdd(string key, Tuple<string, Type> value)
211public static bool TryAdd(string typeFullName, string simpleMethodName, Tuple<string, Type> typeInformation)
219internal static bool TryGetValue(string key, out Tuple<string, Type> value)
227internal static Tuple<string, Type> GetValue(string key)
229Tuple<string, Type> typeInformation;
244internal static Tuple<string, Type> GetTypeInformationFromTypeCache(string typeFullName, string simpleMethodName)
288var availableStaticMethods = new ConcurrentDictionary<string, Tuple<string, Type>>(StringComparer.OrdinalIgnoreCase);
291var environmentType = new Tuple<string, Type>(null, typeof(Environment));
292var directoryType = new Tuple<string, Type>(null, typeof(Directory));
293var fileType = new Tuple<string, Type>(null, typeof(File));
294var runtimeInformationType = new Tuple<string, Type>(null, typeof(RuntimeInformation));
295var osPlatformType = new Tuple<string, Type>(null, typeof(OSPlatform));
334availableStaticMethods.TryAdd("System.Globalization.CultureInfo::GetCultureInfo", new Tuple<string, Type>(null, typeof(CultureInfo))); // user request
335availableStaticMethods.TryAdd("System.Globalization.CultureInfo::new", new Tuple<string, Type>(null, typeof(CultureInfo))); // user request
336availableStaticMethods.TryAdd("System.Globalization.CultureInfo::CurrentUICulture", new Tuple<string, Type>(null, typeof(CultureInfo))); // user request
339availableStaticMethods.TryAdd("MSBuild", new Tuple<string, Type>(null, typeof(IntrinsicFunctions)));
340availableStaticMethods.TryAdd("System.Byte", new Tuple<string, Type>(null, typeof(Byte)));
341availableStaticMethods.TryAdd("System.Char", new Tuple<string, Type>(null, typeof(Char)));
342availableStaticMethods.TryAdd("System.Convert", new Tuple<string, Type>(null, typeof(Convert)));
343availableStaticMethods.TryAdd("System.DateTime", new Tuple<string, Type>(null, typeof(DateTime)));
344availableStaticMethods.TryAdd("System.DateTimeOffset", new Tuple<string, Type>(null, typeof(DateTimeOffset)));
345availableStaticMethods.TryAdd("System.Decimal", new Tuple<string, Type>(null, typeof(Decimal)));
346availableStaticMethods.TryAdd("System.Double", new Tuple<string, Type>(null, typeof(Double)));
347availableStaticMethods.TryAdd("System.Enum", new Tuple<string, Type>(null, typeof(Enum)));
348availableStaticMethods.TryAdd("System.Guid", new Tuple<string, Type>(null, typeof(Guid)));
349availableStaticMethods.TryAdd("System.Int16", new Tuple<string, Type>(null, typeof(Int16)));
350availableStaticMethods.TryAdd("System.Int32", new Tuple<string, Type>(null, typeof(Int32)));
351availableStaticMethods.TryAdd("System.Int64", new Tuple<string, Type>(null, typeof(Int64)));
352availableStaticMethods.TryAdd("System.IO.Path", new Tuple<string, Type>(null, typeof(Path)));
353availableStaticMethods.TryAdd("System.Math", new Tuple<string, Type>(null, typeof(Math)));
354availableStaticMethods.TryAdd("System.UInt16", new Tuple<string, Type>(null, typeof(UInt16)));
355availableStaticMethods.TryAdd("System.UInt32", new Tuple<string, Type>(null, typeof(UInt32)));
356availableStaticMethods.TryAdd("System.UInt64", new Tuple<string, Type>(null, typeof(UInt64)));
357availableStaticMethods.TryAdd("System.SByte", new Tuple<string, Type>(null, typeof(SByte)));
358availableStaticMethods.TryAdd("System.Single", new Tuple<string, Type>(null, typeof(Single)));
359availableStaticMethods.TryAdd("System.String", new Tuple<string, Type>(null, typeof(String)));
360availableStaticMethods.TryAdd("System.StringComparer", new Tuple<string, Type>(null, typeof(StringComparer)));
361availableStaticMethods.TryAdd("System.TimeSpan", new Tuple<string, Type>(null, typeof(TimeSpan)));
362availableStaticMethods.TryAdd("System.Text.RegularExpressions.Regex", new Tuple<string, Type>(null, typeof(Regex)));
363availableStaticMethods.TryAdd("System.UriBuilder", new Tuple<string, Type>(null, typeof(UriBuilder)));
364availableStaticMethods.TryAdd("System.Version", new Tuple<string, Type>(null, typeof(Version)));
365availableStaticMethods.TryAdd("Microsoft.Build.Utilities.ToolLocationHelper", new Tuple<string, Type>("Microsoft.Build.Utilities.ToolLocationHelper, Microsoft.Build.Utilities.Core, Version=" + MSBuildConstants.CurrentAssemblyVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", null));
373var operatingSystemType = new Tuple<string, Type>("Microsoft.Build.Framework.OperatingSystem, Microsoft.Build.Framework, Version=" + MSBuildConstants.CurrentAssemblyVersion + ", Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", null);
TypeLoader.cs (19)
34private static ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> s_cacheOfLoadedTypesByFilter = new ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>>();
39private static ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> s_cacheOfReflectionOnlyLoadedTypesByFilter = new ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>>();
44private Func<Type, object, bool> _isDesiredType;
68internal TypeLoader(Func<Type, object, bool> isDesiredType)
241private LoadedType GetLoadedType(ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> cache, string typeName, AssemblyLoadInfo assembly, bool useTaskHost)
273private Func<Type, object, bool> _isDesiredType;
283private ConcurrentDictionary<string, Type> _typeNameToType;
288private Dictionary<string, Type> _publicTypeNameToType;
307internal AssemblyInfoToLoadedTypes(Func<Type, object, bool> typeFilter, AssemblyLoadInfo loadInfo)
315_publicTypeNameToType = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
332Type type = _typeNameToType.GetOrAdd(typeName, (key) =>
339Type t2 = Type.GetType(typeName + "," + _assemblyLoadInfo.AssemblyName, false /* don't throw on error */, true /* case-insensitive */);
365foreach (KeyValuePair<string, Type> desiredTypeInAssembly in _publicTypeNameToType)
387foreach (Type publicType in loadedAssembly.GetExportedTypes())
417Type[] allPublicTypesInAssembly = _loadedAssembly.GetExportedTypes();
418foreach (Type publicType in allPublicTypesInAssembly)
Microsoft.Build.BuildCheck.UnitTests (2)
Microsoft.Build.CommandLine.UnitTests (1)
Microsoft.Build.Engine.OM.UnitTests (9)
Microsoft.Build.Engine.UnitTests (28)
Microsoft.Build.Framework (28)
Microsoft.Build.Framework.UnitTests (1)
Microsoft.Build.Tasks.CodeAnalysis (15)
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (4)
Microsoft.Build.Tasks.Core (36)
Microsoft.Build.Tasks.UnitTests (2)
Microsoft.Build.Utilities.Core (2)
Microsoft.Build.Utilities.UnitTests (2)
Microsoft.Cci.Extensions (2)
Microsoft.CodeAnalysis (66)
DiagnosticAnalyzer\AnalyzerFileReference.cs (5)
223private static ImmutableSortedDictionary<string, ImmutableHashSet<string>> GetAnalyzerTypeNameMap(string fullPath, Type attributeType, AttributeLanguagesFunc languagesFunc)
257private static ImmutableArray<string> GetSupportedLanguages(TypeDefinition typeDef, PEModule peModule, Type attributeType, AttributeLanguagesFunc languagesFunc)
370private readonly Type _attributeType;
378internal Extensions(AnalyzerFileReference reference, Type attributeType, AttributeLanguagesFunc languagesFunc, bool allowNetFramework, Func<object?, TExtension?>? coerceFunction = null)
595Type? type;
Microsoft.CodeAnalysis.CodeStyle (29)
Microsoft.CodeAnalysis.CodeStyle.Fixes (14)
Microsoft.CodeAnalysis.Collections.Package (4)
Microsoft.CodeAnalysis.CSharp (20)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (67)
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (5)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.ExpressionEvaluator.ResultProvider (1)
Microsoft.CodeAnalysis.CSharp.Features (2)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Scripting (11)
CSharpScript.cs (8)
33public static Script<T> Create<T>(string code, ScriptOptions options = null, Type globalsType = null, InteractiveAssemblyLoader assemblyLoader = null)
50public static Script<T> Create<T>(Stream code, ScriptOptions options = null, Type globalsType = null, InteractiveAssemblyLoader assemblyLoader = null)
65public static Script<object> Create(string code, ScriptOptions options = null, Type globalsType = null, InteractiveAssemblyLoader assemblyLoader = null)
81public static Script<object> Create(Stream code, ScriptOptions options = null, Type globalsType = null, InteractiveAssemblyLoader assemblyLoader = null)
98public static Task<ScriptState<T>> RunAsync<T>(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
112public static Task<ScriptState<object>> RunAsync(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
128public static Task<T> EvaluateAsync<T>(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
143public static Task<object> EvaluateAsync(string code, ScriptOptions options = null, object globals = null, Type globalsType = null, CancellationToken cancellationToken = default(CancellationToken))
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (3)
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (4)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (7)
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (7)
Microsoft.CodeAnalysis.CSharp.Workspaces (7)
Microsoft.CodeAnalysis.EditorFeatures (8)
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (17)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (26)
CodeGeneration\CodeGenerationTests.cs (14)
138Type returnType = null,
183Type returnType = null,
223Type returnType = null,
265Type toType,
341Type returnType = null,
375Type type = null,
416Type type = null,
532Type attributeClass,
549Type attributeClass) where T : SyntaxNode
655internal static Func<SemanticModel, IParameterSymbol> Parameter(Type type, string name, bool hasDefaultValue = false, object defaultValue = null, bool isParams = false)
669private static ITypeSymbol GetTypeSymbol(Compilation compilation, Type type)
684internal static Func<SemanticModel, ITypeSymbol> CreateArrayType(Type type, int rank = 1)
712internal static Func<SemanticModel, ISymbol> CreateField(Accessibility accessibility, Editing.DeclarationModifiers modifiers, Type type, string name)
719private static Func<SemanticModel, INamedTypeSymbol> GetTypeSymbol(Type type)
Microsoft.CodeAnalysis.EditorFeatures.Wpf (27)
Lightup\LightupHelpers.cs (17)
15private static readonly ConcurrentDictionary<Type, ConcurrentDictionary<Type, bool>> s_supportedObjectWrappers = new();
17internal static bool CanWrapObject(object obj, Type underlyingType)
31var wrappedObject = s_supportedObjectWrappers.GetOrAdd(underlyingType, static _ => new ConcurrentDictionary<Type, bool>());
58public static Func<T, TResult> CreatePropertyAccessor<T, TResult>(Type? type, string propertyName, TResult defaultValue)
110public static Action<T> CreateActionAccessor<T>(Type? type, string methodName)
166public static Action<T, TArg> CreateActionAccessor<T, TArg>(Type? type, string methodName, Type? argType)
239public static Func<T, TResult> CreateGenericFunctionAccessor<T, TResult>(Type? type, string methodName, Type genericArgumentType, TResult defaultValue)
294public static Func<T, TResult> CreateFunctionAccessor<T, TResult>(Type? type, string methodName, TResult defaultValue)
353public static Func<T, TArg, TResult> CreateFunctionAccessor<T, TArg, TResult>(Type? type, string methodName, Type? argType, TResult defaultValue)
434public static Func<T, TArg0, TArg1, TResult> CreateFunctionAccessor<T, TArg0, TArg1, TResult>(Type? type, string methodName, Type? arg0Type, Type? arg1Type, TResult defaultValue)
500private static string GenerateParameterName(Type parameterType)
Microsoft.CodeAnalysis.ExpressionEvaluator.ExpressionCompiler (1)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (15)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (50)
Microsoft.CodeAnalysis.ExternalAccess.Copilot (3)
Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.UnitTests (2)
Microsoft.CodeAnalysis.ExternalAccess.Razor (12)
Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests (4)
Microsoft.CodeAnalysis.ExternalAccess.Xaml (3)
Microsoft.CodeAnalysis.Features (21)
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
Microsoft.CodeAnalysis.InteractiveHost (7)
Microsoft.CodeAnalysis.LanguageServer (4)
Microsoft.CodeAnalysis.LanguageServer.Protocol (90)
Protocol\Converters\SumConverter.cs (15)
18public override bool CanConvert(Type typeToConvert)
23public override JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options)
25var converterType = typeof(SumConverter<>).MakeGenericType(typeToConvert);
44public SumTypeInfoCache(Type sumTypeType)
56foreach (var parameterType in parameterTypes)
118private static Type NormalizeToNonNullable(Type sumTypeType)
128private static readonly Type[] expressionLambdaMethodTypes = [typeof(Type), typeof(Expression), typeof(ParameterExpression[])];
139private static readonly Type[] jsonSerializerDeserializeMethodTypes = [typeof(Utf8JsonReader).MakeByRefType(), typeof(JsonSerializerOptions)];
150public UnionTypeInfo(Type type, ConstructorInfo constructor, KindAttribute? kindAttribute)
169public Type Type { get; }
183private static readonly ConcurrentDictionary<Type, SumConverter.SumTypeInfoCache> SumTypeCache = new ConcurrentDictionary<Type, SumConverter.SumTypeInfoCache>();
186public override T Read(ref Utf8JsonReader reader, Type objectType, JsonSerializerOptions options)
src\LanguageServer\Microsoft.CommonLanguageServerProtocol.Framework\MethodHandlerDetails.cs (21)
31public static ImmutableArray<MethodHandlerDetails> From(Type handlerType)
57private static ImmutableArray<(Type? RequestType, Type? ResponseType, Type RequestContextType)> GetAllHandlerDetails(Type handlerType)
59var builder = ImmutableArray.CreateBuilder<(Type? RequestType, Type? ResponseType, Type RequestContextType)>();
61foreach (var interfaceType in handlerType.GetInterfaces())
68var genericDefinition = interfaceType.GetGenericTypeDefinition();
100private static (string name, IEnumerable<string> languages) GetRequestHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType)
116static LanguageServerEndpointAttribute? GetMethodAttributeFromHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType)
162static bool TypesMatch(MethodInfo methodInfo, Type?[] types)
178static LanguageServerEndpointAttribute? GetMethodAttributeFromClassOrInterface(Type type)
185foreach (var @interface in interfaces)
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Microsoft.CodeAnalysis.Rebuild.UnitTests (4)
Microsoft.CodeAnalysis.Remote.ServiceHub (2)
Microsoft.CodeAnalysis.Remote.Workspaces (28)
ServiceDescriptors.cs (11)
56public static readonly ServiceDescriptors Instance = new(ComponentName, GetFeatureDisplayName, RemoteSerializationOptions.Default, new (Type, Type?)[]
93private readonly ImmutableDictionary<Type, (ServiceDescriptor descriptorCoreClr64, ServiceDescriptor descriptorCoreClr64ServerGC)> _descriptors;
101IEnumerable<(Type serviceInterface, Type? callbackInterface)> interfaces)
109internal static string GetSimpleName(Type serviceInterface)
119private (ServiceDescriptor descriptorCoreClr64, ServiceDescriptor descriptorCoreClr64ServerGC) CreateDescriptors(Type serviceInterface, Type? callbackInterface)
134public ServiceDescriptor GetServiceDescriptorForServiceFactory(Type serviceType)
137public ServiceDescriptor GetServiceDescriptor(Type serviceType, RemoteProcessConfiguration configuration)
169public ImmutableDictionary<Type, (ServiceDescriptor descriptorCoreClr64, ServiceDescriptor descriptorCoreClr64ServerGC)> Descriptors
Microsoft.CodeAnalysis.Scripting (31)
Script.cs (8)
40internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt)
55internal static Script<T> CreateInitialScript<T>(ScriptCompiler compiler, SourceText sourceText, ScriptOptions optionsOpt, Type globalsTypeOpt, InteractiveAssemblyLoader assemblyLoaderOpt)
85public Type GlobalsType { get; }
90public abstract Type ReturnType { get; }
345internal Script(ScriptCompiler compiler, ScriptBuilder builder, SourceText sourceText, ScriptOptions options, Type globalsTypeOpt, Script previousOpt)
350public override Type ReturnType => typeof(T);
511var globalsType = GlobalsType;
587private static void ValidateGlobals(object globals, Type globalsType)
Microsoft.CodeAnalysis.Test.Utilities (39)
Microsoft.CodeAnalysis.UnitTests (40)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces (98)
Microsoft.CodeAnalysis.Workspaces.MSBuild (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (23)
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (48)
Microsoft.CodeAnalysis.Workspaces.UnitTests (25)
Microsoft.CodeAnalysis.XunitHook (1)
Microsoft.CommonLanguageServerProtocol.Framework.Example (1)
Microsoft.CommonLanguageServerProtocol.Framework.Package (41)
MethodHandlerDetails.cs (21)
31public static ImmutableArray<MethodHandlerDetails> From(Type handlerType)
57private static ImmutableArray<(Type? RequestType, Type? ResponseType, Type RequestContextType)> GetAllHandlerDetails(Type handlerType)
59var builder = ImmutableArray.CreateBuilder<(Type? RequestType, Type? ResponseType, Type RequestContextType)>();
61foreach (var interfaceType in handlerType.GetInterfaces())
68var genericDefinition = interfaceType.GetGenericTypeDefinition();
100private static (string name, IEnumerable<string> languages) GetRequestHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType)
116static LanguageServerEndpointAttribute? GetMethodAttributeFromHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType)
162static bool TypesMatch(MethodInfo methodInfo, Type?[] types)
178static LanguageServerEndpointAttribute? GetMethodAttributeFromClassOrInterface(Type type)
185foreach (var @interface in interfaces)
Microsoft.CommonLanguageServerProtocol.Framework.UnitTests (8)
Microsoft.CSharp (245)
Microsoft\CSharp\RuntimeBinder\Binder.cs (24)
27/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
34Type? context,
56/// <param name="context">The <see cref="Type"/> that indicates where this operation is used.</param>
61Type type,
62Type? context)
82/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
88Type? context,
101/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
108Type? context,
121/// <param name="context">The <see cref="Type"/> that indicates where this operation is used.</param>
127Type? context,
149/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
156IEnumerable<Type>? typeArguments,
157Type? context,
187/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
193Type? context,
206/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
212Type? context)
223/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
229Type? context,
244/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
251Type? context,
266/// <param name="context">The <see cref="System.Type"/> that indicates where this operation is used.</param>
273Type? context,
Microsoft\CSharp\RuntimeBinder\DynamicDebuggerProxy.cs (21)
119Type accessibilityContext)
136public static object TryEvalUnaryOperators<T>(T obj, ExpressionType oper, Type accessibilityContext)
157public static K TryEvalCast<T, K>(T obj, Type type, CSharpBinderFlags kind, Type accessibilityContext)
169Type[] argTypes,
171out Type[] delegateSignatureTypes,
177delegateSignatureTypes = new Type[numberOfArguments + 2];
208private static object CreateDelegateAndInvoke(Type[] delegateSignatureTypes, CallSiteBinder binder, object[] args)
210Type delegateType = Expression.GetDelegateType(delegateSignatureTypes);
236Type[] argTypes,
239Type accessibilityContext,
240Type[] typeArguments)
242Type[] delegateSignatureTypes;
285public static object TryGetMemberValue<T>(T obj, string propName, Type accessibilityContext, bool isResultIndexed)
315Type[] argTypes,
317Type accessibilityContext)
319Type[] delegateSignatureTypes;
352Type accessibilityContext)
381Type[] argTypes,
383Type accessibilityContext)
385Type[] delegateSignatureTypes;
Microsoft\CSharp\RuntimeBinder\RuntimeBinder.cs (15)
25public RuntimeBinder(Type contextType, bool isChecked = false)
203private Type GetArgumentType(ICSharpBinder p, CSharpArgumentInfo argInfo, Expression param, DynamicMetaObject arg, int index)
205Type t = argInfo.UseCompileTimeType ? param.Type : arg.LimitType;
267ICSharpInvokeOrInvokeMemberBinder callOrInvoke, Type callingType, ArgumentObject[] arguments)
269Type type;
273type = arguments[0].Value as Type;
384private Expr CreateLocal(Type type, bool isOut, LocalVariableSymbol local)
517Type[] typeArguments,
692Type t = arguments[0].Value as Type;
800Type eventType = TypeManager.SubstType(eventCType, swtEvent.Ats).AssociatedSystemType;
1111ExprFactory.CreateClass(SymbolTable.GetCTypeFromType(argument.Value as Type)) :
1136Type type = argument.Type;
1189Type returnType,
1226internal Expr BindExplicitConversion(ArgumentObject[] arguments, Type returnType, LocalVariableSymbol[] locals)
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (68)
20private static readonly HashSet<Type> s_typesWithConversionsLoaded = new HashSet<Type>();
25internal Type Type { get; }
28public NameHashKey(Type type, string name)
51IEnumerable<Type> typeArguments,
52Type callingType)
81foreach (Type o in typeArguments)
143List<Type> inheritance = CreateInheritanceHierarchyList(key.Type);
152private static void AddNamesInInheritanceHierarchy(string name, List<Type> inheritance)
156Type type = inheritance[i];
234private static List<Type> CreateInheritanceHierarchyList(Type type)
236List<Type> list;
239Type[] ifaces = type.GetInterfaces();
241list = new List<Type>(ifaces.Length + 2)
245foreach (Type iface in type.GetInterfaces())
251Type obj = typeof(object);
257list = new List<Type> { type };
258for (Type parent = type.BaseType; parent != null; parent = parent.BaseType)
278private static Name GetName(Type type)
303Type[] genericArguments = method.GetGenericArguments();
307Type t = genericArguments[i];
314Type t = genericArguments[i];
327private static TypeArray GetAggregateTypeParameters(Type type, AggregateSymbol agg)
331Type genericDefinition = type.GetGenericTypeDefinition();
332Type[] genericArguments = genericDefinition.GetGenericArguments();
351Type t = genericArguments[i];
385private static TypeParameterType LoadClassTypeParameter(AggregateSymbol parent, Type t)
405private static bool AreTypeParametersEquivalent(Type t1, Type t2)
414Type t1Original = GetOriginalTypeParameterType(t1);
415Type t2Original = GetOriginalTypeParameterType(t2);
455private static Type GetOriginalTypeParameterType(Type t)
461Type parentType = t.DeclaringType;
477Type nextParent = parentType.DeclaringType;
499private static TypeParameterType LoadMethodTypeParameter(MethodSymbol parent, Type t)
521Type t,
581private static CType LoadSymbolsFromType(Type type)
592if (o is Type t)
630return ProcessMethodTypeParameter(m, declarationChain[++i] as Type, current as AggregateSymbol);
646private static TypeParameterType ProcessMethodTypeParameter(MethodInfo methinfo, Type t, AggregateSymbol parent)
666private static CType GetConstructedType(Type type, AggregateSymbol agg)
674foreach (Type argument in type.GetGenericArguments())
689private static CType ProcessSpecialTypeInChain(NamespaceOrAggregateSymbol parent, Type t)
720private static List<object> BuildDeclarationChain(Type callingType)
740for (Type t = callingType; t != null; t = t.DeclaringType)
780private static AggregateSymbol FindSymForType(Symbol sym, Type t)
809internal static CType[] GetCTypeArrayFromTypes(Type[] types)
822Type t = types[i];
832internal static CType GetCTypeFromType(Type type) => type.IsByRef
844Type type)
934Type genericDefinition = type.GetGenericTypeDefinition();
935Type[] genericArguments = genericDefinition.GetGenericArguments();
940Type t = genericArguments[i];
970Type t = type.BaseType;
980agg.SetHasPubNoArgCtor(type.GetConstructor(Type.EmptyTypes) != null);
995private static void SetInterfacesOnAggregate(AggregateSymbol aggregate, Type type)
1001Type[] interfaces = type.GetInterfaces();
1136Type t = aggtype.AssociatedSystemType;
1302Type t = type.getThisType().AssociatedSystemType;
1467PopulateSymbolTableWithName("Value", new Type[] { typeof(Missing) }, typeof(Missing)); // We might need this later
1511Debug.Assert(Type.GetTypeCode(defValue.GetType()) != TypeCode.Decimal); // Handled above
1512switch (Type.GetTypeCode(defValue.GetType()))
1632Type t = p.ParameterType;
1737internal static void AddConversionsForType(Type type)
1743for (Type t = type; t.BaseType != null; t = t.BaseType)
1752private static void AddConversionsForOneType(Type type)
Microsoft.Data.Analysis (116)
DataFrame.IO.cs (22)
23private static Type DefaultGuessTypeFunction(IEnumerable<string> columnValues)
25Type result = typeof(string);
61private static Type GuessKind(int col, List<(long LineNumber, string[] Line)> read, Func<IEnumerable<string>, Type> guessTypeFunction)
70private static Type DetermineType(bool first, Type suggested, Type previous)
78private static Type MaxKind(Type a, Type b)
108string[] columnNames = null, Type[] dataTypes = null,
121public static DataFrame LoadFrom(IEnumerable<IList<object>> vals, IList<(string, Type)> columnInfos)
189var type = reader.GetFieldType(c);
280private static DataFrameColumn CreateColumn(Type kind, string columnName)
350private static DataFrameColumn CreateColumn(Type kind, string[] columnNames, int columnIndex)
357string[] columnNames = null, Type[] dataTypes = null,
360CultureInfo cultureInfo = null, Func<IEnumerable<string>, Type> guessTypeFunction = null)
445Type kind = dataTypes == null ? GuessKind(i, linesForGuessType, guessTypeFunction) : dataTypes[i];
542string[] columnNames = null, Type[] dataTypes = null,
545CultureInfo cultureInfo = null, Func<IEnumerable<string>, Type> guessTypeFunction = null)
569string[] columnNames = null, Type[] dataTypes = null,
572Func<IEnumerable<string>, Type> guessTypeFunction = null)
Microsoft.Data.Analysis.Tests (43)
DataFrame.IOTests.cs (41)
35Type dataType = column.DataType;
407dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }
413dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) }
495DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) });
497df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double) });
567DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double), typeof(DateTime) });
569df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long), typeof(float), typeof(string), typeof(double), typeof(DateTime) });
883DataFrame df = DataFrame.LoadCsv(GetStream(data), dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) });
885df = DataFrame.LoadCsvFromString(data, dataTypes: new Type[] { typeof(string), typeof(short), typeof(int), typeof(long) });
1226static void AssertEqual(DataFrame dataFrame, (string name, Type type)[] columns, object[][] vals)
1234static ((string name, Type type)[] columns, object[][] vals) GetTestData()
1293private readonly Type[] _columnTypes;
1296public LoadCsvVerifyingHelper(int columnCount, long rowCount, string[] columnNames, Type[] columnTypes, object[][] cells)
1338new Type[] { typeof(string), typeof(int), typeof(string) },
1343new Type[] { typeof(string), typeof(int), typeof(string) },
1361new Type[] { typeof(string), typeof(int), typeof(string) },
1366new Type[] { typeof(string), typeof(int), typeof(string) },
1384new Type[] { typeof(string), typeof(int), typeof(string) },
1389new Type[] { typeof(string), typeof(int), typeof(string) },
1408new Type[] { typeof(string), typeof(int), typeof(string) },
1413new Type[] { typeof(string), typeof(int), typeof(string) },
1440new Type[] { typeof(string), typeof(int), typeof(string) },
1453new Type[] { typeof(string), typeof(int), typeof(string) },
1471new Type[] { typeof(string), typeof(int), typeof(string) },
1476new Type[] { typeof(string), typeof(int), typeof(string) },
1494new Type[] { typeof(string), typeof(int), typeof(string) },
1499new Type[] { typeof(string), typeof(int), typeof(string) },
1512public void TestLoadCsvWithTextQualifiersFromStream(string data, char separator, Type[] dataTypes, LoadCsvVerifyingHelper helper)
1520public void TestLoadCsvWithTextQualifiersFromString(string data, char separator, Type[] dataTypes, LoadCsvVerifyingHelper helper)
1528public void TestSaveCsvWithTextQualifiers(string data, char separator, Type[] dataTypes, LoadCsvVerifyingHelper helper)
1558new Type[] { typeof(string), typeof(float), typeof(string), typeof(DateTime), typeof(float), typeof(float), typeof(string) },
1573new Type[] { typeof(string), typeof(int), typeof(string), typeof(DateTime), typeof(double), typeof(long), typeof(string) },
1584Type CustomGuessTypeFunction(IEnumerable<string> columnValues)
1586List<Type> types = [
1596HashSet<Type> possibleTypes = new HashSet<Type>(types);
1609List<Type> typesToRemove = new List<Type>(possibleTypes.Count);
1611foreach (var type in possibleTypes)
1650foreach (var type in typesToRemove)
1662foreach (var type in types)
Microsoft.DotNet.AsmDiff (4)
MefHelpers.cs (4)
19public static ContainerConfiguration WithExport(this ContainerConfiguration configuration, object exportedInstance, Type contractType, string contractName = null, IDictionary<string, object> metadata = null)
27readonly Type _contractType;
30protected SinglePartExportDescriptorProvider(Type contractType, string contractName, IDictionary<string, object> metadata)
67public InstanceExportDescriptorProvider(object exportedInstance, Type contractType, string contractName, IDictionary<string, object> metadata)
Microsoft.DotNet.Build.Tasks.Feed (1)
Microsoft.DotNet.Build.Tasks.Packaging (6)
Microsoft.DotNet.Internal.DependencyInjection.Testing (16)
Microsoft.DotNet.NuGetRepack.Tests (2)
Microsoft.DotNet.RemoteExecutor (3)
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (17)
HelperFactory.cs (17)
31internal static void RegisterAllForType(IHandlebars hb, Type type, object instance)
48private static List<(string name, HandlebarsBlockHelper helper)> CreateBlockHelpersForType(Type type, object instance)
74private static List<(string name, HandlebarsHelper helper)> CreateHelpersForType(Type type, object instance)
100private static IEnumerable<MethodInfo> GetAllMethods(Type type)
213private static MethodInfo EnumerableSkip(Type member) =>
216private static MethodInfo EnumerableToArray(Type member) =>
219private static MethodInfo EnumerableSelect(Type input, Type output) =>
229new[] {typeof(object), typeof(Type)});
235public ProvidedParameter(string name, Type type, Expression value)
243public Type Type { get; }
268private static readonly Type UndefinedBindingResultType =
271private static Expression CoerceObjectExpression(Type output, Expression input)
295private static Expression ConvertResultExpression(Type type, Expression input)
310var parameterType = parameter.ParameterType;
320private static Expression GetExpressionForParamArrayParameter(Type parameterType, int index, ParameterExpression argumentsParameter)
328var elementType = parameterType.GetElementType();
Microsoft.DotNet.VersionTools.Tests (10)
Microsoft.DotNet.XUnitAssert.Tests (8)
Microsoft.DotNet.XUnitExtensions (24)
Microsoft.Extensions.Caching.Hybrid (17)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Caching.StackExchangeRedis (2)
Microsoft.Extensions.Compliance.Abstractions (11)
Microsoft.Extensions.Compliance.Redaction (5)
Microsoft.Extensions.Compliance.Testing (11)
Microsoft.Extensions.Configuration.Binder (42)
ConfigurationBinder.cs (40)
73public static object? Get(this IConfiguration configuration, Type type)
90Type type,
187Type type,
206Type type, string key,
323[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
428Type? interfaceGenericType = type.IsInterface && type.IsConstructedGenericType ? type.GetGenericTypeDefinition() : null;
434Type genericType = typeof(List<>).MakeGenericType(type.GenericTypeArguments);
447Type? dictionaryInterface = FindOpenGenericInterface(typeof(IDictionary<,>), type);
455Type? collectionInterface = FindOpenGenericInterface(typeof(ICollection<>), type);
510Type type,
625Type dictionaryType,
629Type keyType = dictionaryType.GenericTypeArguments[0];
630Type valueType = dictionaryType.GenericTypeArguments[1];
659Type kvpType = typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType);
696Type dictionaryType,
702Type keyType = dictionaryType.GenericTypeArguments[0];
703Type valueType = dictionaryType.GenericTypeArguments[1];
766Type collectionType,
770Type itemType = collectionType.GenericTypeArguments[0];
803private static Array BindArray(Type type, IEnumerable? source, IConfiguration config, BinderOptions options)
805Type elementType;
862private static object? BindSet(Type type, IEnumerable? source, IConfiguration config, BinderOptions options)
864Type elementType = type.GetGenericArguments()[0];
879Type genericType = typeof(HashSet<>).MakeGenericType(elementType);
932Type type,
985Type type,
996private static bool TypeIsADictionaryInterface(Type type)
1000Type genericTypeDefinition = type.GetGenericTypeDefinition();
1005private static bool IsImmutableArrayCompatibleInterface(Type type)
1009Type genericTypeDefinition = type.GetGenericTypeDefinition();
1015private static bool TypeIsASetInterface(Type type)
1019Type genericTypeDefinition = type.GetGenericTypeDefinition();
1027private static Type? FindOpenGenericInterface(
1028Type expected,
1030Type actual)
1038Type[] interfaces = actual.GetInterfaces();
1039foreach (Type interfaceType in interfaces)
1050private static List<PropertyInfo> GetAllProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
1054Type baseType = type;
1079private static object? BindParameter(ParameterInfo parameter, Type type, IConfiguration config,
Microsoft.Extensions.DependencyInjection (112)
ServiceLookup\CallSiteValidator.cs (18)
10internal sealed class CallSiteValidator : CallSiteVisitor<CallSiteValidator.CallSiteValidatorState, Type?>
13private readonly ConcurrentDictionary<ServiceCacheKey, Type?> _scopedServices = new ConcurrentDictionary<ServiceCacheKey, Type?>();
20&& _scopedServices.TryGetValue(callSite.Cache.Key, out Type? scopedService)
23Type serviceType = callSite.ServiceType;
39protected override Type? VisitCallSite(ServiceCallSite callSite, CallSiteValidatorState argument)
44if (!_scopedServices.TryGetValue(callSite.Cache.Key, out Type? firstScopedServiceInCallSiteTree))
67protected override Type? VisitConstructor(ConstructorCallSite constructorCallSite, CallSiteValidatorState state)
69Type? result = null;
72Type? scoped = VisitCallSite(parameterCallSite, state);
78protected override Type? VisitIEnumerable(IEnumerableCallSite enumerableCallSite,
81Type? result = null;
84Type? scoped = VisitCallSite(serviceCallSite, state);
90protected override Type? VisitRootCache(ServiceCallSite singletonCallSite, CallSiteValidatorState state)
96protected override Type? VisitScopeCache(ServiceCallSite scopedCallSite, CallSiteValidatorState state)
108protected override Type? VisitConstant(ConstantCallSite constantCallSite, CallSiteValidatorState state) => null;
110protected override Type? VisitServiceProvider(ServiceProviderCallSite serviceProviderCallSite, CallSiteValidatorState state) => null;
112protected override Type? VisitFactory(FactoryCallSite factoryCallSite, CallSiteValidatorState state) => null;
src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (10)
15private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
44/// <param name="type">The <see cref="Type"/>.</param>
50public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
57private static string? ProcessType(ref StringBuilder? builder, Type type, in DisplayNameOptions options)
61Type[] genericArguments = type.GetGenericArguments();
109private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
111Type innerType = type;
128private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.Extensions.DependencyInjection.Abstractions (171)
ActivatorUtilities.cs (43)
28private static readonly ConcurrentDictionary<Type, ConstructorInfoEx[]> s_constructorInfos = new();
31private static readonly Lazy<ConditionalWeakTable<Type, ConstructorInfoEx[]>> s_collectibleConstructorInfos = new();
38new Func<IServiceProvider, Type, Type, bool, object?, object?>(GetService).Method;
49[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
172Type?[] argumentTypes;
175argumentTypes = Type.EmptyTypes;
179argumentTypes = new Type[parameters.Length];
227[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
252[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
277[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
278Type[] argumentTypes)
315Type[] argumentTypes)
334private static void CreateFactoryInternal([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType, Type[] argumentTypes, out ParameterExpression provider, out ParameterExpression argumentArray, out Expression factoryExpressionBody)
374[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type)
379private static object? GetService(IServiceProvider sp, Type type, Type requiredBy, bool hasDefaultValue, object? key)
390private static void ThrowHelperUnableToResolveService(Type type, Type requiredBy)
407Type? parameterType = constructorParameter.ParameterType;
418Expression.Constant(parameterType, typeof(Type)),
419Expression.Constant(constructor.DeclaringType, typeof(Type)),
448[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
449Type?[] argumentTypes)
452Type declaringType = constructor.DeclaringType!;
549public FactoryParameterContext(Type parameterType, bool hasDefaultValue, object? defaultValue, int argumentIndex, object? serviceKey)
558public Type ParameterType { get; }
566[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
567Type?[] argumentTypes,
602[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
603Type?[] argumentTypes,
635[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type instanceType,
636Type?[] argumentTypes,
688private static bool TryCreateParameterMap(ParameterInfo[] constructorParameters, Type?[] argumentTypes, out int?[] parameterMap)
695Type? givenParameter = argumentTypes[i];
822Type? givenType = givenParameters[givenIndex]?.GetType();
929Type declaringType,
969Type declaringType,
987Type declaringType,
1123Type declaringType,
1203public static void ClearCache(Type[]? _)
1222private static object? GetKeyedService(IServiceProvider provider, Type type, object? serviceKey)
Extensions\ServiceCollectionDescriptorExtensions.Keyed.cs (13)
21[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
42Type service,
44[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
65Type service,
137[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
158Type service,
160[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
181Type service,
253[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type service,
274Type service,
276[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
297Type service,
397public static IServiceCollection RemoveAllKeyed(this IServiceCollection collection, Type serviceType, object? serviceKey)
ServiceCollectionServiceExtensions.cs (16)
26Type serviceType,
27[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
48Type serviceType,
87[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
168Type serviceType,
169[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
190Type serviceType,
229[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
311Type serviceType,
312[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
333Type serviceType,
372[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType)
453Type serviceType,
487Type serviceType,
488[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
498Type serviceType,
ServiceCollectionServiceExtensions.Keyed.cs (16)
27Type serviceType,
29[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
51Type serviceType,
95[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType,
185Type serviceType,
187[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
209Type serviceType,
253[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType,
343Type serviceType,
345[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
367Type serviceType,
411[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type serviceType,
501Type serviceType,
538Type serviceType,
540[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
550Type serviceType,
ServiceDescriptor.cs (53)
19/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
20/// <param name="implementationType">The <see cref="Type"/> implementing the service.</param>
23Type serviceType,
24[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
33/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
35/// <param name="implementationType">The <see cref="Type"/> implementing the service.</param>
38Type serviceType,
40[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
54/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
57Type serviceType,
67/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
71Type serviceType,
85/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
89Type serviceType,
103/// <param name="serviceType">The <see cref="Type"/> of the service.</param>
108Type serviceType,
129private ServiceDescriptor(Type serviceType, object? serviceKey, ServiceLifetime lifetime)
147/// Gets the <see cref="Type"/> of the service.
149public Type ServiceType { get; }
152private Type? _implementationType;
155/// Gets the <see cref="Type"/> that implements the service,
162public Type? ImplementationType => IsKeyedService ? null : _implementationType;
165/// Gets the <see cref="Type"/> that implements the service,
172public Type? KeyedImplementationType
286internal Type GetImplementationType()
300Type[]? typeArguments = ImplementationFactory.GetType().GenericTypeArguments;
319Type[]? typeArguments = KeyedImplementationFactory.GetType().GenericTypeArguments;
371Type service,
372[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
390Type service,
392[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
483public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
500public static ServiceDescriptor KeyedTransient(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
548Type service,
549[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
564Type service,
566[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
654public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
671public static ServiceDescriptor KeyedScoped(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
720Type service,
721[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
739Type service,
741[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
835Type serviceType,
854Type serviceType,
908Type serviceType,
927Type serviceType,
960Type serviceType,
961[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
978Type serviceType,
980[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
995public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
1010public static ServiceDescriptor DescribeKeyed(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory, ServiceLifetime lifetime)
Microsoft.Extensions.DependencyInjection.AutoActivation (29)
Microsoft.Extensions.Diagnostics.Abstractions (10)
src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (10)
15private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
44/// <param name="type">The <see cref="Type"/>.</param>
50public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
57private static string? ProcessType(ref StringBuilder? builder, Type type, in DisplayNameOptions options)
61Type[] genericArguments = type.GetGenericArguments();
109private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
111Type innerType = type;
128private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.Extensions.Diagnostics.ExceptionSummarization (19)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Microsoft.Extensions.Diagnostics.Testing (1)
Microsoft.Extensions.Features (13)
FeatureCollection.cs (10)
23private IDictionary<Type, object>? _features;
64public object? this[Type key]
87_features = new Dictionary<Type, object>(_initialCapacity);
100public IEnumerator<KeyValuePair<Type, object>> GetEnumerator()
146private sealed class KeyComparer : IEqualityComparer<KeyValuePair<Type, object>>
148public bool Equals(KeyValuePair<Type, object> x, KeyValuePair<Type, object> y)
153public int GetHashCode(KeyValuePair<Type, object> obj)
164public DictionaryItemDebugView<Type, object>[] Items => _features.Select(pair => new DictionaryItemDebugView<Type, object>(pair)).ToArray();
Microsoft.Extensions.Http (36)
src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (10)
15private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
44/// <param name="type">The <see cref="Type"/>.</param>
50public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
57private static string? ProcessType(ref StringBuilder? builder, Type type, in DisplayNameOptions options)
61Type[] genericArguments = type.GetGenericArguments();
109private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
111Type innerType = type;
128private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.Extensions.Http.Diagnostics.Tests (1)
Microsoft.Extensions.Http.Polly.Tests (3)
Microsoft.Extensions.Identity.Core (39)
Microsoft.Extensions.Identity.Stores (1)
Microsoft.Extensions.Localization (4)
Microsoft.Extensions.Localization.Abstractions (6)
Microsoft.Extensions.Localization.Tests (6)
Microsoft.Extensions.Logging (3)
Microsoft.Extensions.Logging.Abstractions (11)
src\libraries\Common\src\Extensions\TypeNameHelper\TypeNameHelper.cs (10)
15private static readonly Dictionary<Type, string> _builtInTypeNames = new Dictionary<Type, string>
44/// <param name="type">The <see cref="Type"/>.</param>
50public static string GetTypeDisplayName(Type type, bool fullName = true, bool includeGenericParameterNames = false, bool includeGenericParameters = true, char nestedTypeDelimiter = DefaultNestedTypeDelimiter)
57private static string? ProcessType(ref StringBuilder? builder, Type type, in DisplayNameOptions options)
61Type[] genericArguments = type.GetGenericArguments();
109private static void ProcessArrayType(StringBuilder builder, Type type, in DisplayNameOptions options)
111Type innerType = type;
128private static void ProcessGenericType(StringBuilder builder, Type type, Type[] genericArguments, int length, in DisplayNameOptions options)
Microsoft.Extensions.Logging.AzureAppServices (2)
Microsoft.Extensions.Logging.Configuration (3)
Microsoft.Extensions.Logging.Generators (1)
Microsoft.Extensions.ObjectPool.DependencyInjection (1)
Microsoft.Extensions.ObjectPool.Microbenchmark (7)
Microsoft.Extensions.Options (19)
Microsoft.Extensions.Options.SourceGeneration (1)
Microsoft.Extensions.Resilience (11)
Microsoft.Extensions.Telemetry (3)
Microsoft.Extensions.Telemetry.Abstractions (13)
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
Microsoft.Gen.Logging (1)
Microsoft.Gen.Logging.Generated.Tests (1)
Microsoft.Gen.Logging.Unit.Tests (1)
Microsoft.Gen.Metrics (1)
Microsoft.Gen.Metrics.Unit.Tests (1)
Microsoft.Interop.ComInterfaceGenerator (1)
Microsoft.Interop.LibraryImportGenerator (4)
Microsoft.Interop.LibraryImportGenerator.Downlevel (3)
Microsoft.Interop.SourceGeneration (5)
Microsoft.JSInterop (46)
Infrastructure\DotNetDispatcher.cs (23)
29private static readonly ConcurrentDictionary<AssemblyKey, IReadOnlyDictionary<string, (MethodInfo, Type[])>> _cachedMethodsByAssembly = new();
31private static readonly ConcurrentDictionary<Type, IReadOnlyDictionary<string, (MethodInfo, Type[])>> _cachedMethodsByType = new();
33private static readonly ConcurrentDictionary<Type, Func<object, Task>> _cachedConvertToTaskByType = new();
163Type[] parameterTypes;
215internal static object?[] ParseArguments(JSRuntime jsRuntime, string methodIdentifier, string arguments, Type[] parameterTypes)
240var parameterType = parameterTypes[index];
265static bool IsIncorrectDotNetObjectRefUse(Type parameterType, Utf8JsonReader jsonReader)
351private static (MethodInfo, Type[]) GetCachedMethodInfo(AssemblyKey assemblyKey, string methodIdentifier)
371private static Task GetTaskByType(Type type, object obj)
373var converterDelegate = _cachedConvertToTaskByType.GetOrAdd(type, (Type t, MethodInfo taskConverterMethodInfo) =>
381private static (MethodInfo methodInfo, Type[] parameterTypes) GetCachedMethodInfo(IDotNetObjectReference objectReference, string methodIdentifier)
383var type = objectReference.Value.GetType();
399static Dictionary<string, (MethodInfo, Type[])> ScanTypeForCallableMethods([DynamicallyAccessedMembers(JSInvokable)] Type type)
401var result = new Dictionary<string, (MethodInfo, Type[])>(StringComparer.Ordinal);
431private static Dictionary<string, (MethodInfo, Type[])> ScanAssemblyForCallableMethods(AssemblyKey assemblyKey)
435var result = new Dictionary<string, (MethodInfo, Type[])>(StringComparer.Ordinal);
437foreach (var type in exportedTypes)
464private static Type[] GetParameterTypes(MethodInfo method)
469return Type.EmptyTypes;
472var parameterTypes = new Type[parameters.Length];
509public static void ClearCache(Type[]? _)
Microsoft.JSInterop.WebAssembly (2)
Microsoft.Maui (160)
Converters\FlexEnumsConverters.cs (21)
12 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
15 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
39 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
51 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
54 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
74 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
86 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
89 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
113 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
125 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
128 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
148 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
160 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
163 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
183 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
195 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
198 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
216 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
228 public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
231 public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
258 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
HotReload\HotReloadHelper.cs (18)
70 if (!replacedViews.TryGetValue(view.GetType().FullName!, out var newViewType))
83 var viewType = view.GetType();
84 if (!replacedViews.TryGetValue(viewType.FullName!, out var newViewType) || viewType == newViewType)
117 static Dictionary<string, Type> replacedViews = new(StringComparer.Ordinal);
119 static Dictionary<string, List<KeyValuePair<Type, Type>>> replacedHandlers = new(StringComparer.Ordinal);
125 public static void RegisterReplacedView(string oldViewType, Type newViewType)
165 var t = assemblies.Select(x => x.GetType(oldViewType)).FirstOrDefault(x => x != null);
167 var views = HandlerService!.Where(x => x.ImplementationType == t).Select(x => new KeyValuePair<Type, Type>(x.ServiceType, x.ImplementationType!)).ToList();
177 static void RegisterHandler(KeyValuePair<Type, Type> pair, Type newHandler)
180 var view = pair.Key;
181 var newType = newHandler;
213 public static void UpdateApplication(Type[] types)
216 foreach (var t in types)
219 public static void ClearCache(Type[] types) => TriggerReload();
Microsoft.Maui.Controls (404)
BindableProperty.cs (27)
43 internal static readonly Dictionary<Type, TypeConverter> KnownTypeConverters = new Dictionary<Type, TypeConverter>
51 internal static readonly Dictionary<Type, IValueConverter> KnownIValueConverters = new Dictionary<Type, IValueConverter>
58 internal static readonly Dictionary<Type, Type[]> SimpleConvertTypes = new Dictionary<Type, Type[]>
77 BindableProperty(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
117 public Type DeclaringType { get; private set; }
133 public Type ReturnType { get; }
148 public static BindableProperty Create(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue = null, BindingMode defaultBindingMode = BindingMode.OneWay,
157 public static BindableProperty CreateAttached(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWay,
165 public static BindablePropertyKey CreateAttachedReadOnly(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
175 public static BindablePropertyKey CreateReadOnly(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode = BindingMode.OneWayToSource,
184 internal static BindableProperty Create(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
192 internal static BindableProperty CreateAttached(string propertyName, [DynamicallyAccessedMembers(ReturnTypeMembers)] Type returnType, [DynamicallyAccessedMembers(DeclaringTypeMembers)] Type declaringType, object defaultValue, BindingMode defaultBindingMode, ValidateValueDelegate validateValue,
210 Type returnType = ReturnType;
215 Type valueType = value.GetType();
222 if (SimpleConvertTypes.TryGetValue(valueType, out Type[] convertibleTo) && Array.IndexOf(convertibleTo, returnType) != -1)
MessagingCenter.cs (10)
31 class Sender : Tuple<string, Type, Type>
33 public Sender(string message, Type senderType, Type argType) : base(message, senderType, argType)
200 void InnerSend(string message, Type senderType, Type argType, object sender, object args)
226 void InnerSubscribe(object subscriber, string message, Type senderType, Type argType, object target, MethodInfo methodInfo, Filter filter)
243 void InnerUnsubscribe(string message, Type senderType, Type argType, object subscriber)
Registrar.cs (53)
30 public readonly Type Target;
34 [DynamicallyAccessedMembers(TargetMembers)] Type target,
45 readonly Dictionary<Type, Dictionary<Type, HandlerType>> _handlers = new Dictionary<Type, Dictionary<Type, HandlerType>>();
46 static Type _defaultVisualType = typeof(VisualMarker.DefaultVisual);
49 static Type[] _defaultVisualRenderers = new[] { _defaultVisualType };
52 Type tview,
53 [DynamicallyAccessedMembers(HandlerType.TargetMembers)] Type trender,
54 Type[] supportedVisuals,
62 if (!_handlers.TryGetValue(tview, out Dictionary<Type, HandlerType> visualRenderers))
64 visualRenderers = new Dictionary<Type, HandlerType>();
96 public void Register(Type tview, [DynamicallyAccessedMembers(HandlerType.TargetMembers)] Type trender, Type[] supportedVisual)
99 public void Register(Type tview, [DynamicallyAccessedMembers(HandlerType.TargetMembers)] Type trender)
102 internal TRegistrable GetHandler(Type type) => GetHandler(type, _defaultVisualType);
104 internal TRegistrable GetHandler(Type type, Type visualType)
106 Type handlerType = GetHandlerType(type, visualType ?? _defaultVisualType);
117 internal TRegistrable GetHandler(Type type, object source, IVisual visual, params object[] args)
126 Type handlerType = GetHandlerType(type, visual?.GetType() ?? _defaultVisualType);
136 public TOut GetHandler<TOut>(Type type) where TOut : class, TRegistrable
141 public TOut GetHandler<TOut>(Type type, params object[] args) where TOut : class, TRegistrable
152 var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
163 var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
168 public Type GetHandlerType(Type viewType) => GetHandlerType(viewType, _defaultVisualType);
171 public Type GetHandlerType(Type viewType, Type visualType)
176 if (_handlers.TryGetValue(viewType, out Dictionary<Type, HandlerType> visualRenderers))
196 public Type GetHandlerTypeForObject(object obj)
202 var type = reflectableType != null ? reflectableType.GetTypeInfo().AsType() : obj.GetType();
207 bool LookupHandlerType(Type viewType, Type visualType, out HandlerType handlerType)
212 if (_handlers.TryGetValue(viewType, out Dictionary<Type, HandlerType> visualRenderers))
227 void RegisterRenderWithTypes(Type viewType, Type visualType)
239 if (!_handlers.TryGetValue(viewType, out Dictionary<Type, HandlerType> visualRenderers) ||
252 Type specificTypeRenderer = attribute.Type;
303 public readonly Type Type;
306 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type)
412 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type effectType)
420 public static void RegisterAll(Type[] attrTypes, IFontRegistrar fontRegistrar = null)
429 public static void RegisterAll(Type[] attrTypes, InitializationFlags flags, IFontRegistrar fontRegistrar = null)
444 Type[] attrTypes,
446 Action<(Type handler, Type target)> viewRegistered,
475 foreach (Type attrType in attrTypes)
515 internal static void CheckIfRendererIsCompatibilityRenderer(Type rendererType)
TypeConversionHelper.cs (12)
15 internal static bool TryConvert(object value, Type targetType, out object? convertedValue)
17 Type valueType = value.GetType();
72 private static bool TryGetTypeConverter(Type type, [NotNullWhen(true)] out TypeConverter? converter)
75 private static bool ShouldCheckForImplicitConversionOperator(Type type) =>
81 private static bool TryConvertUsingImplicitCastOperator(object value, Type targetType, [NotNullWhen(true)] out object? result)
83 Type valueType = value.GetType();
99 static MethodInfo? GetImplicitConversionOperator(Type onType, Type fromType, Type toType)
148 static bool HasSuitableParameterType(MethodInfo method, Type fromType)
153 static bool HasSuitableReturnType(MethodInfo method, Type toType)
157 private static void WarnIfImplicitOperatorIsAvailable(object value, Type targetType)
Xaml\TypeConversionExtensions.cs (9)
45 internal static object ConvertTo(this object value, Type toType, Func<ParameterInfo> pinfoRetriever,
53 var convertertype = pInfo.GetCustomAttribute<TypeConverterAttribute>()?.GetConverterType();
62 internal static object ConvertTo(this object value, Type toType, Func<MemberInfo> minfoRetriever,
91 if (memberInfo.GetCustomAttribute<TypeConverterAttribute>()?.GetConverterType() is Type converterType)
104 static Type GetConverterType(this TypeConverterAttribute attribute)
105 => Type.GetType(attribute.ConverterTypeName);
110 Type toType,
111 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type convertertype,
130 internal static object ConvertTo(this object value, Type toType, Func<TypeConverter> getConverter,
Microsoft.Maui.Controls.Build.Tasks (11)
Microsoft.Maui.Controls.Compatibility (27)
ExportRendererAttribute.cs (9)
9 public ExportRendererAttribute(Type handler, [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] Type target) : this(handler, target, null)
13 public ExportRendererAttribute(Type handler, [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] Type target, Type[] supportedVisuals) : base(handler, target, supportedVisuals)
21 public ExportCellAttribute(Type handler, [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] Type target) : base(handler, target)
29 public ExportImageSourceHandlerAttribute(Type handler, [DynamicallyAccessedMembers(Internals.HandlerType.TargetMembers)] Type target) : base(handler, target)
Microsoft.Maui.Controls.DesignTools (3)
Microsoft.Maui.Controls.Xaml (72)
XamlServiceProvider.cs (11)
14 readonly Dictionary<Type, object> services = new Dictionary<Type, object>();
75 public object GetService(Type serviceType) => services.TryGetValue(serviceType, out var service) ? service : null;
77 public void Add(Type type, object service) => services.Add(type, service);
210 Type IXamlTypeResolver.Resolve(string qualifiedTypeName, IServiceProvider serviceProvider)
212 var type = Resolve(qualifiedTypeName, serviceProvider, out XamlParseException e);
218 bool IXamlTypeResolver.TryResolve(string qualifiedTypeName, out Type type)
224 internal bool TryResolve(XmlType xmlType, out Type type)
231 Type Resolve(string qualifiedTypeName, IServiceProvider serviceProvider, out XamlParseException exception)
244 internal delegate Type GetTypeFromXmlName(XmlType xmlType, IXmlLineInfo xmlInfo, Assembly currentAssembly, out XamlParseException exception);
333 context.RootElement.GetType().Assembly, out var xpe) is Type parentType
Microsoft.Maui.Essentials (3)
Microsoft.Maui.Graphics (21)
Microsoft.Maui.Resizetizer (1)
Microsoft.ML.AutoML (14)
Microsoft.ML.AutoML.SourceGenerator (10)
Microsoft.ML.AutoML.Tests (3)
Microsoft.ML.Benchmarks.Tests (5)
Microsoft.ML.CodeGenerator (26)
Microsoft.ML.Core (289)
CommandLine\CmdParser.cs (46)
46Type SignatureType { get; }
236public static bool ParseArguments(IHostEnvironment env, string settings, object destination, Type destinationType, ErrorReporter reporter)
259var destinationType = destination.GetType();
335Type t1 = values.GetType();
336Type t2 = defaults.GetType();
337Type t;
354Type t1 = values.GetType();
355Type t2 = defaults.GetType();
356Type t;
382public static bool IsNumericType(Type type)
415public static string ArgumentsUsage(IHostEnvironment env, Type type, object defaults, bool showRsp = false, int? columns = null)
435public static ArgInfo GetArgInfo(Type type, object defaults)
462private static ArgumentInfo GetArgumentInfo(Type type, object defaults)
1101private static bool IsNullableType(Type type)
1106private static bool IsValidItemType(Type type)
1114Type typeBase = type;
1142Type factoryType,
1143Type signatureType,
1225public Type ItemType { get { return _arg.ItemType; } }
1230public Type ItemValueType { get { return _arg.ItemValueType; } }
1252internal static ArgInfo GetInfo(Type type, object defaults = null)
1264private static string TypeToString(Type type)
1340public ArgumentInfo(Type type, Argument argDef, Argument[] args, Dictionary<string, Argument> map)
1363private static MethodInfo GetParseMethod(Type type)
1372private static MethodInfo GetUnparseMethod(Type type)
1397public readonly Type ItemType;
1402public readonly Type ItemValueType;
1414private readonly Type _signatureType;
1469_ctorCustom = ItemValueType.GetConstructor(Type.EmptyTypes);
1492private bool IsKeyValuePair(Type type)
1739Type type = ItemValueType;
1927var type = value.GetType();
2035var type = value.GetType();
2110var type = value.GetType();
2181Type type = ItemValueType;
2285Type factoryType,
2286Type signatureType,
2299Type factoryType,
2300Type signatureType,
2314Type componentFactoryType;
2336public Type SignatureType { get; }
2340protected ComponentFactory(Type signatureType, string name, string[] settings)
2375public ComponentFactory(Type signatureType, string name, string[] settings)
2393public ComponentFactory(Type signatureType, string name, string[] settings)
2412public ComponentFactory(Type signatureType, string name, string[] settings)
2432public ComponentFactory(Type signatureType, string name, string[] settings)
ComponentModel\ComponentCatalog.cs (66)
79_signatures = new Dictionary<Type, bool>();
86_extensionsMap = new Dictionary<(Type AttributeType, string ContractName), Type>();
101public readonly Type Signature;
103public Key(string name, Type sig)
131public Type Type { get; }
137public Type LoaderType { get; }
139public IReadOnlyList<Type> SignatureTypes { get; }
196public Type ArgType { get; }
198private Type[] CtorTypes { get; }
225CtorTypes = attr.CtorTypes ?? Type.EmptyTypes;
312var ctor = ArgType.GetConstructor(Type.EmptyTypes);
334public readonly Type InputType;
335public readonly Type OutputType;
336public readonly Type[] InputKinds;
337public readonly Type[] OutputKinds;
361var outputType = method.ReturnType;
370private Type[] FindEntryPointKinds(Type type)
374var baseType = type.BaseType;
401public readonly Type ArgumentType;
402public readonly Type InterfaceType;
405internal ComponentInfo(Type interfaceType, string kind, Type argumentType, TlcModule.ComponentAttribute attribute)
448private readonly Dictionary<Type, bool> _signatures;
456private readonly Dictionary<(Type AttributeType, string ContractName), Type> _extensionsMap;
458private static bool TryGetIniters(Type instType, Type loaderType, Type[] parmTypes,
467var parmTypesWithEnv = Utils.Concat(new Type[1] { typeof(IHostEnvironment) }, parmTypes);
475if ((ctor = loaderType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, parmTypes ?? Type.EmptyTypes, null)) == null)
477if ((ctor = loaderType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, parmTypesWithEnv ?? Type.EmptyTypes, null)) != null)
482if ((create = FindCreateMethod(instType, loaderType, parmTypes ?? Type.EmptyTypes)) == null)
484if ((create = FindCreateMethod(instType, loaderType, parmTypesWithEnv ?? Type.EmptyTypes)) != null)
528foreach (var sigType in info.SignatureTypes)
564var type = info.LoaderType;
590foreach (var nestedType in type.GetTypeInfo().GetNestedTypes())
594private bool ScanForComponents(Type nestedType)
602foreach (var faceType in nestedType.GetInterfaces())
642private static MethodInfo FindInstanceGetter(Type instType, Type loaderType)
660private static MethodInfo FindCreateMethod(Type instType, Type loaderType, Type[] parmTypes)
662var meth = loaderType.GetMethod("Create", BindingFlags.Public | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy, null, parmTypes ?? Type.EmptyTypes, null);
731internal LoadableClassInfo[] GetAllDerivedClasses(Type typeBase, Type typeSig)
750internal Type[] GetAllSignatureTypes()
759internal static string SignatureToString(Type sig)
814internal LoadableClassInfo GetLoadableClassInfo(string loadName, Type signatureType)
850internal bool TryFindComponent(Type argumentType, out ComponentInfo component)
859internal bool TryFindComponent(Type interfaceType, Type argumentType, out ComponentInfo component)
870internal bool TryFindComponent(Type interfaceType, string alias, out ComponentInfo component)
880/// Akin to <see cref="TryFindComponent(Type, string, out ComponentInfo)"/>, except if the regular (case sensitive) comparison fails, it will
884internal bool TryFindComponentCaseInsensitive(Type interfaceType, string alias, out ComponentInfo component)
927internal IEnumerable<ComponentInfo> GetAllComponents(Type interfaceType)
934internal bool TryGetComponentKind(Type signatureType, out string kind)
946internal bool TryGetComponentShortName(Type type, out string name)
976internal static TRes CreateInstance<TRes>(IHostEnvironment env, Type signatureType, string name, string options, params object[] extra)
997internal static bool TryCreateInstance<TRes>(IHostEnvironment env, Type signatureType, out TRes result, string name, string options, params object[] extra)
1081foreach (Type type in assembly.GetTypes())
1088if (_extensionsMap.TryGetValue(key, out var existingType))
1129internal object GetExtensionValue(IHostEnvironment env, Type attributeType, string contractName)
1132if (_extensionsMap.TryGetValue((attributeType, contractName), out Type extensionType))
ComponentModel\LoadableClassAttribute.cs (42)
32public LoadableClassAttribute(Type instType, Type argType, Type sigType, string userName, params string[] loadNames)
47public LoadableClassAttribute(Type instType, Type loaderType, Type argType, Type sigType, string userName, params string[] loadNames)
52public LoadableClassAttribute(Type instType, Type argType, Type[] sigTypes, string userName, params string[] loadNames)
57public LoadableClassAttribute(Type instType, Type loaderType, Type argType, Type[] sigTypes, string userName, params string[] loadNames)
72public LoadableClassAttribute(string summary, Type instType, Type argType, Type sigType, string userName, params string[] loadNames)
88public LoadableClassAttribute(string summary, Type instType, Type loaderType, Type argType, Type sigType, string userName, params string[] loadNames)
93public LoadableClassAttribute(string summary, Type instType, Type argType, Type[] sigTypes, string userName, params string[] loadNames)
98public LoadableClassAttribute(string summary, Type instType, Type loaderType, Type argType, Type[] sigTypes, string userName, params string[] loadNames)
113public Type InstanceType { get; private set; }
120public Type LoaderType { get; private set; }
125public Type ArgType { get; private set; }
131public Type[] SigTypes { get; private set; }
136public Type[] CtorTypes { get; private set; }
161protected LoadableClassAttributeBase(string summary, Type instType, Type loaderType, Type argType, Type[] sigTypes, string userName, params string[] loadNames)
174var sigType = sigTypes[0];
176Type[] types;
188types = new Type[1 + parms.Length];
192types = new Type[parms.Length];
194types = Type.EmptyTypes;
Utilities\Utils.cs (62)
961private static MethodInfo MarshalInvokeCheckAndCreate<TRet>(Type genArg, Delegate func)
991public static TResult MarshalInvoke<TTarget, TResult>(FuncInstanceMethodInfo1<TTarget, TResult> func, TTarget target, Type genArg)
999/// A static version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1001public static TResult MarshalInvoke<TResult>(FuncStaticMethodInfo1<TResult> func, Type genArg)
1008/// A one-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1010public static TResult MarshalInvoke<TTarget, TArg1, TResult>(FuncInstanceMethodInfo1<TTarget, TArg1, TResult> func, TTarget target, Type genArg, TArg1 arg1)
1018/// A one-argument version of <see cref="MarshalInvoke{TResult}(FuncStaticMethodInfo1{TResult}, Type)"/>.
1020public static TResult MarshalInvoke<TArg1, TResult>(FuncStaticMethodInfo1<TArg1, TResult> func, Type genArg, TArg1 arg1)
1027/// A one-argument, three-type-parameter version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1029public static TResult MarshalInvoke<TTarget, TArg1, TResult>(FuncInstanceMethodInfo3<TTarget, TArg1, TResult> func, TTarget target, Type genArg1, Type genArg2, Type genArg3, TArg1 arg1)
1037/// A one-argument, three-type-parameter version of <see cref="MarshalInvoke{TResult}(FuncStaticMethodInfo1{TResult}, Type)"/>.
1039public static TResult MarshalInvoke<TArg1, TResult>(FuncStaticMethodInfo3<TArg1, TResult> func, Type genArg1, Type genArg2, Type genArg3, TArg1 arg1)
1046/// A two-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1048public static TResult MarshalInvoke<TTarget, TArg1, TArg2, TResult>(FuncInstanceMethodInfo1<TTarget, TArg1, TArg2, TResult> func, TTarget target, Type genArg, TArg1 arg1, TArg2 arg2)
1056/// A two-argument version of <see cref="MarshalInvoke{TResult}(FuncStaticMethodInfo1{TResult}, Type)"/>.
1058public static TResult MarshalInvoke<TArg1, TArg2, TResult>(FuncStaticMethodInfo1<TArg1, TArg2, TResult> func, Type genArg, TArg1 arg1, TArg2 arg2)
1065/// A two-argument, two-type-parameter version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1067public static TResult MarshalInvoke<TTarget, TArg1, TArg2, TResult>(FuncInstanceMethodInfo2<TTarget, TArg1, TArg2, TResult> func, TTarget target, Type genArg1, Type genArg2, TArg1 arg1, TArg2 arg2)
1075/// A two-argument, two-type-parameter version of <see cref="MarshalInvoke{TResult}(FuncStaticMethodInfo1{TResult}, Type)"/>.
1077public static TResult MarshalInvoke<TArg1, TArg2, TResult>(FuncStaticMethodInfo2<TArg1, TArg2, TResult> func, Type genArg1, Type genArg2, TArg1 arg1, TArg2 arg2)
1084/// A two-argument, three-type-parameter version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1086public static TResult MarshalInvoke<TTarget, TArg1, TArg2, TResult>(FuncInstanceMethodInfo3<TTarget, TArg1, TArg2, TResult> func, TTarget target, Type genArg1, Type genArg2, Type genArg3, TArg1 arg1, TArg2 arg2)
1094/// A two-argument, three-type-parameter version of <see cref="MarshalInvoke{TResult}(FuncStaticMethodInfo1{TResult}, Type)"/>.
1096public static TResult MarshalInvoke<TArg1, TArg2, TResult>(FuncStaticMethodInfo3<TArg1, TArg2, TResult> func, Type genArg1, Type genArg2, Type genArg3, TArg1 arg1, TArg2 arg2)
1103/// A three-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1105public static TRet MarshalInvoke<TArg1, TArg2, TArg3, TRet>(Func<TArg1, TArg2, TArg3, TRet> func, Type genArg,
1113/// A four-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1116Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4)
1123/// A five-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1126Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5)
1133/// A six-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1136Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6)
1143/// A seven-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1146Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7)
1153/// An eight-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1156Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7, TArg8 arg8)
1163/// A nine-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1167Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7, TArg8 arg8, TArg9 arg9)
1174/// A ten-argument version of <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>.
1178Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4, TArg5 arg5, TArg6 arg6, TArg7 arg7, TArg8 arg8, TArg9 arg9, TArg10 arg10)
1184private static MethodInfo MarshalActionInvokeCheckAndCreate(Type genArg, Delegate func)
1197/// This is akin to <see cref="MarshalInvoke{TTarget, TResult}(FuncInstanceMethodInfo1{TTarget, TResult}, TTarget, Type)"/>, except applied to
1204public static void MarshalActionInvoke(Action act, Type genArg)
1211/// A one-argument version of <see cref="MarshalActionInvoke(Action, Type)"/>.
1213public static void MarshalActionInvoke<TArg1>(Action<TArg1> act, Type genArg, TArg1 arg1)
1220/// A two-argument version of <see cref="MarshalActionInvoke(Action, Type)"/>.
1222public static void MarshalActionInvoke<TArg1, TArg2>(Action<TArg1, TArg2> act, Type genArg, TArg1 arg1, TArg2 arg2)
1229/// A three-argument version of <see cref="MarshalActionInvoke(Action, Type)"/>.
1231public static void MarshalActionInvoke<TArg1, TArg2, TArg3>(Action<TArg1, TArg2, TArg3> act, Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3)
1238/// A four-argument version of <see cref="MarshalActionInvoke(Action, Type)"/>.
1240public static void MarshalActionInvoke<TArg1, TArg2, TArg3, TArg4>(Action<TArg1, TArg2, TArg3, TArg4> act, Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4)
1248Type type = value.GetType();
Microsoft.ML.Core.Tests (2)
Microsoft.ML.Data (199)
Data\Conversion.cs (20)
78private readonly Dictionary<(Type src, Type dst), Delegate> _delegatesStd;
82private readonly Dictionary<(Type src, Type dst), Delegate> _delegatesAll;
85private readonly Dictionary<Type, Delegate> _isNADelegates;
88private readonly Dictionary<Type, Delegate> _hasNADelegates;
91private readonly Dictionary<Type, Delegate> _isDefaultDelegates;
95private readonly Dictionary<Type, Delegate> _hasZeroDelegates;
98private readonly Dictionary<Type, Delegate> _getNADelegates;
101private readonly Dictionary<Type, Delegate> _tryParseDelegates;
105_delegatesStd = new Dictionary<(Type src, Type dst), Delegate>();
106_delegatesAll = new Dictionary<(Type src, Type dst), Delegate>();
107_isNADelegates = new Dictionary<Type, Delegate>();
108_hasNADelegates = new Dictionary<Type, Delegate>();
109_isDefaultDelegates = new Dictionary<Type, Delegate>();
110_hasZeroDelegates = new Dictionary<Type, Delegate>();
111_getNADelegates = new Dictionary<Type, Delegate>();
112_tryParseDelegates = new Dictionary<Type, Delegate>();
DataView\InternalSchemaDefinition.cs (13)
31public Type ComputedReturnType { get { return ReturnParameterInfo.ParameterType.GetElementType(); } }
32public Type FieldOrPropertyType => (MemberInfo is FieldInfo) ? (MemberInfo as FieldInfo).FieldType : (MemberInfo as PropertyInfo).PropertyType;
33public Type OutputType => IsComputed ? ComputedReturnType : FieldOrPropertyType;
122GetVectorAndItemType("return type", ComputedReturnType, null, out bool isVector, out Type itemType);
144public static void GetVectorAndItemType(MemberInfo memberInfo, out bool isVector, out Type itemType)
163public static void GetMappedType(Type rawType, out Type itemType, out bool isVector)
194public static void GetVectorAndItemType(string name, Type rawType, IEnumerable<Attribute> attributes, out bool isVector, out Type itemType)
205public static InternalSchemaDefinition Create(Type userType, SchemaDefinition.Direction direction)
211public static InternalSchemaDefinition Create(Type userType, SchemaDefinition userSchemaDefinition)
228Type dataItemType;
253var parameterType = col.ReturnType;
EntryPoints\EntryPointNode.cs (15)
30public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
35public override bool CanConvert(Type objectType)
68public static bool CheckType(Type type)
162public readonly Type Type;
179public static bool IsValidType(Type variableType)
216public EntryPointVariable(IExceptionContext ectx, string name, Type type)
290public void AddInputVariable(VariableBinding binding, Type type)
320public Boolean AddOutputVariable(string name, Type type)
389Type type = typeof(T);
522private void SetColumnArgument(IChannel ch, object inputInstance, string argName, string colName, string columnRole, params Type[] inputKinds)
542var colFieldType = _inputBuilder.GetFieldTypeOrNull(colField);
627Type valueType = _inputBuilder.GetFieldTypeOrNull(pair.Key);
649Type valueType = _inputBuilder.GetFieldTypeOrNull(pair.Key);
692var valueType = _outputHelper.GetFieldType(pair.Key);
863var type = _inputBuilder.GetFieldTypeOrNull(firstBinding.ParameterName).GetElementType();
EntryPoints\InputBuilder.cs (17)
48private readonly Type _type;
55public InputBuilder(IExceptionContext ectx, Type inputType, ComponentCatalog catalog)
119public Type GetFieldTypeOrNull(string alias)
127var type = _fields[fi].FieldType;
276var type = instanceVal.GetType();
316var elementType = type.GetElementType();
356var deftype = defaultsVal.GetType();
391private static bool ExtractOptional(ref object value, ref Type type)
400private static object ParseJsonValue(IExceptionContext ectx, Type type, Attributes attributes, JToken value, ComponentCatalog catalog)
532private static object GetFieldAssignableValue(IExceptionContext ectx, Type type, object value)
544private static IComponentFactory GetComponentJson(IExceptionContext ectx, Type signatureType, string name, JObject settings, ComponentCatalog catalog)
614private static object MakeOptionalIfNeeded(IExceptionContext ectx, object innerValue, Type outerType)
623var genericType = outerType.GetGenericTypeDefinition();
659private readonly Type _type;
664public OutputHelper(IExceptionContext ectx, Type outputType)
702public Type GetFieldType(string name)
707var type = fi?.FieldType;
Utilities\ComponentCreation.cs (10)
99Type factoryType = typeof(IComponentFactory<IMultiStreamSource, ILegacyDataLoader>);
140Type factoryType = typeof(IComponentFactory<IDataView, IDataTransform>);
163Type factoryType = typeof(IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform>);
164Type signatureType = typeof(SignatureDataScorer);
230Type signatureType,
240Type signatureType,
251Type factoryType,
252Type signatureType,
271Type factoryType,
272Type signatureType,
Utils\ApiUtils.cs (9)
34private static OpCode GetAssignmentOpCode(Type t, IEnumerable<Attribute> attributes)
73Type fieldType = fieldInfo.FieldType;
78Type propertyType = propertyInfo.PropertyType;
92Type[] args = { typeof(TOwn), typeof(TRow), typeof(long), typeof(TValue).MakeByRefType() };
112Type[] args = { typeof(TOwn), typeof(TRow), typeof(long), typeof(TValue).MakeByRefType() };
141Type fieldType = fieldInfo.FieldType;
146Type propertyType = propertyInfo.PropertyType;
158Type[] args = { typeof(TOwn), typeof(TRow), typeof(TValue) };
176Type[] args = { typeof(TOwn), typeof(TRow), typeof(TValue) };
Microsoft.ML.DataView (19)
Utils.cs (5)
13public static void MarshalActionInvoke<TArg1>(Action<TArg1> act, Type genArg, TArg1 arg1)
19public static void MarshalActionInvoke<TArg1, TArg2, TArg3, TArg4>(Action<TArg1, TArg2, TArg3, TArg4> act, Type genArg, TArg1 arg1, TArg2 arg2, TArg3 arg3, TArg4 arg4)
25public static TRet MarshalInvoke<TArg1, TArg2, TRet>(Func<TArg1, TArg2, TRet> func, Type genArg, TArg1 arg1, TArg2 arg2)
31private static MethodInfo MarshalInvokeCheckAndCreate<TRet>(Type genArg, Delegate func)
38private static MethodInfo MarshalActionInvokeCheckAndCreate(Type genArg, Delegate func)
Microsoft.ML.Ensemble (1)
Microsoft.ML.EntryPoints (12)
JsonUtils\JsonManifestUtils.cs (12)
51var kinds = new List<Type>();
60foreach (var epKind in kinds.Distinct().OrderBy(k => k.Name))
71var type = ExtractOptionalOrNullableType(fieldInfo.PropertyType);
90private static Type ExtractOptionalOrNullableType(Type type)
133foreach (var kind in entryPointInfo.InputKinds)
141foreach (var kind in entryPointInfo.OutputKinds)
148private static JArray BuildInputManifest(IExceptionContext ectx, Type inputType, ComponentCatalog catalog)
279private static JArray BuildOutputManifest(IExceptionContext ectx, Type outputType, ComponentCatalog catalog)
307private static JToken BuildTypeToken(IExceptionContext ectx, FieldInfo fieldInfo, Type type, ComponentCatalog catalog)
393private static JToken BuildValueToken(IExceptionContext ectx, object value, Type valueType, ComponentCatalog catalog)
458var type = value.GetType();
Microsoft.ML.FastTree (8)
Microsoft.ML.GenAI.Core (1)
Microsoft.ML.IntegrationTests (4)
Microsoft.ML.LightGbm (1)
Microsoft.ML.Maml (2)
Microsoft.ML.OnnxConverter (8)
Microsoft.ML.OnnxTransformer (64)
Microsoft.ML.Parquet (2)
Microsoft.ML.Predictor.Tests (1)
Microsoft.ML.Recommender (1)
Microsoft.ML.Samples (1)
Microsoft.ML.Samples.GPU (1)
Microsoft.ML.SearchSpace (14)
SearchSpace.cs (7)
66protected SearchSpace(Type typeInfo, Parameter defaultOption = null)
172private Dictionary<string, OptionBase> GetOptionsFromType(Type typeInfo)
180private SearchSpace GetSearchSpaceOptionFromType(Type typeInfo)
193private Dictionary<string, OptionBase> GetOptionsFromField(Type typeInfo)
240private Dictionary<string, OptionBase> GetOptionsFromProperty(Type typeInfo)
287private void CheckOptionType(object attribute, string optionName, Type type)
303var supportTypes = new Type[] { typeof(string), typeof(int), typeof(short), typeof(long), typeof(float), typeof(double), typeof(char) };
Microsoft.ML.SearchSpace.Tests (2)
Microsoft.ML.StandardTrainers (1)
Microsoft.ML.Sweeper (1)
Microsoft.ML.TensorFlow (1)
Microsoft.ML.TensorFlow.Tests (1)
Microsoft.ML.TestFramework (4)
Microsoft.ML.Tests (5)
Microsoft.ML.Tokenizers (15)
Model\TiktokenTokenizer.cs (11)
1116private static (Dictionary<string, int> SpecialTokens, Regex Regex, string VocabFile, Type? DataType, string PackageName) GetTiktokenConfigurations(string modelName) => GetTiktokenConfigurations(GetModelEncoding(modelName), modelName);
1118private static (Dictionary<string, int> SpecialTokens, Regex Regex, string VocabFile, Type? DataType, string PackageName) GetTiktokenConfigurations(ModelEncoding modelEncoding, string? modelName = null)
1124{ { EndOfText, 100257}, { FimPrefix, 100258}, { FimMiddle, 100259}, { FimSuffix, 100260}, { EndOfPrompt, 100276} }, Cl100kBaseRegex(), Cl100kBaseVocabFile, Type.GetType(Cl100kBaseTypeName), Cl100kBasePackageName);
1127return (new Dictionary<string, int> { { EndOfText, 50256 }, }, P50kBaseRegex(), GPT2File, Type.GetType(Gpt2TypeName), Gpt2PackageName);
1130return (new Dictionary<string, int> { { EndOfText, 199999 }, { EndOfPrompt, 200018 } }, O200kBaseRegex(), O200kBaseFile, Type.GetType(O200kBaseTypeName), O200kBasePackageName);
1133return (new Dictionary<string, int> { { EndOfText, 50256 } }, P50kBaseRegex(), P50RanksFile, Type.GetType(P50kBaseTypeName), P50kBasePackageName);
1137{ { EndOfText, 50256 }, { FimPrefix, 50281 }, { FimMiddle, 50282 }, { FimSuffix, 50283 } }, P50kBaseRegex(), P50RanksFile, Type.GetType(P50kBaseTypeName), P50kBasePackageName);
1140return (new Dictionary<string, int> { { EndOfText, 50256 } }, P50kBaseRegex(), R50RanksFile, Type.GetType(R50kBaseTypeName), R50kBasePackageName);
1209(Dictionary<string, int> SpecialTokens, Regex Regex, string VocabFile, Type? DataType, string PackageName) tiktokenConfiguration = GetTiktokenConfigurations(modelEncoding, modelName);
1369(Dictionary<string, int> SpecialTokens, Regex Regex, string _, Type? __, string ___) tiktokenConfiguration = GetTiktokenConfigurations(modelName);
1409(Dictionary<string, int> SpecialTokens, Regex Regex, string _, Type? __, string ___) tiktokenConfiguration = GetTiktokenConfigurations(modelName);
Microsoft.ML.TorchSharp (2)
Microsoft.ML.Transforms (34)
Microsoft.TestUtilities (1)
Microsoft.VisualBasic.Core (331)
Microsoft\VisualBasic\CompilerServices\Conversions.vb (19)
2332Dim ReflectedType As Type = GetType(T)
2371Private Shared Function CastSByteEnum(ByVal Expression As SByte, ByVal TargetType As Type) As Object
2376Private Shared Function CastByteEnum(ByVal Expression As Byte, ByVal TargetType As Type) As Object
2381Private Shared Function CastInt16Enum(ByVal Expression As Int16, ByVal TargetType As Type) As Object
2386Private Shared Function CastUInt16Enum(ByVal Expression As UInt16, ByVal TargetType As Type) As Object
2391Private Shared Function CastInt32Enum(ByVal Expression As Int32, ByVal TargetType As Type) As Object
2396Private Shared Function CastUInt32Enum(ByVal Expression As UInt32, ByVal TargetType As Type) As Object
2401Private Shared Function CastInt64Enum(ByVal Expression As Int64, ByVal TargetType As Type) As Object
2406Private Shared Function CastUInt64Enum(ByVal Expression As UInt64, ByVal TargetType As Type) As Object
2411Friend Shared Function ForceValueCopy(ByVal Expression As Object, ByVal TargetType As Type) As Object
2453Private Shared Function ChangeIntrinsicType(ByVal Expression As Object, ByVal TargetType As Type) As Object
2491ByVal TargetType As Type) As Object
2499ByVal TargetType As Type,
2516Dim SourceType As Type = Expression.GetType
2568ByVal TargetType As Type) As Object
2579ByVal TargetType As Type) As Object
2581Dim SourceType As Type = Expression.GetType
2674Friend Shared Function CanUserDefinedConvert(ByVal Expression As Object, ByVal TargetType As Type) As Boolean
2676Dim SourceType As Type = Expression.GetType
Microsoft\VisualBasic\CompilerServices\NewLateBinding.vb (15)
368ByVal TypeArguments As Type(),
418ByVal typeArguments As Type(),
823ByVal Type As Type,
827ByVal TypeArguments() As Type,
862ByVal type As Type,
866ByVal typeArguments() As Type,
878ByVal Type As Type,
882ByVal TypeArguments As Type())
909ByVal type As Type,
913ByVal typeArguments As Type())
925ByVal Type As Type,
929ByVal TypeArguments As Type(),
1270Dim customModifierTypes As Type() = method?.ReturnParameter.GetRequiredCustomModifiers()
1272For Each customModifierType As Type In customModifierTypes
1288ByVal typeArguments As Type(),
Microsoft\VisualBasic\CompilerServices\Operators.vb (34)
54Private Shared Function GetEnumResult(ByVal left As Object, ByVal right As Object) As Type
68Dim leftType As Type = left.GetType
1192Private Shared Function NotSByte(ByVal operand As SByte, ByVal operandType As Type) As Object
1201Private Shared Function NotByte(ByVal operand As Byte, ByVal operandType As Type) As Object
1210Private Shared Function NotInt16(ByVal operand As Int16, ByVal operandType As Type) As Object
1219Private Shared Function NotUInt16(ByVal operand As UInt16, ByVal operandType As Type) As Object
1228Private Shared Function NotInt32(ByVal operand As Int32, ByVal operandType As Type) As Object
1237Private Shared Function NotUInt32(ByVal operand As UInt32, ByVal operandType As Type) As Object
1250Private Shared Function NotInt64(ByVal operand As Int64, ByVal operandType As Type) As Object
1259Private Shared Function NotUInt64(ByVal operand As UInt64, ByVal operandType As Type) As Object
1592Private Shared Function AndSByte(ByVal left As SByte, ByVal right As SByte, Optional ByVal enumType As Type = Nothing) As Object
1599Private Shared Function AndByte(ByVal left As Byte, ByVal right As Byte, Optional ByVal enumType As Type = Nothing) As Object
1606Private Shared Function AndInt16(ByVal left As Int16, ByVal right As Int16, Optional ByVal enumType As Type = Nothing) As Object
1613Private Shared Function AndUInt16(ByVal left As UInt16, ByVal right As UInt16, Optional ByVal enumType As Type = Nothing) As Object
1620Private Shared Function AndInt32(ByVal left As Int32, ByVal right As Int32, Optional ByVal enumType As Type = Nothing) As Object
1627Private Shared Function AndUInt32(ByVal left As UInt32, ByVal right As UInt32, Optional ByVal enumType As Type = Nothing) As Object
1634Private Shared Function AndInt64(ByVal left As Int64, ByVal right As Int64, Optional ByVal enumType As Type = Nothing) As Object
1641Private Shared Function AndUInt64(ByVal left As UInt64, ByVal right As UInt64, Optional ByVal enumType As Type = Nothing) As Object
1964Private Shared Function OrSByte(ByVal left As SByte, ByVal right As SByte, Optional ByVal enumType As Type = Nothing) As Object
1971Private Shared Function OrByte(ByVal left As Byte, ByVal right As Byte, Optional ByVal enumType As Type = Nothing) As Object
1978Private Shared Function OrInt16(ByVal left As Int16, ByVal right As Int16, Optional ByVal enumType As Type = Nothing) As Object
1985Private Shared Function OrUInt16(ByVal left As UInt16, ByVal right As UInt16, Optional ByVal enumType As Type = Nothing) As Object
1992Private Shared Function OrInt32(ByVal left As Int32, ByVal right As Int32, Optional ByVal enumType As Type = Nothing) As Object
1999Private Shared Function OrUInt32(ByVal left As UInt32, ByVal right As UInt32, Optional ByVal enumType As Type = Nothing) As Object
2006Private Shared Function OrInt64(ByVal left As Int64, ByVal right As Int64, Optional ByVal enumType As Type = Nothing) As Object
2013Private Shared Function OrUInt64(ByVal left As UInt64, ByVal right As UInt64, Optional ByVal enumType As Type = Nothing) As Object
2357Private Shared Function XorSByte(ByVal left As SByte, ByVal right As SByte, Optional ByVal enumType As Type = Nothing) As Object
2364Private Shared Function XorByte(ByVal left As Byte, ByVal right As Byte, Optional ByVal enumType As Type = Nothing) As Object
2371Private Shared Function XorInt16(ByVal left As Int16, ByVal right As Int16, Optional ByVal enumType As Type = Nothing) As Object
2378Private Shared Function XorUInt16(ByVal left As UInt16, ByVal right As UInt16, Optional ByVal enumType As Type = Nothing) As Object
2385Private Shared Function XorInt32(ByVal left As Int32, ByVal right As Int32, Optional ByVal enumType As Type = Nothing) As Object
2392Private Shared Function XorUInt32(ByVal left As UInt32, ByVal right As UInt32, Optional ByVal enumType As Type = Nothing) As Object
2399Private Shared Function XorInt64(ByVal left As Int64, ByVal right As Int64, Optional ByVal enumType As Type = Nothing) As Object
2406Private Shared Function XorUInt64(ByVal left As UInt64, ByVal right As UInt64, Optional ByVal enumType As Type = Nothing) As Object
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (65)
67Dim type1 As Type = shorterSignature(i).ParameterType
68Dim type2 As Type = longerSignature(i).ParameterType
90ByVal leftType As Type,
91ByVal rightType As Type,
121ByVal argumentType As Type,
134Dim leftType As Type = leftParameter.ParameterType
135Dim rightType As Type = rightParameter.ParameterType
235Dim leftType As Type = leftParameter.ParameterType
236Dim rightType As Type = rightParameter.ParameterType
240Dim rawLeftType As Type = rawLeftParameter.ParameterType
241Dim rawRightType As Type = rawRightParameter.ParameterType
303Dim leftType As Type = leftParameter.ParameterType
304Dim rightType As Type = rightParameter.ParameterType
308Dim rawLeftType As Type = rawLeftParameter.ParameterType
309Dim rawRightType As Type = rawRightParameter.ParameterType
342Dim leftDeclaringType As Type = leftMember.RawDeclaringType
343Dim rightDeclaringType As Type = rightMember.RawDeclaringType
486ByVal typeArguments As Type(),
718ByVal typeArguments As Type(),
745Dim currentScope As Type = members(index).DeclaringType
927ByVal targetType As Type,
928ByVal sourceType As Type,
985ByVal argumentType As Type,
986ByVal parameterType As Type,
987ByVal typeInferenceArguments As Type(),
1014Dim rawGenericParameterType As Type = parameterType.GetGenericTypeDefinition
1031GetType(System.Collections.Generic.IList(Of )).MakeGenericType(New Type() {argumentType.GetElementType})
1057Dim base As Type = argumentType.BaseType
1073Dim implementedMatch As Type = Nothing
1074For Each implemented As Type In argumentType.GetInterfaces
1110ByVal argumentType As Type,
1111ByVal parameterType As Type,
1112ByVal typeInferenceArguments As Type(),
1145Dim bestMatchType As Type = Nothing
1153For Each possibleGenericType As Type In argumentType.GetInterfaces
1168Dim parameterTypeParameters As Type() = GetTypeArguments(parameterType)
1169Dim argumentTypeArguments As Type() = GetTypeArguments(bestMatchType)
1224Dim parameterType As Type = parameter.ParameterType
1225Dim argumentType As Type = GetArgumentType(argument)
1244Dim parameterType As Type = parameter.ParameterType
1250Dim argumentType As Type = GetArgumentType(argument)
1312Dim parameterType As Type = parameter.ParameterType
1318Dim argumentType As Type = GetArgumentType(argument)
1341ByVal parameterType As Type) As Object
1371Dim argumentType As Type = GetArgumentType(argument)
1412ByVal typeArguments As Type(),
1433typeArguments = New Type(targetProcedure.TypeParameters.Length - 1) {}
1668ByVal typeArguments As Type(),
1850ByVal typeArguments As Type(),
2059ByVal typeArguments As Type(),
2111ByVal typeArguments As Type())
2131Private Shared Function GetArgumentType(ByVal argument As Object) As Type
2169Dim argumentType As Type = GetArgumentType(arguments(argIndex))
2240Dim argumentType As Type = GetArgumentType(arguments(argIndex))
2459ByVal substitution2 As Type,
2460ByVal substitution3 As Type)
2507ByVal typeArguments As Type(),
2517ByVal typeArguments As Type(),
2586ByVal typeArguments As Type(),
2608ByVal typeArguments As Type(),
2628ByVal typeArguments As Type(),
2650ByVal typeArguments As Type(),
2669ByVal typeArguments As Type(),
2703ByVal typeArguments As Type(),
2803ByVal typeArguments As Type(),
Microsoft\VisualBasic\CompilerServices\Utils.vb (15)
124Public Function GetTypeCode(type As Type) As TypeCode
125Return Type.GetTypeCode(type)
236Private Function IsGenericallyEqual(t1 As Type, t2 As Type) As Boolean
247Dim t1def As Type = If(t1.IsConstructedGenericType, t1.GetGenericTypeDefinition(), t1)
248Dim t2def As Type = If(t2.IsConstructedGenericType, t2.GetGenericTypeDefinition(), t2)
259Private Function IsGenericallyEquivalentTo(t1 As Type, t2 As Type, member1 As MemberInfo, member2 As MemberInfo) As Boolean
295Dim args1 As Type() = t1.GetGenericArguments()
296Dim args2 As Type() = t2.GetGenericArguments()
321Private Function IsTypeParameterEquivalentToTypeInst(typeParam As Type, typeInst As Type, member As MemberInfo) As Boolean
334Dim args As Type() = If(method.IsGenericMethod, method.GetGenericArguments(), Nothing)
350Dim MemberInfo As Type = GetType(MethodBase)
351Dim [property] As PropertyInfo = MemberInfo.GetProperty("MetadataToken", GetType(Integer), Array.Empty(Of Type)())
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (21)
156Dim ArgTypes() As Type
157Dim ArgType As Type = Nothing
158Dim ParmType As Type = Nothing
159Dim ParamArrayElementType As Type = Nothing
524ArgTypes = New Type(args.Length - 1) {}
609If (ArgType Is Type.Missing) AndAlso Parameters(ParmIndex).IsOptional Then
826If (ArgType Is Type.Missing) AndAlso Parameters(ParmIndex).IsOptional Then
1260Dim Type0, Type1 As Type
1265Dim ParamArrayElementType0 As Type = Nothing
1266Dim ParamArrayElementType1 As Type = Nothing
1480Dim paramType0, paramType1 As Type
1526Dim paramType1, paramType2 As Type
1593Public Overrides Function SelectMethod(ByVal bindingAttr As BindingFlags, ByVal match() As MethodBase, ByVal types() As Type, ByVal modifiers() As ParameterModifier) As MethodBase
1600Public Overrides Function SelectProperty(ByVal bindingAttr As BindingFlags, ByVal match() As PropertyInfo, ByVal returnType As Type, ByVal indexes() As Type, ByVal modifiers() As ParameterModifier) As PropertyInfo
1608Dim Type0, Type1 As Type
1756Public Overrides Function ChangeType(ByVal value As Object, ByVal typ As Type, ByVal culture As CultureInfo) As Object
1769Private Function BindingScore(ByVal Parameters() As ParameterInfo, ByVal paramOrder() As Integer, ByVal ArgTypes() As Type, ByVal IsPropertySet As Boolean, ByVal ParamArrayIndex As Integer) As BindScore
1772Dim ArgType, ParmType As Type
2036Private Function GetDefaultMemberName(ByVal typ As Type) As String
2255Friend Shared Sub SecurityCheckForLateboundCalls(ByVal member As MemberInfo, ByVal objType As Type, ByVal objIReflect As IReflect)
Microsoft.VisualBasic.Tests (2)
Microsoft.VisualStudio.LanguageServices (34)
Microsoft.VisualStudio.LanguageServices.CSharp (3)
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (2)
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Microsoft.Win32.Registry (3)
MockHostTypes (1)
MSBuild (46)
TypeLoader.cs (19)
34private static ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> s_cacheOfLoadedTypesByFilter = new ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>>();
39private static ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> s_cacheOfReflectionOnlyLoadedTypesByFilter = new ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>>();
44private Func<Type, object, bool> _isDesiredType;
68internal TypeLoader(Func<Type, object, bool> isDesiredType)
241private LoadedType GetLoadedType(ConcurrentDictionary<Func<Type, object, bool>, ConcurrentDictionary<AssemblyLoadInfo, AssemblyInfoToLoadedTypes>> cache, string typeName, AssemblyLoadInfo assembly, bool useTaskHost)
273private Func<Type, object, bool> _isDesiredType;
283private ConcurrentDictionary<string, Type> _typeNameToType;
288private Dictionary<string, Type> _publicTypeNameToType;
307internal AssemblyInfoToLoadedTypes(Func<Type, object, bool> typeFilter, AssemblyLoadInfo loadInfo)
315_publicTypeNameToType = new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
332Type type = _typeNameToType.GetOrAdd(typeName, (key) =>
339Type t2 = Type.GetType(typeName + "," + _assemblyLoadInfo.AssemblyName, false /* don't throw on error */, true /* case-insensitive */);
365foreach (KeyValuePair<string, Type> desiredTypeInAssembly in _publicTypeNameToType)
387foreach (Type publicType in loadedAssembly.GetExportedTypes())
417Type[] allPublicTypesInAssembly = _loadedAssembly.GetExportedTypes();
418foreach (Type publicType in allPublicTypesInAssembly)
MSBuildTaskHost (40)
mscorlib (1)
Mvc.Api.Analyzers.Test (11)
Mvc.RoutingWebSite (3)
netstandard (1)
PresentationBuildTasks (403)
MS\Internal\MarkupCompiler\MarkupCompiler.cs (28)
1041Type eventTarget;
1779private CodeExpression GetPropertyValueExpression(ITypeDescriptorContext ctx, Type typeToConvertTo, Object value, string attributeValue)
1889private Type GetEventHandlerType(MemberInfo memberInfo)
1891Type eventHandlerType = null;
1924Type eventTarget = cc != null ? cc.ElementType : miEvent.DeclaringType;
1932Type eventHandlerType = GetEventHandlerType(miEvent);
1969private CodeStatement AddCLREvent(Type eventTarget, CodeContext cc, CodeExpression ce, MarkupEventInfo mei)
2032Type eventHandlerType = GetEventHandlerType(mei.mi);
2177Type resourceDictionary = KnownTypes.Types[(int)KnownElements.ResourceDictionary];
2178Type iNameScope = KnownTypes.Types[(int)KnownElements.INameScope];
2182Type t = ((CodeContext)contexts[i]).ElementType;
2252Type currTypeArg = parserContext.XamlTypeMapper.GetTypeArgsType(_typeArgsList[i].Trim(),
2294private static CodeTypeReference GenerateConstructedTypeReference(Type t, string [] typeArgsList, string genericName)
2339private static CodeTypeReference GenerateConstructedTypeReference(Type t, string [] typeArgsList, Type refType, string refTypeFullName, string eventName)
2346Type[] refTypeParams = null;
2348Type[] typeParams = t.GetGenericArguments();
2365foreach (Type typeParam in typeParams)
2446private CodeTypeDeclaration GenerateClass(string className, ref string modifier, Type baseClass, string baseClassFullName)
2490private CodeContext GenerateSubClass(ref string className, ref string modifier, Type baseClass, string baseClassFullName)
2565CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression(typeof(Type), DELEGATETYPE);
2758CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression(typeof(Type), TYPE);
2857param1 = new CodeParameterDeclarationExpression(typeof(Type), DELEGATETYPE);
2962internal string StartElement(ref string className, string subClassFullName, ref string modifier, Type elementType, string baseClassFullName)
3333internal CodeContext(Type elementType, string [] typeArgsList, string localElementFullName)
3340internal Type ElementType
3382private Type _elementType = null;
3392Type elementType,
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlMapTable.cs (28)
94internal static Type GetKnownTypeFromId(short id)
123Type probeType = KnownTypes.Types[probe];
158internal static short GetKnownTypeIdFromType(Type type)
280internal Type GetKnownConverterTypeFromType(Type type)
301if (type == typeof(System.Type))
326private static Type GetKnownConverterTypeFromPropName(
327Type propOwnerType,
953internal short GetAttributeOrTypeId(BinaryWriter binaryWriter, Type declaringType, string memberName, out short typeId)
1207Type elementType,
1291Type owningType, // Actual type of the object the owns or declares this attribute
1293Type attributeType, // Type of the attribute or property itself; not its owner type
1304Type owningType, // Actual type of the object the owns or declares this attribute
1306Type attributeType, // Type of the attribute or property itself; not its owner type
1318Type serializerType = XamlTypeMapper.GetXamlSerializerForType(owningType);
1369Type ownerType, // Type of object that owns or declares this attribute
1370Type attributeType, // Type of the attribute or property itself; not its owner type
1374out Type converterOrSerializerType)
1485Type defaultTargetType)
1488Type targetType = null;
1534Type declaringType, // Type of object that owns or declares this attribute
1535Type attributeType) // Type of the attribute or property itself; not its owner type
1553private Type GetCustomConverter(
1555Type ownerType, // Type of object that owns or declares this attribute
1557Type attributeType) // Type of the attribute or property itself; not its owner type
1560Type converterType = GetKnownConverterTypeFromPropName(ownerType, fieldName);
1594private Type GetCustomSerializer(
1595Type type,
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\MarkupExtensionParser.cs (25)
36ref Type baseType,
37ref Type serializerType);
64Type declaringType, // Type where propIdName is declared
89Type declaringType,
149private KnownElements GetKnownExtensionFromType(Type extensionType, out string propName)
189Type extensionType,
226Type extensionType,
300Type targetType)
444Type declaringType, // Type where attribute is declared
455Type targetType;
456Type serializerType;
478Type declaringType, // Type where propIdName is declared
491Type targetType;
492Type serializerType;
552out Type targetType,
553out Type serializerType)
639Type propertyType;
912Type extensionType)
1198private ParameterInfo[] FindLongestConstructor(Type extensionType, out int maxConstructorArguments)
1376Type declaringType;
1492Type parentType,
1510Type declaringType;
1545Type typeValue = _parserContext.XamlTypeMapper.GetTypeFromBaseString(value,
1645Type elementBaseType,
1652out Type declaringType, // type of the object that the field is on
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlParseException.cs (1)
416Type objectType
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (117)
175ref Type baseType,
176ref Type serializerType)
230private static bool IsACollection(Type type)
249Type contentPropertyType = XamlTypeMapper.GetPropertyType(context.ContentPropertyInfo);
272Type t = ((Type)context.ContextData);
469ref Type baseType,
470ref Type serializerType)
619Type elementType,
620Type serializerType,
629ReflectionHelper.GetMscorlibType(typeof(IDictionary)).IsAssignableFrom(ParentContext.ContextData as Type));
667Type elementType = (Type) CurrentContext.ContextDataType;
675Type propertyDeclaringType;
692Type converterType,
794Type typeValue = XamlTypeMapper.GetTypeFromBaseString(value,
844Type valueElementType, // Actual type of the valueTypeFullname.
864Type declaringType, // Type that corresponds to declaringTypeFullName (where the property is declared)
872Type propType = XamlTypeMapper.GetPropertyType(propertyMember);
1075Type valueElementType)
1141ref Type baseType, // Type of the dynamicObject - PropertyInfo, MethodInfo or DependencyProperty
1143ref Type declaringType) // Actual type corresponding to typeFullName
1336bool GetTrimSurroundingWhitespace(Type type)
1432delegate bool ContentValidator(Type type);
1466public Type ContextDataType
1473return _contextData as Type;
1530internal Type ChildPropertyType
1641Type _childPropertyType;
1686Type elementBaseType,
1693out Type declaringType, // type of the object that the field is on
1763Type elementBaseType,
1771ref Type declaringType, // type of the object that the field is on
1879static string GetContentPropertyName(Type type)
1908Type baseType = type;
1909Type attrType = KnownTypes.Types[(int)KnownElements.ContentPropertyAttribute];
1910Type DOType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1911Type FEType = KnownTypes.Types[(int)KnownElements.FrameworkElement];
1912Type FCEType = KnownTypes.Types[(int)KnownElements.FrameworkContentElement];
2188Type elementType,
2286Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
2751Type parentType, // Type of parent, if known
2816Type declaringType = null;
2972Type parentType,
3008parentType.GetConstructor(Type.EmptyTypes) == null ||
3062Type valueElementType = null;
3063Type valueSerializerType = null;
3114Type pType = ParentContext.ContextData as Type;
3164Type parentType,
3174Type declaringType,
3236Type propType;
3287parentType.GetConstructor(Type.EmptyTypes) == null ||
3296if (propType == ReflectionHelper.GetMscorlibType(typeof(Type)))
3330Type parentType = XamlTypeMapper.GetType(parentTypeNamespace, parentTypeName);
3336private string GetRuntimeNamePropertyName(Type objectType)
3410Type baseType = objectType;
3411Type attrType = KnownTypes.Types[(int)KnownElements.RuntimeNamePropertyAttribute];
3412Type TimelineType = KnownTypes.Types[(int)KnownElements.Timeline];
3413Type FEType = KnownTypes.Types[(int)KnownElements.FrameworkElement];
3414Type FCEType = KnownTypes.Types[(int)KnownElements.FrameworkContentElement];
3415Type BSBType = KnownTypes.Types[(int)KnownElements.BeginStoryboard];
3481Type parentType,
3508private bool PropertyIsWriteable(object propertyMember, Type declaringType)
3570Type elementBaseType = null;
3574Type serializerType = null;
3671Type declaringType = null;
3694Type propertyType = XamlTypeMapper.GetPropertyType(dynamicObject);
3930Type propertyType, // Type of the property
3931Type serializerType, // Type of serializer for the property
3937Type declaringType, // Actual type that corresponds to typeFullName
4163Type propertyType, // Type of the property
4183Type propertyType, // Type of the property
4184Type serializerType,
4223Type propertyType, // Type of the property
4224Type serializerType, // Type of serializer for the property
4263Type propertyType, // Type of the property
4319Type serializerType,
4333Type currentObjectType = CurrentContext.ContextDataType;
4351FirstTagName = $"{((Type)GrandParentContext.ContextData).Name}.{GrandParentContext.ChildTagLocalName}";
4410ParentContext.ContextDataType.GetConstructor(Type.EmptyTypes) == null))
4492Type parentElementType = CurrentContext.ContextDataType;
4516private void LoadContentPropertyInfo(Type elementType)
4532Type propertyDeclaringType;
4554Type elementType,
4558out Type propertyDeclaringType)
4566Type propertyBaseType = null;
4624Type propertyDeclaringType = XamlTypeMapper.GetDeclaringType(contentPropertyInfo);
4645Type parentType = ParentContext.ContextDataType;
4668Type arrayType = ParentContext.ContextDataType;
4669Type objectType = CurrentContext.ContextDataType;
4700Type elementType = CurrentContext.ContextDataType;
4715Type contentPropertyType = XamlTypeMapper.GetPropertyType(CurrentContext.ContentPropertyInfo);
4774Type converterType = XamlTypeMapper.GetTypeConverterType(elementType);
4792Type converterType = XamlTypeMapper.GetTypeConverterType(elementType);
4813internal static bool CanCollectionTypeAcceptStrings( Type collectionType )
4833internal static bool CanCollectionTypeAcceptStringsHelper( Type propertyType )
4840Type collectionItemType = GetCollectionItemType(propertyType);
4876internal static Type GetCollectionItemType( Type collectionType )
4880Type iCollectionT = collectionType.GetInterface("System.Collections.Generic.ICollection`1");
4920internal static bool CanWrapStringAsItemType( Type collectionType, Type collectionItemType )
4922Type contentWrapper = null; //e.g. Run
4949contentWrapper = attributes[i].ConstructorArguments[0].Value as Type;
5695private bool IsWhitespaceSignificantAttributePresent(Type collectionType)
5708Type baseType = collectionType;
5709Type attrType = KnownTypes.Types[(int)KnownElements.WhitespaceSignificantCollectionAttribute];
5737Type propertyType)
5742internal Type PropertyType
5769private Type _propertyType;
6456Type typeRightTag = elementNode.ElementType;
6771private bool IsAssignableToIXmlSerializable(Type type)
6831Type _definitionScopeType;
6846private Type _typeIXmlSerializable;
6854Type _ownerType;
6857public XamlPropertyFullName(Type ownerType, string name)
6864public Type OwnerType { get { return _ownerType; } }
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlTypeMapper.cs (57)
106public Type GetType(
721Type propType,
776Type owner,
939Type owner,
963static private bool IsAllowedEventDelegateType(Type delegateType)
1214Type owner,
1244Type owner,
1274Type objectType = typeAndSerializer.ObjectType;
1295Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1429Type baseType = owner;
1454Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1846Type typeValue = null;
1903Type ownerType,
2021internal static Type GetPropertyType(object propertyMember)
2023Type propertyType;
2038out Type propertyType,
2117internal static Type GetDeclaringType(object propertyMember)
2119Type validType = null;
2242internal Type GetTargetTypeAndMember(string valueParam,
2257Type targetType = null;
2293internal Type GetDependencyPropertyOwnerAndName(string memberValue,
2295Type defaultTargetType,
2298Type targetType = GetTargetTypeAndMember(memberValue, context, false, out memberName);
2325internal MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly)
2365private MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly, bool tryInternal)
2487private static bool IsInternalAllowedOnType(Type type)
2538Type objectType = GetObjectType(namespaceMap, localName, knownTypesOnly);
2588private Type GetObjectType(
2596Type type = null;
2664internal int GetCustomBamlSerializerIdForType(Type objectType)
2705internal Type GetXamlSerializerForType(Type objectType)
2846internal Type GetTypeFromBaseString(
2852Type keyObject = null;
2921internal Type GetTypeArgsType(
2927Type t = null;
2983private TypeInformationCacheData GetCachedInformationForType(Type type)
3103internal object CreateInstance(Type t)
3439internal Type GetTypeConverterType(Type type)
3443Type converterType = null;
3514internal Type GetPropertyConverterType(Type propType, object dpOrPiOrMi)
3517Type converterType = null;
3528converterType = (Type)ret;
3725internal bool GetCachedTrimSurroundingWhitespace(Type t)
3743private bool GetTrimSurroundingWhitespace(Type type)
3925internal TypeInformationCacheData(Type baseType)
3962internal Type TypeConverterType
4008Type ownerType,
4054Type converter)
4062Type _baseType;
4070Type _typeConverterType;
4080Type ot,
4093public Type OwnerType;
4201public Type ObjectType = null;
4202public Type SerializerType = null;
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\ReflectionHelper.cs (32)
82internal static Type GetQualifiedType(string typeName)
91return Type.GetType(nameFrags[0]);
121internal static bool IsNullableType(Type type)
126internal static bool IsInternalType(Type type)
128Type origType = type;
148internal static bool IsPublicType(Type type)
165internal static Type GetFrameworkType(string assemblyName, Type type)
183internal static Type GetMscorlibType(Type type)
189internal static Type GetSystemType(Type type)
215internal static string GetTypeConverterAttributeData(Type type, out Type converterType)
221internal static string GetTypeConverterAttributeData(MemberInfo mi, out Type converterType)
229private static string GetCustomAttributeData(MemberInfo mi, Type attrType, out Type typeValue)
240internal static string GetCustomAttributeData(Type t, Type attrType, bool allowZeroArgs)
242Type typeValue = null;
252private static string GetCustomAttributeData(IList<CustomAttributeData> list, Type attrType, out Type typeValue, bool allowTypeAlso, bool allowZeroArgs)
273internal static string GetCustomAttributeData(Type t,
274Type attrType,
277out Type typeValue)
281Type currentType = t;
316Type attrType,
317out Type typeValue,
338if (attrValue == null && allowTypeAlso && tca.ArgumentType == GetMscorlibType(typeof(Type)))
343typeValue = tca.Value as Type;
486Type typeValue = null;
505internal static bool IsInternalAllowedOnType(Type type)
PresentationCore (422)
MS\Internal\IListConverters.cs (9)
29public override bool CanConvertFrom(ITypeDescriptorContext td, Type t)
37public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
65public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
82internal abstract object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
108internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
150internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
191internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
233internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
271internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (18)
58public static TResult ReflectionStaticCall<TResult>(this Type type, string methodName)
63method = type.GetMethod(methodName, Type.EmptyTypes);
91public static TResult ReflectionStaticCall<TResult, TArg>(this Type type, string methodName, TArg arg)
96method = type.GetMethod(methodName, new Type[] { typeof(TArg) });
146method = obj.GetType().GetMethod(methodName, Type.EmptyTypes);
178method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1) });
232method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1), typeof(TArg2) });
307public static object ReflectionNew(this Type type)
309ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
332public static object ReflectionNew<TArg1>(this Type type, TArg1 arg1)
334ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1) });
359public static object ReflectionNew<TArg1, TArg2>(this Type type, TArg1 arg1, TArg2 arg2)
361ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1), typeof(TArg2) });
380/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
387Type type = obj.GetType();
405/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
421/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
425public static TResult ReflectionStaticGetProperty<TResult>(this Type type, string propertyName)
PresentationCore.Tests (6)
PresentationFramework (1707)
MS\Internal\Commands\CommandHelpers.cs (13)
16internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler)
21internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
27internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
33internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
39internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
45internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
51internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
57internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
63internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
71internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, Key key, ModifierKeys modifierKeys,
77internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
84internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
92private static void PrivateRegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
MS\Internal\Data\DataBindEngine.cs (6)
330internal ViewRecord GetViewRecord(object collection, CollectionViewSource key, Type collectionViewType, bool createView, Func<object, object> GetSourceItem)
359internal IValueConverter GetDefaultValueConverter(Type sourceType,
360Type targetType,
655private readonly Type _sourceType, _targetType;
658public ValueConverterTableKey(Type sourceType, Type targetType, bool targetToSource)
MS\Internal\Data\DefaultValueConverter.cs (51)
34protected DefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
56internal static IValueConverter Create(Type sourceType,
57Type targetType,
62Type innerType;
176internal static TypeConverter GetConverter(Type type)
195internal static object TryParse(object o, Type targetType, CultureInfo culture)
209new Type[] { StringType, typeof(System.Globalization.NumberStyles), typeof(System.IFormatProvider) },
218new Type[] { StringType, typeof(System.IFormatProvider) },
227new Type[] { StringType },
250protected object ConvertFrom(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture)
255protected object ConvertTo(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture)
261protected void EnsureConverter(Type type)
275private object ConvertHelper(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, bool isForward)
361protected Type _sourceType;
362protected Type _targetType;
369static Type StringType = typeof(String);
384public SourceDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
397public object Convert(object o, Type type, object parameter, CultureInfo culture)
402public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
420public TargetDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
432public object Convert(object o, Type type, object parameter, CultureInfo culture)
437public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
449public SystemConvertConverter(Type sourceType, Type targetType)
455public object Convert(object o, Type type, object parameter, CultureInfo culture)
460public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
469public static bool CanConvert(Type sourceType, Type targetType)
513private static bool CanConvertChar(Type type)
523Type _sourceType, _targetType;
526static readonly Type[] SupportedTypes = {
535static readonly Type[] CharSupportedTypes = {
557public ObjectTargetConverter(Type sourceType, DataBindEngine engine) :
569public object Convert(object o, Type type, object parameter, CultureInfo culture)
575public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
604public ObjectSourceConverter(Type targetType, DataBindEngine engine) :
616public object Convert(object o, Type type, object parameter, CultureInfo culture)
633public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
659public object Convert(object o, Type type, object parameter, CultureInfo culture)
672public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
690internal InterfaceConverter(Type sourceType, Type targetType)
702public object Convert(object o, Type type, object parameter, CultureInfo culture)
707public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
712private object ConvertTo(object o, Type type)
717Type _sourceType;
718Type _targetType;
728virtual public object GetService(Type serviceType)
MS\Internal\Data\DynamicValueConverter.cs (11)
24internal DynamicValueConverter(bool targetToSourceNeeded, Type sourceType, Type targetType)
30internal object Convert(object value, Type targetType)
35public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
41Type sourceType = value.GetType();
60public object ConvertBack(object value, Type sourceType, object parameter, CultureInfo culture)
66Type targetType = value.GetType();
86private void EnsureConverter(Type sourceType, Type targetType)
117private Type _sourceType;
118private Type _targetType;
MS\Internal\Data\ViewManager.cs (4)
497internal ViewRecord GetViewRecord(object collection, CollectionViewSource cvs, Type collectionViewType, bool createView, Func<object, object> GetSourceItem)
687private ViewRecord GetExistingView(object collection, CollectionViewSource cvs, Type collectionViewType, Func<object, object> GetSourceItem)
833private void ValidateViewType(CollectionView cv, Type collectionViewType)
841Type cachedViewType = (cvp == null) ? cv.GetType() : cvp.ProxiedView.GetType();
MS\Internal\WindowsRuntime\Generated\WinRT\Projections.cs (39)
12private static readonly Dictionary<Type, Type> CustomTypeToHelperTypeMappings = new Dictionary<Type, Type>();
13private static readonly Dictionary<Type, Type> CustomAbiTypeToTypeMappings = new Dictionary<Type, Type>();
14private static readonly Dictionary<string, Type> CustomAbiTypeNameToTypeMappings = new Dictionary<string, Type>();
15private static readonly Dictionary<Type, string> CustomTypeToAbiTypeNameMappings = new Dictionary<Type, string>();
25private static void RegisterCustomAbiTypeMappingNoLock(Type publicType, Type abiType, string winrtTypeName, bool isRuntimeClass = false)
37public static Type FindCustomHelperTypeMapping(Type publicType)
44return CustomTypeToHelperTypeMappings.TryGetValue(publicType.GetGenericTypeDefinition(), out Type abiTypeDefinition)
48return CustomTypeToHelperTypeMappings.TryGetValue(publicType, out Type abiType) ? abiType : null;
56public static Type FindCustomPublicTypeForAbiType(Type abiType)
63return CustomAbiTypeToTypeMappings.TryGetValue(abiType.GetGenericTypeDefinition(), out Type publicTypeDefinition)
67return CustomAbiTypeToTypeMappings.TryGetValue(abiType, out Type publicType) ? publicType : null;
75public static Type FindCustomTypeForAbiTypeName(string abiTypeName)
80return CustomAbiTypeNameToTypeMappings.TryGetValue(abiTypeName, out Type type) ? type : null;
88public static string FindCustomAbiTypeNameForType(Type type)
101public static bool IsTypeWindowsRuntimeType(Type type)
103Type typeToTest = type;
111private static bool IsTypeWindowsRuntimeTypeNoArray(Type type)
117foreach (var arg in type.GetGenericArguments())
136public static bool TryGetCompatibleWindowsRuntimeTypeForVariantType(Type type, out Type compatibleType)
144var definition = type.GetGenericTypeDefinition();
153var newArguments = new Type[genericArguments.Length];
177internal static bool TryGetDefaultInterfaceTypeForRuntimeClassType(Type runtimeClass, out Type defaultInterface)
190internal static Type GetDefaultInterfaceTypeForRuntimeClassType(Type runtimeClass)
192if (!TryGetDefaultInterfaceTypeForRuntimeClassType(runtimeClass, out Type defaultInterface))
199internal static bool TryGetMarshalerTypeForProjectedRuntimeClass(IObjectReference objectReference, out Type type)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (18)
58public static TResult ReflectionStaticCall<TResult>(this Type type, string methodName)
63method = type.GetMethod(methodName, Type.EmptyTypes);
91public static TResult ReflectionStaticCall<TResult, TArg>(this Type type, string methodName, TArg arg)
96method = type.GetMethod(methodName, new Type[] { typeof(TArg) });
146method = obj.GetType().GetMethod(methodName, Type.EmptyTypes);
178method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1) });
232method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1), typeof(TArg2) });
307public static object ReflectionNew(this Type type)
309ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
332public static object ReflectionNew<TArg1>(this Type type, TArg1 arg1)
334ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1) });
359public static object ReflectionNew<TArg1, TArg2>(this Type type, TArg1 arg1, TArg2 arg2)
361ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1), typeof(TArg2) });
380/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
387Type type = obj.GetType();
405/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
421/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
425public static TResult ReflectionStaticGetProperty<TResult>(this Type type, string propertyName)
System\Windows\Controls\StickyNote.cs (5)
80Type owner = typeof(StickyNoteControl);
1898public object Convert(object o, Type type, object parameter, CultureInfo culture)
1914public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
1924public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1942public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
System\Windows\Documents\TextRangeSerialization.cs (16)
537Type elementType = textReader.ParentType;
539Type elementTypeStandardized = TextSchema.GetStandardElementType(elementType, reduceElement);
646Type rootType;
657Type contextType = context.ParentType;
764private static void WriteInheritableProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, bool onlyAffected, DependencyObject complexProperties)
829private static void WriteNoninheritableProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, bool onlyAffected, DependencyObject complexProperties)
839Type propertyOwnerType = context.ParentType;
908private static void WriteNoninheritableProperty(XmlWriter xmlWriter, DependencyProperty property, object propertyValue, Type propertyOwnerType, bool onlyAffected, DependencyObject complexProperties, object localValue)
948private static void WriteLocallySetProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, DependencyObject complexProperties)
1058private static void WriteComplexProperties(XmlWriter xmlWriter, DependencyObject complexProperties, Type elementType)
1087private static string GetPropertyNameForElement(DependencyProperty property, Type elementType, bool forceComplexName)
1115Type elementTypeStandardized = TextSchema.GetStandardElementType(element.GetType(), reduceElement);
1162Type elementTypeStandardized = typeof(Image);
1507private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1598private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)
1935private static string FilterNaNStringValueForDoublePropertyType(string stringValue, Type propertyType)
System\Windows\Documents\TextSchema.cs (25)
120internal static bool IsValidChild(TextElement parent, Type childType)
125internal static bool ValidateChild(TextElement parent, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
151internal static bool IsValidChild(TextPointer position, Type childType)
156internal static bool ValidateChild(TextPointer position, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
183internal static bool IsValidSibling(Type siblingType, Type newType)
216internal static bool IsValidChild(ITextPointer position, Type childType)
232internal static bool IsValidChildOfContainer(Type parentType, Type childType)
257internal static bool IsFormattingType(Type elementType)
268internal static bool IsKnownType(Type elementType)
274internal static bool IsNonFormattingInline(Type elementType)
279internal static bool IsMergeableInline(Type elementType)
284internal static bool IsNonMergeableInline(Type elementType)
303internal static bool AllowsParagraphMerging(Type elementType)
323internal static bool IsParagraphOrBlockUIContainer(Type elementType)
331internal static bool IsBlock(Type type)
337internal static bool IsBreak(Type type)
361internal static Type GetStandardElementType(Type type, bool reduceElement)
454internal static DependencyProperty[] GetInheritableProperties(Type type)
475internal static DependencyProperty[] GetNoninheritableProperties(Type type)
758Type propertyType = property.PropertyType;
804private static bool IsValidChild(Type parentType, Type childType)
System\Windows\Input\Command\CommandConverter.cs (10)
44public override bool CanConvertFrom( ITypeDescriptorContext context, Type sourceType )
63public override bool CanConvertTo( ITypeDescriptorContext context, Type destinationType )
103Type ownerType = GetTypeFromContext(context, typeName);
123internal static ICommand ConvertFromHelper(Type ownerType, string localName )
168public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType )
195internal static bool IsKnownType( Type commandType )
209private Type GetTypeFromContext( ITypeDescriptorContext context, string typeName )
238private static RoutedUICommand GetKnownCommand( string localName, Type ownerType )
757internal static object GetKnownControlCommand(Type ownerType, string commandName)
804static void VerifyCommandDoesntExist( Type type, string name )
System\Windows\Markup\Baml2006\WpfGeneratedKnownProperties.cs (405)
1718Type type = typeof(System.Windows.Controls.AccessText);
1735Type type = typeof(System.Windows.Media.Animation.BeginStoryboard);
1751Type type = typeof(System.Windows.Media.Effects.BitmapEffectGroup);
1767Type type = typeof(System.Windows.Controls.Border);
1784Type type = typeof(System.Windows.Controls.Border);
1801Type type = typeof(System.Windows.Controls.Border);
1818Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1835Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1853Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1869Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1887Type type = typeof(System.Windows.Controls.ColumnDefinition);
1904Type type = typeof(System.Windows.Controls.ColumnDefinition);
1921Type type = typeof(System.Windows.Controls.ColumnDefinition);
1938Type type = typeof(System.Windows.Controls.ContentControl);
1956Type type = typeof(System.Windows.Controls.ContentControl);
1972Type type = typeof(System.Windows.Controls.ContentControl);
1988Type type = typeof(System.Windows.Controls.ContentControl);
2006Type type = typeof(System.Windows.ContentElement);
2023Type type = typeof(System.Windows.Controls.ContentPresenter);
2041Type type = typeof(System.Windows.Controls.ContentPresenter);
2058Type type = typeof(System.Windows.Controls.ContentPresenter);
2074Type type = typeof(System.Windows.Controls.ContentPresenter);
2090Type type = typeof(System.Windows.Controls.ContentPresenter);
2107Type type = typeof(System.Windows.Controls.Control);
2124Type type = typeof(System.Windows.Controls.Control);
2141Type type = typeof(System.Windows.Controls.Control);
2158Type type = typeof(System.Windows.Controls.Control);
2175Type type = typeof(System.Windows.Controls.Control);
2192Type type = typeof(System.Windows.Controls.Control);
2209Type type = typeof(System.Windows.Controls.Control);
2226Type type = typeof(System.Windows.Controls.Control);
2243Type type = typeof(System.Windows.Controls.Control);
2260Type type = typeof(System.Windows.Controls.Control);
2277Type type = typeof(System.Windows.Controls.Control);
2294Type type = typeof(System.Windows.Controls.Control);
2311Type type = typeof(System.Windows.Controls.Control);
2328Type type = typeof(System.Windows.Controls.Control);
2344Type type = typeof(System.Windows.Controls.Control);
2361Type type = typeof(System.Windows.Controls.DockPanel);
2378Type type = typeof(System.Windows.Controls.DockPanel);
2395Type type = typeof(System.Windows.Controls.Primitives.DocumentViewerBase);
2411Type type = typeof(System.Windows.Media.DrawingGroup);
2427Type type = typeof(System.Windows.Controls.FlowDocumentReader);
2443Type type = typeof(System.Windows.Controls.FlowDocumentScrollViewer);
2459Type type = typeof(System.Windows.FrameworkContentElement);
2475Type type = typeof(System.Windows.FrameworkElement);
2492Type type = typeof(System.Windows.FrameworkElement);
2509Type type = typeof(System.Windows.FrameworkElement);
2526Type type = typeof(System.Windows.FrameworkElement);
2543Type type = typeof(System.Windows.FrameworkElement);
2560Type type = typeof(System.Windows.FrameworkElement);
2577Type type = typeof(System.Windows.FrameworkElement);
2594Type type = typeof(System.Windows.FrameworkElement);
2611Type type = typeof(System.Windows.FrameworkElement);
2628Type type = typeof(System.Windows.FrameworkElement);
2644Type type = typeof(System.Windows.FrameworkElement);
2661Type type = typeof(System.Windows.FrameworkElement);
2678Type type = typeof(System.Windows.Media.GeneralTransformGroup);
2694Type type = typeof(System.Windows.Media.GeometryGroup);
2710Type type = typeof(System.Windows.Media.GradientBrush);
2726Type type = typeof(System.Windows.Controls.Grid);
2743Type type = typeof(System.Windows.Controls.Grid);
2760Type type = typeof(System.Windows.Controls.Grid);
2777Type type = typeof(System.Windows.Controls.Grid);
2794Type type = typeof(System.Windows.Controls.GridViewColumn);
2812Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2830Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2848Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2864Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2880Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2898Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2916Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2932Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2948Type type = typeof(System.Windows.Documents.Hyperlink);
2965Type type = typeof(System.Windows.Controls.Image);
2982Type type = typeof(System.Windows.Controls.Image);
2999Type type = typeof(System.Windows.Controls.ItemsControl);
3015Type type = typeof(System.Windows.Controls.ItemsControl);
3031Type type = typeof(System.Windows.Controls.ItemsControl);
3047Type type = typeof(System.Windows.Controls.ItemsControl);
3063Type type = typeof(System.Windows.Controls.ItemsControl);
3079Type type = typeof(System.Windows.Controls.ItemsControl);
3095Type type = typeof(System.Windows.Media.Media3D.MaterialGroup);
3111Type type = typeof(System.Windows.Media.Media3D.Model3DGroup);
3127Type type = typeof(System.Windows.Controls.Page);
3145Type type = typeof(System.Windows.Controls.Panel);
3162Type type = typeof(System.Windows.Shapes.Path);
3179Type type = typeof(System.Windows.Media.PathFigure);
3195Type type = typeof(System.Windows.Media.PathGeometry);
3212Type type = typeof(System.Windows.Controls.Primitives.Popup);
3228Type type = typeof(System.Windows.Controls.Primitives.Popup);
3245Type type = typeof(System.Windows.Controls.Primitives.Popup);
3262Type type = typeof(System.Windows.Controls.Primitives.Popup);
3279Type type = typeof(System.Windows.Controls.RowDefinition);
3296Type type = typeof(System.Windows.Controls.RowDefinition);
3313Type type = typeof(System.Windows.Controls.RowDefinition);
3330Type type = typeof(System.Windows.Controls.ScrollViewer);
3347Type type = typeof(System.Windows.Controls.ScrollViewer);
3364Type type = typeof(System.Windows.Controls.ScrollViewer);
3381Type type = typeof(System.Windows.Shapes.Shape);
3398Type type = typeof(System.Windows.Shapes.Shape);
3415Type type = typeof(System.Windows.Shapes.Shape);
3432Type type = typeof(System.Windows.Controls.TextBlock);
3449Type type = typeof(System.Windows.Controls.TextBlock);
3466Type type = typeof(System.Windows.Controls.TextBlock);
3483Type type = typeof(System.Windows.Controls.TextBlock);
3500Type type = typeof(System.Windows.Controls.TextBlock);
3517Type type = typeof(System.Windows.Controls.TextBlock);
3534Type type = typeof(System.Windows.Controls.TextBlock);
3551Type type = typeof(System.Windows.Controls.TextBlock);
3568Type type = typeof(System.Windows.Controls.TextBlock);
3585Type type = typeof(System.Windows.Controls.TextBlock);
3602Type type = typeof(System.Windows.Controls.TextBlock);
3619Type type = typeof(System.Windows.Controls.TextBox);
3636Type type = typeof(System.Windows.Controls.TextBox);
3653Type type = typeof(System.Windows.Documents.TextElement);
3670Type type = typeof(System.Windows.Documents.TextElement);
3687Type type = typeof(System.Windows.Documents.TextElement);
3704Type type = typeof(System.Windows.Documents.TextElement);
3721Type type = typeof(System.Windows.Documents.TextElement);
3738Type type = typeof(System.Windows.Documents.TextElement);
3755Type type = typeof(System.Windows.Documents.TextElement);
3772Type type = typeof(System.Windows.Media.Animation.TimelineGroup);
3788Type type = typeof(System.Windows.Controls.Primitives.Track);
3805Type type = typeof(System.Windows.Controls.Primitives.Track);
3822Type type = typeof(System.Windows.Controls.Primitives.Track);
3839Type type = typeof(System.Windows.Controls.Primitives.Track);
3856Type type = typeof(System.Windows.Controls.Primitives.Track);
3873Type type = typeof(System.Windows.Controls.Primitives.Track);
3890Type type = typeof(System.Windows.Media.Media3D.Transform3DGroup);
3906Type type = typeof(System.Windows.Media.TransformGroup);
3922Type type = typeof(System.Windows.UIElement);
3939Type type = typeof(System.Windows.UIElement);
3956Type type = typeof(System.Windows.UIElement);
3973Type type = typeof(System.Windows.UIElement);
3990Type type = typeof(System.Windows.UIElement);
4007Type type = typeof(System.Windows.Controls.Viewport3D);
4024Type type = typeof(System.Windows.Controls.AdornedElementPlaceholder);
4041Type type = typeof(System.Windows.Documents.AdornerDecorator);
4058Type type = typeof(System.Windows.Documents.AnchoredBlock);
4075Type type = typeof(System.Windows.Markup.ArrayExtension);
4092Type type = typeof(System.Windows.Documents.BlockUIContainer);
4109Type type = typeof(System.Windows.Documents.Bold);
4126Type type = typeof(System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames);
4143Type type = typeof(System.Windows.Controls.Border);
4160Type type = typeof(System.Windows.Controls.Primitives.BulletDecorator);
4177Type type = typeof(System.Windows.Controls.Button);
4195Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
4213Type type = typeof(System.Windows.Media.Animation.ByteAnimationUsingKeyFrames);
4230Type type = typeof(System.Windows.Controls.Canvas);
4247Type type = typeof(System.Windows.Media.Animation.CharAnimationUsingKeyFrames);
4264Type type = typeof(System.Windows.Controls.CheckBox);
4282Type type = typeof(System.Windows.Media.Animation.ColorAnimationUsingKeyFrames);
4299Type type = typeof(System.Windows.Controls.ComboBox);
4316Type type = typeof(System.Windows.Controls.ComboBoxItem);
4334Type type = typeof(System.Windows.Controls.ContextMenu);
4351Type type = typeof(System.Windows.Controls.ControlTemplate);
4368Type type = typeof(System.Windows.DataTemplate);
4385Type type = typeof(System.Windows.DataTrigger);
4402Type type = typeof(System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames);
4419Type type = typeof(System.Windows.Controls.Decorator);
4436Type type = typeof(System.Windows.Controls.DockPanel);
4453Type type = typeof(System.Windows.Controls.DocumentViewer);
4469Type type = typeof(System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames);
4486Type type = typeof(System.Windows.EventTrigger);
4503Type type = typeof(System.Windows.Controls.Expander);
4521Type type = typeof(System.Windows.Documents.Figure);
4538Type type = typeof(System.Windows.Documents.FixedDocument);
4555Type type = typeof(System.Windows.Documents.FixedDocumentSequence);
4572Type type = typeof(System.Windows.Documents.FixedPage);
4589Type type = typeof(System.Windows.Documents.Floater);
4606Type type = typeof(System.Windows.Documents.FlowDocument);
4623Type type = typeof(System.Windows.Controls.FlowDocumentPageViewer);
4639Type type = typeof(System.Windows.FrameworkTemplate);
4656Type type = typeof(System.Windows.Controls.Grid);
4673Type type = typeof(System.Windows.Controls.GridView);
4690Type type = typeof(System.Windows.Controls.GridViewColumnHeader);
4708Type type = typeof(System.Windows.Controls.GroupBox);
4726Type type = typeof(System.Windows.Controls.GroupItem);
4744Type type = typeof(System.Windows.Controls.HeaderedContentControl);
4762Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
4779Type type = typeof(System.Windows.HierarchicalDataTemplate);
4796Type type = typeof(System.Windows.Documents.Hyperlink);
4813Type type = typeof(System.Windows.Controls.InkCanvas);
4830Type type = typeof(System.Windows.Controls.InkPresenter);
4847Type type = typeof(System.Windows.Documents.InlineUIContainer);
4864Type type = typeof(System.Windows.Input.InputScopeName);
4882Type type = typeof(System.Windows.Media.Animation.Int16AnimationUsingKeyFrames);
4899Type type = typeof(System.Windows.Media.Animation.Int32AnimationUsingKeyFrames);
4916Type type = typeof(System.Windows.Media.Animation.Int64AnimationUsingKeyFrames);
4933Type type = typeof(System.Windows.Documents.Italic);
4950Type type = typeof(System.Windows.Controls.ItemsControl);
4967Type type = typeof(System.Windows.Controls.ItemsPanelTemplate);
4984Type type = typeof(System.Windows.Controls.Label);
5002Type type = typeof(System.Windows.Media.LinearGradientBrush);
5018Type type = typeof(System.Windows.Documents.List);
5035Type type = typeof(System.Windows.Controls.ListBox);
5052Type type = typeof(System.Windows.Controls.ListBoxItem);
5070Type type = typeof(System.Windows.Documents.ListItem);
5087Type type = typeof(System.Windows.Controls.ListView);
5104Type type = typeof(System.Windows.Controls.ListViewItem);
5122Type type = typeof(System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames);
5139Type type = typeof(System.Windows.Controls.Menu);
5156Type type = typeof(System.Windows.Controls.Primitives.MenuBase);
5173Type type = typeof(System.Windows.Controls.MenuItem);
5190Type type = typeof(System.Windows.Media.Media3D.ModelVisual3D);
5207Type type = typeof(System.Windows.Data.MultiBinding);
5224Type type = typeof(System.Windows.MultiDataTrigger);
5241Type type = typeof(System.Windows.MultiTrigger);
5258Type type = typeof(System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames);
5275Type type = typeof(System.Windows.Documents.PageContent);
5292Type type = typeof(System.Windows.Navigation.PageFunctionBase);
5310Type type = typeof(System.Windows.Controls.Panel);
5327Type type = typeof(System.Windows.Documents.Paragraph);
5344Type type = typeof(System.Windows.Media.Animation.ParallelTimeline);
5360Type type = typeof(System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames);
5377Type type = typeof(System.Windows.Media.Animation.PointAnimationUsingKeyFrames);
5394Type type = typeof(System.Windows.Data.PriorityBinding);
5411Type type = typeof(System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames);
5428Type type = typeof(System.Windows.Media.RadialGradientBrush);
5444Type type = typeof(System.Windows.Controls.RadioButton);
5462Type type = typeof(System.Windows.Media.Animation.RectAnimationUsingKeyFrames);
5479Type type = typeof(System.Windows.Controls.Primitives.RepeatButton);
5497Type type = typeof(System.Windows.Controls.RichTextBox);
5514Type type = typeof(System.Windows.Controls.RichTextBox);
5531Type type = typeof(System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames);
5548Type type = typeof(System.Windows.Documents.Run);
5565Type type = typeof(System.Windows.Controls.ScrollViewer);
5583Type type = typeof(System.Windows.Documents.Section);
5600Type type = typeof(System.Windows.Controls.Primitives.Selector);
5617Type type = typeof(System.Windows.Media.Animation.SingleAnimationUsingKeyFrames);
5634Type type = typeof(System.Windows.Media.Animation.SizeAnimationUsingKeyFrames);
5651Type type = typeof(System.Windows.Documents.Span);
5668Type type = typeof(System.Windows.Controls.StackPanel);
5685Type type = typeof(System.Windows.Controls.Primitives.StatusBar);
5702Type type = typeof(System.Windows.Controls.Primitives.StatusBarItem);
5720Type type = typeof(System.Windows.Media.Animation.Storyboard);
5736Type type = typeof(System.Windows.Media.Animation.StringAnimationUsingKeyFrames);
5753Type type = typeof(System.Windows.Style);
5770Type type = typeof(System.Windows.Controls.TabControl);
5787Type type = typeof(System.Windows.Controls.TabItem);
5805Type type = typeof(System.Windows.Controls.Primitives.TabPanel);
5822Type type = typeof(System.Windows.Documents.Table);
5839Type type = typeof(System.Windows.Documents.TableCell);
5856Type type = typeof(System.Windows.Documents.TableRow);
5873Type type = typeof(System.Windows.Documents.TableRowGroup);
5890Type type = typeof(System.Windows.Controls.TextBlock);
5907Type type = typeof(System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames);
5924Type type = typeof(System.Windows.Controls.Primitives.ToggleButton);
5942Type type = typeof(System.Windows.Controls.ToolBar);
5959Type type = typeof(System.Windows.Controls.Primitives.ToolBarOverflowPanel);
5976Type type = typeof(System.Windows.Controls.Primitives.ToolBarPanel);
5993Type type = typeof(System.Windows.Controls.ToolBarTray);
6010Type type = typeof(System.Windows.Controls.ToolTip);
6028Type type = typeof(System.Windows.Controls.TreeView);
6045Type type = typeof(System.Windows.Controls.TreeViewItem);
6062Type type = typeof(System.Windows.Trigger);
6079Type type = typeof(System.Windows.Documents.Underline);
6096Type type = typeof(System.Windows.Controls.Primitives.UniformGrid);
6113Type type = typeof(System.Windows.Controls.UserControl);
6131Type type = typeof(System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames);
6148Type type = typeof(System.Windows.Media.Animation.VectorAnimationUsingKeyFrames);
6165Type type = typeof(System.Windows.Controls.Viewbox);
6182Type type = typeof(System.Windows.Media.Media3D.Viewport3DVisual);
6199Type type = typeof(System.Windows.Controls.VirtualizingPanel);
6216Type type = typeof(System.Windows.Controls.VirtualizingStackPanel);
6233Type type = typeof(System.Windows.Window);
6251Type type = typeof(System.Windows.Controls.WrapPanel);
6268Type type = typeof(System.Windows.Data.XmlDataProvider);
6285Type type = typeof(System.Windows.Controls.ControlTemplate);
6302Type type = typeof(System.Windows.DataTemplate);
6319Type type = typeof(System.Windows.DataTemplate);
6338Type type = typeof(System.Windows.Controls.ControlTemplate);
6342typeof(System.Type), // type
6347bamlMember.TypeConverterType = typeof(System.Type);
6349bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Controls.ControlTemplate)target).TargetType = (System.Type)value; };
6358Type type = typeof(System.Windows.FrameworkElement);
6376Type type = typeof(System.Windows.FrameworkTemplate);
6395Type type = typeof(System.Windows.Controls.Grid);
6412Type type = typeof(System.Windows.Controls.Grid);
6429Type type = typeof(System.Windows.MultiTrigger);
6446Type type = typeof(System.Windows.NameScope);
6462Type type = typeof(System.Windows.Style);
6466typeof(System.Type), // type
6471bamlMember.TypeConverterType = typeof(System.Type);
6473bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Style)target).TargetType = (System.Type)value; };
6482Type type = typeof(System.Windows.Style);
6499Type type = typeof(System.Windows.Setter);
6517Type type = typeof(System.Windows.Setter);
6536Type type = typeof(System.Windows.Data.Binding);
6554Type type = typeof(System.Windows.ComponentResourceKey);
6573Type type = typeof(System.Windows.ComponentResourceKey);
6577typeof(System.Type), // type
6582bamlMember.TypeConverterType = typeof(System.Type);
6583bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.ComponentResourceKey)target).TypeInTargetAssembly = (System.Type)value; };
6592Type type = typeof(System.Windows.Data.Binding);
6609Type type = typeof(System.Windows.Data.Binding);
6628Type type = typeof(System.Windows.Data.Binding);
6645Type type = typeof(System.Windows.Data.Binding);
6663Type type = typeof(System.Windows.Media.Animation.Timeline);
6680Type type = typeof(System.Windows.Style);
6698Type type = typeof(System.Windows.Data.Binding);
6716Type type = typeof(System.Windows.Data.Binding);
6734Type type = typeof(System.Windows.ResourceDictionary);
6752Type type = typeof(System.Windows.Trigger);
6770Type type = typeof(System.Windows.Trigger);
6789Type type = typeof(System.Windows.Data.RelativeSource);
6793typeof(System.Type), // type
6798bamlMember.TypeConverterType = typeof(System.Type);
6799bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Data.RelativeSource)target).AncestorType = (System.Type)value; };
6808Type type = typeof(System.Windows.UIElement);
6825Type type = typeof(System.Windows.FrameworkContentElement);
6842Type type = typeof(System.Windows.FrameworkContentElement);
6860Type type = typeof(System.Windows.Style);
6878Type type = typeof(System.Windows.FrameworkTemplate);
6896Type type = typeof(System.Windows.Application);
6914Type type = typeof(System.Windows.Data.MultiBinding);
6931Type type = typeof(System.Windows.Data.MultiBinding);
6950Type type = typeof(System.Windows.Media.LinearGradientBrush);
6967Type type = typeof(System.Windows.Media.LinearGradientBrush);
6984Type type = typeof(System.Windows.Input.CommandBinding);
7002Type type = typeof(System.Windows.Condition);
7021Type type = typeof(System.Windows.Condition);
7039Type type = typeof(System.Windows.Condition);
7056Type type = typeof(System.Windows.Data.BindingBase);
7075Type type = typeof(System.Windows.Window);
7092Type type = typeof(System.Windows.Window);
7109Type type = typeof(System.Windows.Window);
7126Type type = typeof(System.Windows.Shapes.Shape);
7143Type type = typeof(System.Windows.Shapes.Shape);
7160Type type = typeof(System.Windows.Shapes.Shape);
7177Type type = typeof(System.Windows.Media.TileBrush);
7194Type type = typeof(System.Windows.Media.TileBrush);
7211Type type = typeof(System.Windows.Media.TileBrush);
7228Type type = typeof(System.Windows.Media.GeometryDrawing);
7244Type type = typeof(System.Windows.Controls.TextBox);
7261Type type = typeof(System.Windows.Controls.StackPanel);
7278Type type = typeof(System.Windows.Controls.Primitives.Track);
7295Type type = typeof(System.Windows.Controls.Primitives.Track);
7312Type type = typeof(System.Windows.Controls.Primitives.Track);
7329Type type = typeof(System.Windows.EventTrigger);
7347Type type = typeof(System.Windows.Input.InputBinding);
7364Type type = typeof(System.Windows.Input.KeyBinding);
7382Type type = typeof(System.Windows.Controls.TextBox);
7399Type type = typeof(System.Windows.Controls.TextBlock);
7416Type type = typeof(System.Windows.Navigation.JournalEntryUnifiedViewConverter);
7433Type type = typeof(System.Windows.Media.GradientBrush);
7450Type type = typeof(System.Windows.Controls.MenuItem);
7468Type type = typeof(System.Windows.DataTrigger);
7487Type type = typeof(System.Windows.DataTrigger);
7504Type type = typeof(System.Windows.Setter);
7523Type type = typeof(System.Windows.ResourceDictionary);
7541Type type = typeof(System.Windows.Media.Animation.BeginStoryboard);
7559Type type = typeof(System.Windows.ResourceDictionary);
7576Type type = typeof(System.Windows.Input.KeyboardNavigation);
7593Type type = typeof(System.Windows.Input.KeyboardNavigation);
7610Type type = typeof(System.Windows.Controls.Primitives.ScrollBar);
7627Type type = typeof(System.Windows.Trigger);
7646Type type = typeof(System.Windows.EventTrigger);
7664Type type = typeof(System.Windows.Controls.DefinitionBase);
7681Type type = typeof(System.Windows.Controls.ToolTipService);
7699Type type = typeof(System.Windows.Media.PathFigure);
7716Type type = typeof(System.Windows.Media.PathFigure);
7733Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
7750Type type = typeof(System.Windows.Documents.Block);
7767Type type = typeof(System.Windows.UIElement);
7784Type type = typeof(System.Windows.Media.Pen);
7801Type type = typeof(System.Windows.Controls.Primitives.BulletDecorator);
7818Type type = typeof(System.Windows.UIElement);
7835Type type = typeof(System.Windows.UIElement);
7852Type type = typeof(System.Windows.UIElement);
7869Type type = typeof(System.Windows.Media.SolidColorBrush);
7886Type type = typeof(System.Windows.Media.Brush);
7903Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
7920Type type = typeof(System.Windows.Media.PathSegment);
7937Type type = typeof(System.Windows.Controls.VirtualizingPanel);
7954Type type = typeof(System.Windows.Shapes.Shape);
7971Type type = typeof(System.Windows.Controls.Frame);
7988Type type = typeof(System.Windows.Controls.Frame);
8005Type type = typeof(System.Windows.Media.Animation.Storyboard);
8022Type type = typeof(System.Windows.Data.XmlDataProvider);
8040Type type = typeof(System.Windows.Controls.Primitives.Selector);
8057Type type = typeof(System.Windows.DataTemplate);
8077Type type = typeof(System.Windows.Shapes.Shape);
8094Type type = typeof(System.Windows.UIElement);
8111Type type = typeof(System.Windows.Controls.MenuItem);
8128Type type = typeof(System.Windows.Controls.Panel);
8145Type type = typeof(System.Windows.Data.Binding);
8163Type type = typeof(System.Windows.Window);
8180Type type = typeof(System.Windows.Data.ObjectDataProvider);
8184typeof(System.Type), // type
8189bamlMember.TypeConverterType = typeof(System.Type);
8190bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Data.ObjectDataProvider)target).ObjectType = (System.Type)value; };
8199Type type = typeof(System.Windows.Controls.ToolBar);
8217Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
8234Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
8251Type type = typeof(System.Windows.FrameworkElement);
8268Type type = typeof(System.Windows.MultiDataTrigger);
8285Type type = typeof(System.Windows.Input.KeyBinding);
8302Type type = typeof(System.Windows.Data.Binding);
8321Type type = typeof(System.Windows.Controls.Canvas);
8338Type type = typeof(System.Windows.Controls.Canvas);
8355Type type = typeof(System.Windows.Controls.Canvas);
8372Type type = typeof(System.Windows.Controls.Canvas);
8389Type type = typeof(System.Windows.Media.Animation.Storyboard);
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (22)
1774new List<Type>() { typeof(System.Type) },
1778(System.Type)arguments[0]);
1854new List<Type>() { typeof(System.String) },
2697new List<Type>() { typeof(System.Object) },
2827new List<Type>() { typeof(System.Type), typeof(System.Object) },
2831(System.Type)arguments[0],
3167new List<Type>() { typeof(System.Object) },
4035new List<Type>() { typeof(System.Object) },
8296new List<Type>() { typeof(System.Windows.Data.RelativeSourceMode) },
8303new List<Type>() { typeof(System.Windows.Data.RelativeSourceMode), typeof(System.Type), typeof(System.Int32) },
8308(System.Type)arguments[1],
9426new List<Type>() { typeof(System.String) },
9445new List<Type>() { typeof(System.Object) },
9877new List<Type>() { typeof(System.Windows.DependencyProperty) },
10091new List<Type>() { typeof(System.String) },
10653new List<Type>() { typeof(System.Type) },
10657(System.Type)arguments[0]);
11832new List<Type>() { typeof(System.Object) },
System\Windows\Markup\BamlMapTable.cs (47)
94internal static Type GetKnownTypeFromId(short id)
123Type probeType = KnownTypes.Types[probe];
158internal static short GetKnownTypeIdFromType(Type type)
196internal static KnownElements GetKnownTypeConverterIdFromType(Type type)
203else if (type == typeof(System.Type))
226internal TypeConverter GetKnownConverterFromType(Type type)
246internal static TypeConverter GetKnownConverterFromType_NoCache(Type type)
280internal Type GetKnownConverterTypeFromType(Type type)
301if (type == typeof(System.Type))
326private static Type GetKnownConverterTypeFromPropName(
327Type propOwnerType,
401internal Type GetTypeFromId(short id)
403Type type = null;
511private short GetAssemblyIdForType(Type t)
531Type propType,
578Type t = GetTypeFromId(typeId);
642Type ownerType = record.OwnerType;
756internal Type GetTypeFromTypeInfo(BamlTypeInfoRecord typeInfo)
776Type type = assembly.GetType(typeInfo.TypeFullName);
789private Type GetAttributeOwnerType(BamlAttributeInfoRecord bamlAttributeInfoRecord)
811internal Type GetCLRPropertyTypeAndNameFromId(short attributeId, out string propName)
814Type propType = null;
847internal DependencyProperty GetDependencyPropertyValueFromId(short memberId, string memberName, out Type declaringType)
894Type declaringType = GetTypeFromId(ownerTypeId);
940Type ownerType = GetAttributeOwnerType(bamlAttributeInfoRecord);
953internal short GetAttributeOrTypeId(BinaryWriter binaryWriter, Type declaringType, string memberName, out short typeId)
1207Type elementType,
1291Type owningType, // Actual type of the object the owns or declares this attribute
1293Type attributeType, // Type of the attribute or property itself; not its owner type
1304Type owningType, // Actual type of the object the owns or declares this attribute
1306Type attributeType, // Type of the attribute or property itself; not its owner type
1318Type serializerType = XamlTypeMapper.GetXamlSerializerForType(owningType);
1369Type ownerType, // Type of object that owns or declares this attribute
1370Type attributeType, // Type of the attribute or property itself; not its owner type
1374out Type converterOrSerializerType)
1485Type defaultTargetType)
1488Type targetType = null;
1534Type declaringType, // Type of object that owns or declares this attribute
1535Type attributeType) // Type of the attribute or property itself; not its owner type
1553private Type GetCustomConverter(
1555Type ownerType, // Type of object that owns or declares this attribute
1557Type attributeType) // Type of the attribute or property itself; not its owner type
1560Type converterType = GetKnownConverterTypeFromPropName(ownerType, fieldName);
1594private Type GetCustomSerializer(
1595Type type,
1709private TypeConverter GetConverterFromCache(Type type)
System\Windows\Markup\BamlRecordReader.cs (37)
839out Type delayCreatedType,
843Type elementType = MapTable.GetTypeFromId(typeId);
881protected ReaderFlags GetFlagsFromType(Type elementType)
1000Type delayCreatedType = null;
1247Type elementType = MapTable.GetTypeFromId(bamlElementRecord.TypeId);
1390Type elementType = ParentContext.ExpectedType;
1419Type t = param as Type;
1468Type ownerType = ParserContext.TargetType;
2094Type declaringType = null;
2099out Type declaringType)
2138internal object GetCustomValue(BamlPropertyCustomRecord bamlPropertyRecord, Type propertyType, string propertyName)
2644Type valueType = MapTable.GetTypeFromId(bamlPropertyRecord.TypeId);
3027Type expectedType = holder.PropertyType;
3354Type keyType = MapTable.GetTypeFromId(bamlDefAttributeRecord.TypeId);
3671Type propertyType = null;
3745static private Type NullableType = typeof(Nullable<>);
3747static internal bool IsNullable(Type t)
3754internal object OptionallyMakeNullable(Type propertyType, object o, string propName)
3761((Type)propertyType.GetGenericArguments()[0]).Name,
3772static internal bool TryOptionallyMakeNullable( Type propertyType, string propName, ref object o )
3778Type genericType = (Type)propertyType.GetGenericArguments()[0];
3954Type propertyType,
3996Type propertyType)
4005if (propertyType == typeof(Type))
4028object GetObjectFromString(Type type, string s, short converterTypeId)
4282Type expectedType,
4292Type expectedType,
4766Type parentType = GetParentType();
4784Type parentType = GetParentType();
4799private Type GetParentType()
4855Type elementType;
5106Type currentParentType;
5212Type type,
5763Type currentParentType = currentParent.GetType();
5822public Type PropertyType
System\Windows\Markup\MarkupExtensionParser.cs (25)
36ref Type baseType,
37ref Type serializerType);
64Type declaringType, // Type where propIdName is declared
89Type declaringType,
149private KnownElements GetKnownExtensionFromType(Type extensionType, out string propName)
189Type extensionType,
226Type extensionType,
300Type targetType)
444Type declaringType, // Type where attribute is declared
455Type targetType;
456Type serializerType;
478Type declaringType, // Type where propIdName is declared
491Type targetType;
492Type serializerType;
552out Type targetType,
553out Type serializerType)
639Type propertyType;
912Type extensionType)
1198private ParameterInfo[] FindLongestConstructor(Type extensionType, out int maxConstructorArguments)
1376Type declaringType;
1492Type parentType,
1510Type declaringType;
1545Type typeValue = _parserContext.XamlTypeMapper.GetTypeFromBaseString(value,
1645Type elementBaseType,
1652out Type declaringType, // type of the object that the field is on
System\Windows\Markup\Primitives\ElementMarkupObject.cs (47)
47public override Type ObjectType
210Type ownerType = dpd.DependencyProperty.OwnerType;
237Type instanceType = instance.GetType();
286public ShouldSerializeKey(Type type, string propertyName)
321private Type _type;
400private static Type[] _shouldSerializeArgsObject = new Type[] { typeof(DependencyObject) };
401private static Type[] _shouldSerializeArgsManager = new Type[] { typeof(XamlDesignerSerializationManager) };
402private static Type[] _shouldSerializeArgsMode = new Type[] { typeof(XamlWriterMode) };
403private static Type[] _shouldSerializeArgsObjectManager = new Type[] { typeof(DependencyObject), typeof(XamlDesignerSerializationManager) };
496Type keyType = GetDictionaryKeyType(dictionary);
617static readonly List<Type> EmptyTypes = new List<Type>();
619public override IEnumerable<Type> TypeReferences
645protected abstract Type GetObjectType();
681private static Dictionary<Type, Type> _keyTypeMap;
683private static Type GetDictionaryKeyType(IDictionary value)
685Type type = value.GetType();
686Type result;
689_keyTypeMap = new Dictionary<Type, Type>();
692foreach (Type interfaceType in type.GetInterfaces())
696Type genericTypeDefinition = interfaceType.GetGenericTypeDefinition();
726protected override Type GetObjectType()
750public override Type PropertyType
885Type propertyType,
910Type type = value as Type;
916if( propertyType == typeof(Type) )
931ValueSerializer typeSerializer = context.GetValueSerializerFor(typeof(Type));
972public override Type PropertyType
1012public override IEnumerable<Type> TypeReferences
1031internal ElementPseudoPropertyBase(object value, Type type, ElementMarkupObject obj) : base(obj)
1037public override Type PropertyType
1052public override IEnumerable<Type> TypeReferences
1054get { return Array.Empty<Type>(); }
1058private Type _type;
1066internal ElementKey(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
1084internal ElementConstructorArgument(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
1102internal ElementItemsPseudoProperty(IEnumerable value, Type type, ElementMarkupObject obj) : base(value, type, obj)
1141internal ElementDictionaryItemsPseudoProperty(IDictionary value, Type type, ElementMarkupObject obj) : base(value, type, obj)
1194public ValueSerializer GetValueSerializerFor(Type type)
1249public object GetService(Type serviceType)
System\Windows\Markup\XamlTypeMapper.cs (83)
106public Type GetType(
447Type owner,
451Type baseType = null;
503Type propType,
721Type propType,
776Type owner,
801Type ownerType,
822Type currentParentType,
864Type propertyOwnerType = attributeInfo.OwnerType;
939Type owner,
1182protected virtual bool AllowInternalType(Type type)
1187private bool IsInternalTypeAllowedInFullTrust(Type type)
1214Type owner,
1244Type owner,
1274Type objectType = typeAndSerializer.ObjectType;
1295Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1429Type baseType = owner;
1454Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1589Type owner,
1631Type owner,
1634ref Type baseType,
1766ref Type ownerType)
1903Type ownerType,
1995Type ownerType)
1998Type currentType = ownerType;
2021internal static Type GetPropertyType(object propertyMember)
2023Type propertyType;
2038out Type propertyType,
2117internal static Type GetDeclaringType(object propertyMember)
2119Type validType = null;
2156internal static Type GetTypeFromName(string typeName, DependencyObject element)
2208Type t = assy.GetType(fullTypeName);
2228Type t = assy.GetType(fullTypeName);
2242internal Type GetTargetTypeAndMember(string valueParam,
2257Type targetType = null;
2293internal Type GetDependencyPropertyOwnerAndName(string memberValue,
2295Type defaultTargetType,
2298Type targetType = GetTargetTypeAndMember(memberValue, context, false, out memberName);
2325internal MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly)
2365private MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly, bool tryInternal)
2538Type objectType = GetObjectType(namespaceMap, localName, knownTypesOnly);
2588private Type GetObjectType(
2596Type type = null;
2664internal int GetCustomBamlSerializerIdForType(Type objectType)
2705internal Type GetXamlSerializerForType(Type objectType)
2721internal static Type GetInternalTypeHelperTypeFromAssembly(ParserContext pc)
2729Type ithType = a.GetType($"{GeneratedNamespace}.{GeneratedInternalTypeHelperClassName}");
2749Type ithType = GetInternalTypeHelperTypeFromAssembly(pc);
2757internal static object CreateInternalInstance(ParserContext pc, Type type)
2801internal static Delegate CreateDelegate(ParserContext pc, Type delegateType, object target, string handler)
2846internal Type GetTypeFromBaseString(
2852Type keyObject = null;
2983private TypeInformationCacheData GetCachedInformationForType(Type type)
3004private Type GetCachedBaseType(Type t)
3060ref Type ownerType)
3083Type ownerType)
3103internal object CreateInstance(Type t)
3398private string GetCachedNamespace(Type t)
3439internal Type GetTypeConverterType(Type type)
3443Type converterType = null;
3470internal TypeConverter GetTypeConverter(Type type)
3490Type converterType = TypeConverterHelper.GetConverterType(type);
3514internal Type GetPropertyConverterType(Type propType, object dpOrPiOrMi)
3517Type converterType = null;
3558internal TypeConverter GetPropertyConverter(Type propType, object dpOrPiOrMi)
3581Type converterType = TypeConverterHelper.GetConverterType(memberInfo);
3636internal ConstructorData GetConstructors(Type type)
3725internal bool GetCachedTrimSurroundingWhitespace(Type t)
3743private bool GetTrimSurroundingWhitespace(Type type)
3925internal TypeInformationCacheData(Type baseType)
3946internal Type BaseType
3962internal Type TypeConverterType
4008Type ownerType,
4062Type _baseType;
4070Type _typeConverterType;
4080Type ot,
4093public Type OwnerType;
4201public Type ObjectType = null;
4202public Type SerializerType = null;
System\Windows\Navigation\JournalEntryListConverter.cs (4)
33public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
43public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
110public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
132public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
System\Windows\PropertyPath.cs (9)
57public Type type; // user-specified type
305internal object ResolvePropertyName(int level, object item, Type ownerType, object context)
547object ResolvePropertyName(string name, object item, Type ownerType, object context, bool throwOnError)
652private PropertyInfo GetPropertyHelper(Type ownerType, string propertyName)
777object GetTypedParamValue(string param, Type type, bool throwOnError)
832Type GetTypeFromName(string name, object context)
881ValueSerializer typeSerializer = ValueSerializer.GetSerializerFor(typeof(Type), serializerContext);
883return typeSerializer.ConvertFromString(name, serializerContext) as Type;
905Type type = wpfSharedSchemaContext.ResolvePrefixedNameWithAdditionalWpfSemantics(name, hostElement);
PresentationFramework.Aero (4)
PresentationFramework.Aero2 (4)
PresentationFramework.AeroLite (4)
PresentationFramework.Classic (4)
PresentationFramework.Fluent (4)
PresentationFramework.Luna (4)
PresentationFramework.Royale (4)
PresentationFramework-SystemCore (12)
PresentationFramework-SystemData (4)
PresentationFramework-SystemXmlLinq (6)
PresentationUI (4)
ReachFramework (146)
Replay (2)
Roslyn.VisualStudio.DiagnosticsWindow (9)
Roslyn.VisualStudio.Next.UnitTests (14)
RoutingSandbox (1)
RoutingWebSite (1)
SocialWeather (11)
Sockets.BindTests (3)
Sockets.FunctionalTests (3)
System.CodeDom (30)
System.Collections.Specialized (1)
System.ComponentModel (1)
System.ComponentModel.Annotations (85)
System\ComponentModel\DataAnnotations\AssociatedMetadataTypeTypeDescriptor.cs (26)
15private Type? AssociatedMetadataType { get; set; }
21[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type,
22[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? associatedMetadataType)
96private static readonly ConcurrentDictionary<Type, Type?> s_metadataTypeCache = new ConcurrentDictionary<Type, Type?>();
99private static readonly ConcurrentDictionary<(Type, string), Attribute[]> s_typeMemberCache = new ConcurrentDictionary<(Type, string), Attribute[]>();
102private static readonly ConcurrentDictionary<(Type, Type), bool> s_validatedMetadataTypeCache = new ConcurrentDictionary<(Type, Type), bool>();
105[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type type,
106[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)] Type associatedType)
108(Type, Type) typeTuple = (type, associatedType);
117public static Type? GetAssociatedMetadataType(Type type)
119if (TryGetAssociatedMetadataTypeFromCache(type, out Type? associatedMetadataType))
138static bool TryGetAssociatedMetadataTypeFromCache(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] out Type? associatedMetadataType)
145[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] Type mainType,
146[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)] Type associatedMetadataType)
169[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
172(Type, string) memberTuple = (type, memberName);
System.ComponentModel.Composition (444)
System\ComponentModel\Composition\ConstraintServices.cs (7)
20private static readonly MethodInfo _metadataEqualsMethod = typeof(object).GetMethod("Equals", new Type[] { typeof(object) })!;
21private static readonly MethodInfo _typeIsInstanceOfTypeMethod = typeof(Type).GetMethod("IsInstanceOfType")!;
23public static Expression<Func<ExportDefinition, bool>> CreateConstraint(string contractName, string? requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>> requiredMetadata, CreationPolicy requiredCreationPolicy)
66private static Expression? CreateMetadataConstraintBody(IEnumerable<KeyValuePair<string, Type>> requiredMetadata, ParameterExpression parameter)
72foreach (KeyValuePair<string, Type> requiredMetadataItem in requiredMetadata)
136private static MethodCallExpression CreateMetadataOfTypeExpression(ParameterExpression parameter, string constantKey, Type constantType)
155Expression.Constant(constantType, typeof(Type)),
System\ComponentModel\Composition\ContractNameServices.cs (30)
29private static Dictionary<Type, string>? typeIdentityCache;
31private static Dictionary<Type, string> TypeIdentityCache
35return typeIdentityCache ??= new Dictionary<Type, string>();
39internal static string GetTypeIdentity(Type type)
44internal static string GetTypeIdentity(Type type, bool formatGenericName)
108private static void WriteTypeWithNamespace(StringBuilder typeName, Type type, bool formatGenericName)
119private static void WriteType(StringBuilder typeName, Type type, bool formatGenericName)
128Queue<Type> genericTypeArguments = new Queue<Type>(type.GetGenericArguments());
141private static void WriteNonGenericType(StringBuilder typeName, Type type, bool formatGenericName)
169private static void WriteArrayType(StringBuilder typeName, Type type, bool formatGenericName)
177Type rootElementType = FindArrayElementType(type);
179Type? elementType = type;
187private static void WritePointerType(StringBuilder typeName, Type type, bool formatGenericName)
196private static void WriteByRefType(StringBuilder typeName, Type type, bool formatGenericName)
205private static void WriteArrayTypeDimensions(StringBuilder typeName, Type type)
219private static void WriteGenericType(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments, bool formatGenericName)
241private static void WriteGenericTypeName(StringBuilder typeName, Type type, bool isDefinition, Queue<Type> genericTypeArguments, bool formatGenericName)
256private static void WriteTypeArgumentsString(StringBuilder typeName, int argumentsCount, bool isDefinition, Queue<Type> genericTypeArguments, bool formatGenericName)
272Type genericTypeArgument = genericTypeArguments.Dequeue();
279private static void WriteTypeArgument(StringBuilder typeName, bool isDefinition, Type genericTypeArgument, bool formatGenericName)
296internal static void WriteCustomModifiers(StringBuilder typeName, string customKeyword, Type[] types, bool formatGenericName)
303Queue<Type> typeArguments = new Queue<Type>(types);
311private static Type FindArrayElementType(Type type)
316Type? elementType = type;
336private static int GetGenericArity(Type type)
System\ComponentModel\Composition\Hosting\CompositionServices.cs (39)
16internal static readonly Type InheritedExportAttributeType = typeof(InheritedExportAttribute);
17internal static readonly Type ExportAttributeType = typeof(ExportAttribute);
18internal static readonly Type AttributeType = typeof(Attribute);
19internal static readonly Type ObjectType = typeof(object);
26internal static Type GetDefaultTypeFromMember(this MemberInfo member)
37return ((Type)member);
49internal static Type AdjustSpecifiedTypeIdentityType(this Type specifiedContractType, MemberInfo member)
61internal static Type AdjustSpecifiedTypeIdentityType(this Type specifiedContractType, Type? memberType)
93private static string AdjustTypeIdentity(string originalTypeIdentity, Type typeIdentityType)
98internal static void GetContractInfoFromExport(this MemberInfo member, ExportAttribute export, out Type? typeIdentityType, out string contractName)
111internal static string GetTypeIdentityFromExport(this MemberInfo member, Type? typeIdentityType)
133private static Type? GetTypeIdentityTypeFromExport(this MemberInfo member, ExportAttribute export)
150internal static Type GetContractTypeFromImport(this IAttributedImport import, ImportType importType)
167Type contractType = import.GetContractTypeFromImport(importType);
174Type contractType = import.GetContractTypeFromImport(importType);
185internal static IDictionary<string, object?> GetPartMetadataForType(this Type type, CreationPolicy creationPolicy)
213Type[] genericArguments = type.GetGenericArguments();
222Type genericArgument = genericArguments[i];
224Type[]? constraints = genericArgument.GetGenericParameterConstraints();
281Type attrType = attr.GetType();
335private static bool TryContributeMetadataValue(this IDictionary<string, object?> dictionary, string name, object? value, Type? valueType, bool allowsMultiple)
366private Type? _arrayType;
368private static readonly Type ObjectType = typeof(object);
369private static readonly Type TypeType = typeof(Type);
372public void Add(object? item, Type? itemType)
389if (item is Type)
403private void InferArrayType(Type itemType)
469internal static IEnumerable<KeyValuePair<string, Type>> GetRequiredMetadata(Type? metadataViewType)
476return Enumerable.Empty<KeyValuePair<string, Type>>();
487return properties.Select(property => new KeyValuePair<string, Type>(property.Name, property.PropertyType));
495internal static IDictionary<string, object?> GetImportMetadata(Type type, IAttributedImport? attributedImport)
613private static bool IsValidAttributeType(Type type)
618private static bool IsValidAttributeType(Type type, bool arrayAllowed)
641if (typeof(Type).IsAssignableFrom(type))
System\ComponentModel\Composition\Hosting\ExportProvider.GetExportOverrides.cs (27)
38/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
89/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
134/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
187/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
220/// The <see cref="Type"/> of the <see cref="Export"/> objects to return.
223/// The <see cref="Type"/> of the metadata view of the <see cref="Export"/> objects to
245/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <paramref name="type"/>.
261public IEnumerable<Lazy<object, object>> GetExports(Type type, Type? metadataViewType, string? contractName)
297/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
338/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
373/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
415/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
448/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
498/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
553/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
605/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
647/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
688/// <see cref="AttributedModelServices.GetContractName(Type)"/> on <typeparamref name="T"/>.
713IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore);
730Export? export = GetExportsCore(typeof(T), (Type?)null, contractName, cardinality).SingleOrDefault();
737IEnumerable<Export> exports = GetExportsCore(typeof(T), (Type?)null, contractName, ImportCardinality.ZeroOrMore);
773private IEnumerable<Export> GetExportsCore(Type type, Type? metadataViewType, string? contractName, ImportCardinality cardinality)
794private static ContractBasedImportDefinition BuildImportDefinition(Type type, Type metadataViewType, string contractName, ImportCardinality cardinality)
800IEnumerable<KeyValuePair<string, Type>> requiredMetadata = CompositionServices.GetRequiredMetadata(metadataViewType);
System\ComponentModel\Composition\Primitives\ContractBasedImportDefinition.cs (12)
24private readonly IEnumerable<KeyValuePair<string, Type>> _requiredMetadata = Enumerable.Empty<KeyValuePair<string, Type>>();
57/// The type identity of the export type expected. Use <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
101public ContractBasedImportDefinition(string contractName, string? requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
118/// The type identity of the export type expected. Use <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
163public ContractBasedImportDefinition(string contractName, string? requiredTypeIdentity, IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
183/// A <see cref="string"/> that is generated by <see cref="AttributedModelServices.GetTypeIdentity(Type)"/>
208public virtual IEnumerable<KeyValuePair<string, Type>> RequiredMetadata
224foreach (KeyValuePair<string, Type> metadataItem in _requiredMetadata)
319foreach (KeyValuePair<string, Type> metadataItem in RequiredMetadata)
322Type metadataValueType = metadataItem.Value;
374foreach (KeyValuePair<string, Type> metadataItem in _requiredMetadata)
System\ComponentModel\Composition\ReflectionModel\ImportType.cs (27)
14private static readonly Type LazyOfTType = typeof(Lazy<>);
15private static readonly Type LazyOfTMType = typeof(Lazy<,>);
16private static readonly Type ExportFactoryOfTType = typeof(ExportFactory<>);
18private readonly Type _type;
20private Type _contractType;
25internal static Dictionary<Type, Func<Export, object>?>? _castSingleValueCache;
27private static Dictionary<Type, Func<Export, object>?> CastSingleValueCache
31return _castSingleValueCache ??= new Dictionary<Type, Func<Export, object>?>();
35public ImportType(Type type, ImportCardinality cardinality)
40Type contractType = type;
58public Type? ElementType { get; private set; }
60public Type ActualType
67public Type ContractType { get { return _contractType; } }
81public Type? MetadataViewType { get; private set; }
83private Type CheckForCollection(Type type)
93private static bool IsGenericDescendentOf(Type? type, Type baseGenericTypeDefinition)
108public static bool IsDescendentOf(Type type, Type baseType)
122private void Initialize(Type type)
131Type[] arguments = type.GetGenericArguments();
132Type genericType = type.GetGenericTypeDefinition().UnderlyingSystemType;
158private static bool IsLazyGenericType(Type genericType)
163private static bool TryGetCastFunction(Type genericType, bool isOpenGeneric, Type[] arguments, out Func<Export, object>? castFunction)
212private static bool IsTypeAssignableCollectionType(Type type)
System\ComponentModel\Composition\ReflectionModel\ReflectionModelServices.cs (13)
17public static Lazy<Type> GetPartType(ComposablePartDefinition partDefinition)
127Lazy<Type> partType,
165IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
178IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
204IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
251IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
263IEnumerable<KeyValuePair<string, Type>>? requiredMetadata,
302public static bool TryMakeGenericPartDefinition(ComposablePartDefinition partDefinition, IEnumerable<Type> genericParameters, [NotNullWhen(true)] out ComposablePartDefinition? specialization)
319private readonly Lazy<Type> _partType;
328Lazy<Type> partType,
345public Type GetPartType()
350public Lazy<Type> GetLazyPartType()
373_constructor = GetPartType().GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, null);
System.ComponentModel.Composition.Registration (59)
System\ComponentModel\Composition\Registration\PartBuilder.cs (32)
14private static readonly Type s_exportAttributeType = typeof(ExportAttribute);
21private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
28private readonly List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportBuilder>, Type>> _propertyExports;
29private readonly List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ImportBuilder>, Type>> _propertyImports;
30private readonly List<Tuple<Predicate<Type>, Action<Type, ExportBuilder>>> _interfaceExports;
32internal Predicate<Type> SelectType { get; }
34internal PartBuilder(Predicate<Type> selectType)
40_propertyExports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportBuilder>, Type>>();
41_propertyImports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ImportBuilder>, Type>>();
42_interfaceExports = new List<Tuple<Predicate<Type>, Action<Type, ExportBuilder>>>();
89public PartBuilder ExportInterfaces(Predicate<Type> interfaceFilter)
99public PartBuilder ExportInterfaces(Predicate<Type> interfaceFilter,
100Action<Type, ExportBuilder> exportConfiguration)
131_propertyExports.Add(Tuple.Create(propertyFilter, exportConfiguration, default(Type)));
179_propertyImports.Add(Tuple.Create(propertyFilter, importConfiguration, default(Type)));
221public PartBuilder AddMetadata(string name, Func<Type, object> itemFunc)
223_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
239Type attrType = attr.GetType();
250internal IEnumerable<Attribute> BuildTypeAttributes(Type type)
313foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
333foreach (Type iface in type.GetInterfaces())
335Type underlyingType = iface.UnderlyingSystemType;
343foreach (Tuple<Predicate<Type>, Action<Type, ExportBuilder>> exportSpecification in _interfaceExports)
348exportBuilder.AsContractType((Type)iface);
362internal bool BuildConstructorAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
403internal static void BuildDefaultConstructorAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
444internal void BuildPropertyAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
457foreach (Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ImportBuilder>, Type> importSpecification in _propertyImports)
497foreach (Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportBuilder>, Type> exportSpecification in _propertyExports)
System.ComponentModel.Primitives (12)
System.ComponentModel.TypeConverter (607)
System\ComponentModel\DateOnlyConverter.cs (4)
20public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
26public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
77public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
98return new InstanceDescriptor(typeof(DateOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int) }), new object[] { date.Year, date.Month, date.Day });
System\ComponentModel\DateTimeConverter.cs (5)
22public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
31public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
81public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
126typeof(DateTime).GetConstructor(new Type[] { typeof(long) }),
132typeof(DateTime).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) }),
System\ComponentModel\DateTimeOffsetConverter.cs (5)
21public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
30public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
81public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
138typeof(DateTimeOffset).GetConstructor(new Type[] { typeof(long) }),
144typeof(DateTimeOffset).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(TimeSpan) }),
System\ComponentModel\Design\ServiceContainer.cs (16)
16private static readonly Type[] s_defaultServices = new Type[] { typeof(IServiceContainer), typeof(ServiceContainer) };
47protected virtual Type[] DefaultServices => s_defaultServices;
58public void AddService(Type serviceType, object serviceInstance)
66public virtual void AddService(Type serviceType, object serviceInstance, bool promote)
99public void AddService(Type serviceType, ServiceCreatorCallback callback)
107public virtual void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote)
168public virtual object? GetService(Type serviceType)
174Type[] defaults = DefaultServices;
215public void RemoveService(Type serviceType)
223public virtual void RemoveService(Type serviceType, bool promote)
248private sealed class ServiceCollection<T> : Dictionary<Type, T>
252private sealed class EmbeddedTypeAwareTypeComparer : IEqualityComparer<Type>
254public bool Equals(Type? x, Type? y) => x!.IsEquivalentTo(y);
256public int GetHashCode(Type obj) => obj.FullName!.GetHashCode();
System\ComponentModel\LicenseException.cs (5)
26public LicenseException(Type? type) : this(type, null, SR.Format(SR.LicExceptionTypeOnly, type?.FullName))
33public LicenseException(Type? type, object? instance) : this(type, null, SR.Format(SR.LicExceptionTypeAndInstance, type?.FullName, instance?.GetType().FullName))
40public LicenseException(Type? type, object? instance, string? message) : base(message)
51public LicenseException(Type? type, object? instance, string? message, Exception? innerException) : base(message, innerException)
70public Type? LicensedType { get; }
System\ComponentModel\LicenseManager.cs (16)
85private static void CacheProvider(Type type, LicenseProvider? provider)
104Type providerType = provider.GetType();
120[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type,
133[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type type,
170private static bool GetCachedNoLicenseProvider(Type type)
184private static LicenseProvider? GetCachedProvider(Type type)
194private static LicenseProvider? GetCachedProviderInstance(Type providerType)
203public static bool IsLicensed(Type type)
214public static bool IsValid(Type type)
226public static bool IsValid(Type type, object? instance, out License? license)
258private static bool ValidateInternal(Type type, object? instance, bool allowExceptions, out License? license)
274private static bool ValidateInternalRecursive(LicenseContext context, Type type, object? instance, bool allowExceptions, out License? license, out string? licenseKey)
284Type providerType = attr.LicenseProvider!;
315Type? baseType = type.BaseType;
341public static void Validate(Type type)
355public static License? Validate(Type type, object? instance)
System\ComponentModel\ReflectPropertyDescriptor.cs (32)
65private readonly Type _componentClass; // used to determine if we should all on us or on the designer
66private readonly Type _type; // the data type of the property
76private readonly Type? _receiverType; // Only set if we are an extender
82Type componentClass,
84Type type,
117Type componentClass,
119Type type,
140[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass,
142Type type,
143Type receiverType,
161[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentClass,
286public override Type ComponentType => _componentClass;
335_propInfo = _componentClass.GetProperty(Name, bindingFlags, binder: null, PropertyType, Type.EmptyTypes, Array.Empty<ParameterModifier>());
348_getMethod = FindMethod(_componentClass, "Get" + Name, new Type[] { _receiverType }, _type);
373public override Type PropertyType => _type;
386Type[] args;
390args = Type.EmptyTypes;
394args = new Type[] { _receiverType };
424for (Type? t = _componentClass.BaseType; t != null && t != typeof(object); t = t.BaseType)
427PropertyInfo? p = t.GetProperty(name, bindingFlags, binder: null, PropertyType, Type.EmptyTypes, null);
448_propInfo = _componentClass.GetProperty(Name, bindingFlags, binder: null, PropertyType, Type.EmptyTypes, Array.Empty<ParameterModifier>());
458new Type[] { _receiverType, _type }, typeof(void));
478Type[] args;
482args = Type.EmptyTypes;
486args = new Type[] { _receiverType };
552internal Type? ExtenderGetReceiverType() => _receiverType;
554internal Type ExtenderGetType() => PropertyType;
788Type? currentReflectType = _componentClass;
814memberInfo = currentReflectType.GetMethod("Get" + Name, bindingFlags, binder: null, new Type[] { _receiverType! }, modifiers: null);
818memberInfo = currentReflectType.GetProperty(Name, bindingFlags, binder: null, PropertyType, Type.EmptyTypes, Array.Empty<ParameterModifier>());
840Type? specificType = Type.GetType(sta.TypeName!);
System\ComponentModel\ReflectTypeDescriptionProvider.cs (77)
27private readonly ConcurrentDictionary<Type, ReflectedTypeData> _typeData = new ConcurrentDictionary<Type, ReflectedTypeData>();
33private static readonly Type[] s_typeConstructor = { typeof(Type) };
64private static readonly Type[] s_skipInterfaceAttributeList = InitializeSkipInterfaceAttributeList();
74private static Type[] InitializeSkipInterfaceAttributeList()
76return new Type[]
101private readonly Func<Type, TypeConverter> _constructionFunc;
117public IntrinsicTypeConverterData(Func<Type, TypeConverter> constructionFunc, bool cacheConverterInstance = true)
123public TypeConverter GetOrCreateConverterInstance(Type innerType)
143/// appropriate logic to handle this in <see cref="GetIntrinsicTypeConverter(Type)"/> below.
194private static NullableConverter CreateNullableConverter(Type type) => new NullableConverter(type);
221internal static void AddEditorTable(Type editorBaseType, Hashtable table)
242[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
243Type[]? argTypes,
258argTypes = new Type[args.Length];
273argTypes = Type.EmptyTypes;
283public override bool IsRegisteredType(Type type)
300[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
301Type callingType)
310internal AttributeCollection GetAttributes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
343internal string? GetClassName([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
352internal string? GetClassNameFromRegisteredType(Type type)
371internal TypeConverter GetConverter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
377internal TypeConverter GetConverterFromRegisteredType(Type type, object? instance)
388internal EventDescriptor? GetDefaultEvent([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
398internal PropertyDescriptor? GetDefaultProperty([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
408internal object? GetEditor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance, Type editorBaseType)
418private static Hashtable? GetEditorTable(Type editorBaseType)
464internal EventDescriptorCollection GetEvents([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
470internal EventDescriptorCollection GetEventsFromRegisteredType(Type type)
534internal object? GetExtendedEditor(object instance, Type editorBaseType)
563Type componentType = instance.GetType();
615Type? receiverType = eppa.ReceiverType;
829public override ICustomTypeDescriptor? GetTypeDescriptorFromRegisteredType(Type objectType, object? instance)
861internal Type[] GetPopulatedTypes(Module module)
863List<Type> typeList = new List<Type>();
865foreach (KeyValuePair<Type, ReflectedTypeData> kvp in _typeData)
880internal PropertyDescriptorCollection GetProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
889internal PropertyDescriptorCollection GetPropertiesFromRegisteredType(Type type)
898internal static object GetPropertyOwner(Type type, object instance)
908public override Type GetReflectionType(
909[DynamicallyAccessedMembers(TypeDescriptor.ReflectTypesDynamicallyAccessedMembers)] Type objectType,
921private ReflectedTypeData? GetTypeData([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, bool createIfNeeded)
959private ReflectedTypeData GetTypeDataFromRegisteredType(Type type)
983Type componentType = typeof(T);
1002private ReflectedTypeData GetOrRegisterType(Type type)
1034public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
1046private static Type? GetTypeFromName(
1050Type? t = Type.GetType(typeName);
1067t = Type.GetType(typeName.Substring(0, commaIndex));
1080internal bool IsPopulated(Type type)
1097internal static Attribute[] ReflectGetAttributes(Type type)
1153private static EventDescriptor[] ReflectGetEvents(Type type)
1254Type providerType = provider.GetType();
1277Type? receiverType = GetTypeFromName(provideAttr.ReceiverTypeName);
1281MethodInfo? getMethod = providerType.GetMethod("Get" + provideAttr.PropertyName, new Type[] { receiverType });
1285MethodInfo? setMethod = providerType.GetMethod("Set" + provideAttr.PropertyName, new Type[] { receiverType, getMethod.ReturnType });
1330[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type) =>
1333private static PropertyDescriptor[] ReflectGetPropertiesFromRegisteredType(Type type)
1338private static PropertyDescriptor[] ReflectGetPropertiesImpl(Type type)
1422internal void Refresh(Type type)
1438private static object? GetIntrinsicTypeEditor(Hashtable table, Type callingType)
1449Type? baseType = callingType;
1460hashEntry = Type.GetType(typeString);
1485Type? keyType = de.Key as Type;
1494hashEntry = Type.GetType(typeString);
1536Type? type = hashEntry as Type;
1556private static TypeConverter GetIntrinsicTypeConverter(Type callingType)
1594Type? key = null;
1596Type? baseType = callingType.BaseType;
1622private static bool IsIntrinsicType(Type callingType)
System\ComponentModel\TimeOnlyConverter.cs (5)
20public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
26public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
77public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
95return new InstanceDescriptor(typeof(TimeOnly).GetConstructor(new Type[] { typeof(long) }), new object[] { time.Ticks });
98return new InstanceDescriptor(typeof(TimeOnly).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(int), typeof(int) }),
System\ComponentModel\TypeConverter.cs (13)
22public bool CanConvertFrom(Type sourceType) => CanConvertFrom(null, sourceType);
28public virtual bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
35public bool CanConvertTo([NotNullWhen(true)] Type? destinationType) => CanConvertTo(null, destinationType);
41public virtual bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
104public object? ConvertTo(object? value, Type destinationType)
113public virtual object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
202protected Exception GetConvertToException(object? value, Type destinationType)
349protected SimplePropertyDescriptor(Type componentType, string name, Type propertyType) : this(componentType, name, propertyType, Array.Empty<Attribute>())
356protected SimplePropertyDescriptor(Type componentType, string name, Type propertyType, Attribute[]? attributes) : base(name, attributes)
365public override Type ComponentType { get; }
380public override Type PropertyType { get; }
System\ComponentModel\TypeDescriptor.cs (102)
60private static readonly ConcurrentDictionary<Type, TypeDescriptionNode> s_providerTypeTable = new ConcurrentDictionary<Type, TypeDescriptionNode>();
65private static readonly ConcurrentDictionary<Type, object?> s_defaultProviderInitialized = new ConcurrentDictionary<Type, object?>();
136public static Type InterfaceType
170internal static void ValidateRegisteredType(Type type)
190public static TypeDescriptionProvider AddAttributes(Type type, params Attribute[] attributes)
231public static void AddEditorTable(Type editorBaseType, Hashtable table)
246public static void AddProvider(TypeDescriptionProvider provider, Type type)
306public static void AddProviderTransparent(TypeDescriptionProvider provider, Type type)
335private static void CheckDefaultProvider(Type type)
352private static void AddDefaultProvider(Type type)
374Type? providerType = Type.GetType(pa.TypeName);
386Type? baseType = type.BaseType;
452[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
454Type type,
465[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
479[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
480Type[]? argTypes,
512[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
514Type type,
526[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
607public static object GetAssociation(Type type, object primary)
677public static AttributeCollection GetAttributes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
809[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
864public static TypeConverter GetConverter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
871internal static TypeConverter GetConverterTrimUnsafe([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type) =>
877public static TypeConverter GetConverterFromRegisteredType(Type type)
884private static object? ConvertFromInvariantString([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string stringValue)
894[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
932[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
970[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
984private static DefaultTypeDescriptor GetDescriptorFromRegisteredType(Type type,
1057public static object? GetEditor(object component, Type editorBaseType)
1068public static object? GetEditor(object component, Type editorBaseType, bool noCustomTypeDesc)
1080[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
1081Type editorBaseType)
1092[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
1106public static EventDescriptorCollection GetEventsFromRegisteredType(Type componentType)
1118[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
1311private static Type? GetNodeForBaseType(Type searchType)
1329[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
1343public static PropertyDescriptorCollection GetPropertiesFromRegisteredType(Type componentType)
1355[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
1526public static TypeDescriptionProvider GetProvider(Type type)
1594internal static TypeDescriptionProvider GetProviderRecursive(Type type)
1604public static Type GetReflectionType([DynamicallyAccessedMembers(ReflectTypesDynamicallyAccessedMembers)] Type type)
1616public static Type GetReflectionType(object instance)
1630private static TypeDescriptionNode NodeFor(Type type) => NodeFor(type, false);
1647private static TypeDescriptionNode NodeFor(Type type, bool createDelegator)
1659Type searchType = type;
1670Type? baseType = GetNodeForBaseType(searchType);
1742Type type = instance.GetType();
1853Type keyType = key as Type ?? key.GetType();
2291private static void RaiseRefresh(Type type)
2320Type type = component.GetType();
2333Type? nodeType = de.Key as Type;
2391public static void Refresh(Type type)
2417Type? nodeType = de.Key as Type;
2478Type? nodeType = de.Key as Type;
2492Type[] populatedTypes = provider.GetPopulatedTypes(module);
2494foreach (Type populatedType in populatedTypes)
2508foreach (Type t in refreshedTypes.Keys)
2534public static Type ComObjectType
2542public static IDesigner? CreateDesigner(IComponent component, Type designerBaseType)
2544Type? type = null;
2551Type? type2 = Type.GetType(designerAttribute.DesignerBaseTypeName);
2564type = Type.GetType(designerAttribute.DesignerTypeName);
2662public static void RemoveProvider(TypeDescriptionProvider provider, Type type)
2697public static void RemoveProviderTransparent(TypeDescriptionProvider provider, Type type)
2778public override ICustomTypeDescriptor? GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
2837object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
2889public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3056Type realComNativeDescriptor = Type.GetType("System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor, System.Windows.Forms", throwOnError: true)!;
3061public override ICustomTypeDescriptor? GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3151object? ICustomTypeDescriptor.GetEditor(Type editorBaseType)
3246[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
3247Type[]? argTypes,
3297Type type = instance.GetType();
3335public override Type GetReflectionType(
3336[DynamicallyAccessedMembers(ReflectTypesDynamicallyAccessedMembers)] Type objectType,
3344public override Type GetRuntimeType(Type objectType)
3355public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3371public override ICustomTypeDescriptor GetTypeDescriptorFromRegisteredType(Type objectType, object? instance)
3392internal DefaultTypeDescriptor GetDefaultTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType)
3397public override bool IsSupportedType(Type type)
3406public override bool IsRegisteredType(Type type) => Provider.IsRegisteredType(type);
3585object? ICustomTypeDescriptor.GetEditor(Type editorBaseType)
3775private readonly Type _objectType;
3783[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType,
3979public object? GetEditor(Type editorBaseType)
4212internal static void ThrowInvalidOperationException_RegisterTypeRequired(Type type) =>
System\ComponentModel\VersionConverter.cs (4)
22public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
31public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
66public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
74ConstructorInfo? ctor = typeof(Version).GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) }, null);
System\Drawing\ColorConverter.cs (6)
28public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
33public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
48public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
111member = typeof(Color).GetMethod("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) });
116member = typeof(Color).GetMethod("FromName", new Type[] { typeof(string) });
121member = typeof(Color).GetMethod("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int) });
System.Composition.AttributedModel (8)
System.Composition.Convention (69)
System\Composition\Convention\ExportConventionBuilder.cs (9)
19private Type _contractType;
21private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
22private Func<Type, string> _getContractNameFromPartType;
41public ExportConventionBuilder AsContractType(Type type)
77public ExportConventionBuilder AsContractName(Func<Type, string> getContractNameFromPartType)
117public ExportConventionBuilder AddMetadata(string name, Func<Type, object> getValueFromPartType)
133_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
138internal void BuildAttributes(Type type, ref List<Attribute> attributes)
157foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
System\Composition\Convention\ImportConventionBuilder.cs (8)
15private static readonly Type[] s_supportedImportManyTypes = new[] { typeof(IList<>), typeof(ICollection<>), typeof(IEnumerable<>) };
20private Func<Type, string> _getContractNameFromPartType;
22private List<Tuple<string, Func<Type, object>>> _metadataConstraintItemFuncs;
51public ImportConventionBuilder AsContractName(Func<Type, string> getContractNameFromPartType)
122public ImportConventionBuilder AddMetadataConstraint(string name, Func<Type, object> getConstraintValueFromPartType)
138_metadataConstraintItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
143internal void BuildAttributes(Type type, ref List<Attribute> attributes)
178foreach (Tuple<string, Func<Type, object>> item in _metadataConstraintItemFuncs)
System\Composition\Convention\PartConventionBuilder.cs (31)
16private readonly Type[] _emptyTypeArray = Type.EmptyTypes;
19private static readonly Type s_exportAttributeType = typeof(ExportAttribute);
26private List<Tuple<string, Func<Type, object>>> _metadataItemFuncs;
33private readonly List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportConventionBuilder>, Type>> _propertyExports;
35private readonly List<Tuple<Predicate<Type>, Action<Type, ExportConventionBuilder>>> _interfaceExports;
38internal Predicate<Type> SelectType { get; }
40internal PartConventionBuilder(Predicate<Type> selectType)
44_propertyExports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportConventionBuilder>, Type>>();
46_interfaceExports = new List<Tuple<Predicate<Type>, Action<Type, ExportConventionBuilder>>>();
148public PartConventionBuilder ExportInterfaces(Predicate<Type> interfaceFilter)
173public PartConventionBuilder ExportInterfaces(Predicate<Type> interfaceFilter,
174Action<Type, ExportConventionBuilder> exportConfiguration)
188private PartConventionBuilder ExportInterfacesImpl(Predicate<Type> interfaceFilter,
189Action<Type, ExportConventionBuilder> exportConfiguration)
234_propertyExports.Add(Tuple.Create(propertyFilter, exportConfiguration, default(Type)));
447public PartConventionBuilder AddPartMetadata(string name, Func<Type, object> getValueFromPartType)
463_metadataItemFuncs ??= new List<Tuple<string, Func<Type, object>>>();
478Type attrType = attr.GetType();
489internal IEnumerable<Attribute> BuildTypeAttributes(Type type)
553foreach (Tuple<string, Func<Type, object>> item in _metadataItemFuncs)
573foreach (Type iface in type.GetTypeInfo().ImplementedInterfaces)
581foreach (Tuple<Predicate<Type>, Action<Type, ExportConventionBuilder>> exportSpecification in _interfaceExports)
598internal bool BuildConstructorAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
636internal static void BuildDefaultConstructorAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
677internal void BuildOnImportsSatisfiedNotification(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
731internal void BuildPropertyAttributes(Type type, ref List<Tuple<object, List<Attribute>>> configuredMembers)
782foreach (Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportConventionBuilder>, Type> exportSpecification in _propertyExports)
System.Composition.Hosting (4)
System.Composition.Runtime (14)
System.Composition.TypedParts (55)
System\Composition\Convention\AttributedModelProviderExtensions.cs (6)
14public static TAttribute GetDeclaredAttribute<TAttribute>(this AttributedModelProvider convention, Type reflectedType, MemberInfo member) where TAttribute : Attribute
19public static Attribute[] GetDeclaredAttributes(this AttributedModelProvider convention, Type reflectedType, MemberInfo member)
24public static TAttribute[] GetDeclaredAttributes<TAttribute>(this AttributedModelProvider convention, Type reflectedType, MemberInfo member) where TAttribute : Attribute
29public static TAttribute GetDeclaredAttribute<TAttribute>(this AttributedModelProvider convention, Type reflectedType, ParameterInfo parameter) where TAttribute : Attribute
34public static Attribute[] GetDeclaredAttributes(this AttributedModelProvider convention, Type reflectedType, ParameterInfo parameter)
39public static TAttribute[] GetDeclaredAttributes<TAttribute>(this AttributedModelProvider convention, Type reflectedType, ParameterInfo parameter) where TAttribute : Attribute
System\Composition\Hosting\ContainerConfiguration.cs (11)
24private readonly List<Tuple<IEnumerable<Type>, AttributedModelProvider>> _types = new List<Tuple<IEnumerable<Type>, AttributedModelProvider>>();
88public ContainerConfiguration WithPart(Type partType)
100public ContainerConfiguration WithPart(Type partType, AttributedModelProvider conventions)
135public ContainerConfiguration WithParts(params Type[] partTypes)
137return WithParts((IEnumerable<Type>)partTypes);
146public ContainerConfiguration WithParts(IEnumerable<Type> partTypes)
158public ContainerConfiguration WithParts(IEnumerable<Type> partTypes, AttributedModelProvider conventions)
260public ContainerConfiguration WithExport(Type contractType, object exportedInstance)
282public ContainerConfiguration WithExport(Type contractType, object exportedInstance, string contractName = null, IDictionary<string, object> metadata = null)
301internal Tuple<IEnumerable<Type>, AttributedModelProvider>[] DebugGetRegisteredTypes()
System.Configuration.ConfigurationManager (132)
System\Configuration\TypeUtil.cs (17)
40private static Type GetImplicitType(string typeString)
63Type type = configurationAssembly.GetType(typeString, false);
73Type type = Type.GetType($"{typeString}, {assembly}");
86internal static Type GetType(string typeString, bool throwOnError)
88Type type;
92type = Type.GetType(typeString, throwOnError);
109internal static Type GetType(IInternalConfigHost host, string typeString, bool throwOnError)
111Type type;
130Type type = GetType(typeString, true);
135internal static object CreateInstance(Type type)
140internal static ConstructorInfo GetConstructor(Type type, Type baseType, bool throwOnError)
148ConstructorInfo ctor = type.GetConstructor(BindingFlags, null, CallingConventions.HasThis, Type.EmptyTypes,
156internal static Type VerifyAssignableType(Type baseType, Type type, bool throwOnError)
System.Data.Common (324)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (22)
188internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, string value, string method)
233private static readonly Type s_stackOverflowType = typeof(StackOverflowException);
234private static readonly Type s_outOfMemoryType = typeof(OutOfMemoryException);
235private static readonly Type s_threadAbortType = typeof(ThreadAbortException);
236private static readonly Type s_nullReferenceType = typeof(NullReferenceException);
237private static readonly Type s_accessViolationType = typeof(AccessViolationException);
238private static readonly Type s_securityType = typeof(SecurityException);
244Type type = e.GetType();
264Type type = e.GetType();
274internal static ArgumentOutOfRangeException InvalidEnumerationValue(Type type, int value)
290internal static ArgumentException ConvertFailed(Type fromType, Type toType, Exception? innerException)
310internal static ArgumentException CollectionRemoveInvalidObject(Type itemType, ICollection collection)
314internal static ArgumentNullException CollectionNullValue(string parameter, Type collection, Type itemType)
318internal static IndexOutOfRangeException CollectionIndexInt32(int index, Type collection, int count)
322internal static IndexOutOfRangeException CollectionIndexString(Type itemType, string propertyName, string propertyValue, Type collection)
326internal static InvalidCastException CollectionInvalidType(Type collection, Type itemType, object invalidValue)
396internal static ArgumentException ParametersIsNotParent(Type parameterType, ICollection collection)
400internal static ArgumentException ParametersIsParent(Type parameterType, ICollection collection)
System\Data\Common\DataColumnMapping.cs (7)
74public DataColumn? GetDataColumnBySchemaAction(DataTable dataTable, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type? dataType, MissingSchemaAction schemaAction)
80public static DataColumn? GetDataColumnBySchemaAction(string? sourceColumn, string? dataSetColumn, DataTable dataTable, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type? dataType, MissingSchemaAction schemaAction)
115internal static DataColumn? CreateDataColumnBySchemaAction(string? sourceColumn, string? dataSetColumn, DataTable dataTable, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type? dataType, MissingSchemaAction schemaAction)
150public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
159public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
171Type[] types = new Type[] { typeof(string), typeof(string) };
System\Data\Common\DataStorage.cs (24)
66private static readonly Type?[] s_storageClassType = new Type?[] {
90typeof(Type),
115internal readonly Type _dataType;
127private static readonly Func<Type, Tuple<bool, bool, bool, bool>> s_inspectTypeForInterfaces = InspectTypeForInterfaces;
128private static readonly ConcurrentDictionary<Type, Tuple<bool, bool, bool, bool>> s_typeImplementsInterface = new ConcurrentDictionary<Type, Tuple<bool, bool, bool, bool>>();
130protected DataStorage(DataColumn column, Type type, object? defaultValue, StorageType storageType)
135protected DataStorage(DataColumn column, Type type, object? defaultValue, object nullValue, StorageType storageType)
140protected DataStorage(DataColumn column, Type type, object? defaultValue, object nullValue, bool isICloneable, StorageType storageType)
295public static DataStorage CreateStorage(DataColumn column, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType, StorageType typeCode)
362internal static StorageType GetStorageType(Type? dataType)
371TypeCode tcode = Type.GetTypeCode(dataType);
379internal static Type GetTypeStorage(StorageType storageType)
385internal static bool IsTypeCustomType(Type type)
400public static bool IsSqlType(Type dataType)
412private static bool DetermineIfValueType(StorageType typeCode, Type dataType)
471Type dataType,
511private static Tuple<bool, bool, bool, bool> InspectTypeForInterfaces(Type dataType)
522internal static bool ImplementsINullableValue(StorageType typeCode, Type dataType)
572internal static Type GetType(string value)
574Type? dataType = Type.GetType(value); // throwOnError=false, ignoreCase=fase
593internal static string GetQualifiedName(Type type)
System\Data\Common\DataTableMapping.cs (5)
115public DataColumn? GetDataColumn(string sourceColumn, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type? dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction)
172public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
181public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
195Type[] types = new Type[] { typeof(string), typeof(string), typeof(DataColumnMapping[]) };
System\Data\Common\ObjectStorage.cs (31)
30internal ObjectStorage(DataColumn column, Type type)
193private static Families GetFamily(Type dataType)
195switch (Type.GetTypeCode(dataType))
246Type valType = value.GetType();
321Type type = _dataType; // real type of objects in this column
327if (type == typeof(Type))
329return Type.GetType(s)!;
369Type? type = null;
401retValue = Type.GetType(xmlReader.ReadString());
467Type type = _dataType;
472if ((type == typeof(Type)) || ((type == typeof(object)) && (value is Type)))
474return ((Type)value).AssemblyQualifiedName!;
482if (Type.GetTypeCode(value.GetType()) != TypeCode.Object)
552private static Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>? s_tempAssemblyCache;
562internal static void VerifyIDynamicMetaObjectProvider(Type type)
573internal static XmlSerializer GetXmlSerializer(Type type)
586internal static XmlSerializer GetXmlSerializer(Type type, XmlRootAttribute attribute)
589KeyValuePair<Type, XmlRootAttribute> key = new KeyValuePair<Type, XmlRootAttribute>(type, attribute);
592Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>? cache = s_tempAssemblyCache;
609Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer> tmp =
610new Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>(
612foreach (KeyValuePair<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer> entry in cache)
620cache = new Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>(
626key = new KeyValuePair<Type, XmlRootAttribute>(type, new XmlRootAttribute());
641private sealed class TempAssemblyComparer : IEqualityComparer<KeyValuePair<Type, XmlRootAttribute>>
643internal static readonly IEqualityComparer<KeyValuePair<Type, XmlRootAttribute>> s_default = new TempAssemblyComparer();
647public bool Equals(KeyValuePair<Type, XmlRootAttribute> x, KeyValuePair<Type, XmlRootAttribute> y)
658public int GetHashCode(KeyValuePair<Type, XmlRootAttribute> obj)
System\Data\DataColumn.cs (13)
36private Type _dataType = null!; // Always set in UpdateColumnType
103public DataColumn(string? columnName, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType) : this(columnName, dataType, null, MappingType.Element)
113public DataColumn(string? columnName, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType, string? expr) : this(columnName, dataType, expr, MappingType.Element)
124public DataColumn(string? columnName, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType, string? expr, MappingType type)
156private void UpdateColumnType([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type type, StorageType typeCode)
478public Type DataType
1484Type leftType = value.GetType();
1485Type rightType = _storage!.Get(record1).GetType();
1611internal static bool IsAutoIncrementType(Type dataType) =>
1631(DataStorage.IsTypeCustomType(value.GetType()) && !(value is Type));
1877internal abstract Type DataType { get; }
1914internal override Type DataType => typeof(long);
1995internal override Type DataType => typeof(BigInteger);
System\Data\DataException.cs (13)
374public static Exception TypeNotAllowed(Type type) => _InvalidOperation(SR.Format(SR.Data_TypeNotAllowed, type.AssemblyQualifiedName));
486public static Exception DefaultValueDataType(string column, Type defaultType, Type columnType, Exception inner) =>
491public static Exception DefaultValueColumnDataType(string column, Type defaultType, Type columnType, Exception inner) => _Argument(SR.Format(SR.DataColumn_DefaultValueColumnDataType, column, defaultType.FullName, columnType.FullName), inner);
503public static Exception SetFailed(object? value, DataColumn column, Type type, Exception innerException) => _Argument(innerException.Message + SR.Format(SR.DataColumn_SetFailed, value?.ToString(), column.ColumnName, type.Name), innerException);
508public static Exception CannotSetSimpleContentType(string columnName, Type type) => _Argument(SR.Format(SR.DataColumn_CannotSimpleContentType, columnName, type));
509public static Exception CannotSetSimpleContent(string columnName, Type type) => _Argument(SR.Format(SR.DataColumn_CannotSimpleContent, columnName, type));
517public static Exception InvalidDataColumnMapping(Type type) => _Argument(SR.Format(SR.DataColumn_InvalidDataColumnMapping, type.AssemblyQualifiedName));
648public static Exception InvalidSchemaSerializationMode(Type enumType, string mode) => _InvalidEnumArgumentException(SR.Format(SR.ADP_InvalidEnumerationValue, enumType.Name, mode));
680public static Exception AggregateException(AggregateType aggregateType, Type type) => _Data(SR.Format(SR.DataStorage_AggregateException, aggregateType, type.Name));
741public static Exception ConvertFailed(Type type1, Type type2) => _Data(SR.Format(SR.SqlConvert_ConvertFailed, type1.FullName, type2.FullName));
System\Data\DataSet.cs (12)
1924/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1927public void WriteXmlSchema(Stream? stream, Converter<Type, string> multipleTargetConverter)
1941/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1944public void WriteXmlSchema(string fileName, Converter<Type, string> multipleTargetConverter)
1958/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1961public void WriteXmlSchema(TextWriter? writer, Converter<Type, string> multipleTargetConverter)
1975/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1978public void WriteXmlSchema(XmlWriter? writer, Converter<Type, string> multipleTargetConverter)
1986private void WriteXmlSchema(string fileName, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
2004private void WriteXmlSchema(Stream? stream, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
2019private void WriteXmlSchema(TextWriter? writer, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
2034private void WriteXmlSchema(XmlWriter? writer, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
System\Data\Filter\FunctionNode.cs (14)
280private Type GetDataType(ExpressionNode node)
282Type nodeType = node.GetType();
296throw ExprException.ArgumentType(s_funcs[_info]._name, 2, typeof(Type));
299Type? dataType = Type.GetType(typeName);
486Type type = (Type)argumentValues[1];
666internal readonly Type _result;
670internal readonly Type?[] _parameters = new Type?[] { null, null, null };
682internal Function(string name, FunctionId id, Type result, bool IsValidateArguments,
683bool IsVariantArgumentList, int argumentCount, Type? a1, Type? a2, Type? a3)
System\Data\RelationshipConverter.cs (4)
22public override bool CanConvertTo(ITypeDescriptorContext? context, [NotNullWhen(true)] Type? destinationType)
38public override object? ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
53ctor = typeof(DataRelation).GetConstructor(new Type[] { typeof(string) /*relationName*/, typeof(string) /*parentTableName*/, typeof(string) /*childTableName */,
60ctor = typeof(DataRelation).GetConstructor(new Type[] { typeof(string)/*relationName*/, typeof(string)/*parentTableName*/, typeof(string)/*parentTableNamespace*/,
System.Data.Odbc (43)
Common\System\Data\Common\AdapterUtil.Odbc.cs (8)
304internal static Exception UninitializedParameterSize(int index, Type dataType)
368internal static ArgumentException UnknownDataType(Type dataType)
372internal static ArgumentException DbTypeNotSupported(System.Data.DbType type, Type enumtype)
376internal static ArgumentException UnknownDataTypeCode(Type dataType, TypeCode typeCode)
389internal static Exception ParameterConversionFailed(object value, Type destType, Exception inner)
427internal static Exception ParametersSourceIndex(string parameterName, IDataParameterCollection collection, Type parameterType)
431internal static Exception ParameterNull(string parameter, IDataParameterCollection collection, Type parameterType)
435internal static Exception InvalidParameterType(IDataParameterCollection collection, Type parameterType, object invalidValue)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (22)
188internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, string value, string method)
233private static readonly Type s_stackOverflowType = typeof(StackOverflowException);
234private static readonly Type s_outOfMemoryType = typeof(OutOfMemoryException);
235private static readonly Type s_threadAbortType = typeof(ThreadAbortException);
236private static readonly Type s_nullReferenceType = typeof(NullReferenceException);
237private static readonly Type s_accessViolationType = typeof(AccessViolationException);
238private static readonly Type s_securityType = typeof(SecurityException);
244Type type = e.GetType();
264Type type = e.GetType();
274internal static ArgumentOutOfRangeException InvalidEnumerationValue(Type type, int value)
290internal static ArgumentException ConvertFailed(Type fromType, Type toType, Exception? innerException)
310internal static ArgumentException CollectionRemoveInvalidObject(Type itemType, ICollection collection)
314internal static ArgumentNullException CollectionNullValue(string parameter, Type collection, Type itemType)
318internal static IndexOutOfRangeException CollectionIndexInt32(int index, Type collection, int count)
322internal static IndexOutOfRangeException CollectionIndexString(Type itemType, string propertyName, string propertyValue, Type collection)
326internal static InvalidCastException CollectionInvalidType(Type collection, Type itemType, object invalidValue)
396internal static ArgumentException ParametersIsNotParent(Type parameterType, ICollection collection)
400internal static ArgumentException ParametersIsParent(Type parameterType, ICollection collection)
System\Data\Odbc\Odbc32.cs (6)
33internal static ArgumentOutOfRangeException NotSupportedEnumerationValue(Type type, int value)
797internal readonly Type _type;
808private TypeMap(OdbcType odbcType, DbType dbType, Type type, ODBC32.SQL_TYPE sql_type, ODBC32.SQL_C sql_c, ODBC32.SQL_C param_sql_c, int bsize, int csize, bool signType)
886internal static TypeMap FromSystemType(Type dataType)
888switch (Type.GetTypeCode(dataType))
931default: throw ADP.UnknownDataTypeCode(dataType, Type.GetTypeCode(dataType));
System.Data.OleDb (2)
System.Diagnostics.DiagnosticSource (28)
System\Diagnostics\DsesFilterAndTransform.cs (21)
417Type argType = args.GetType();
444new ConcurrentDictionary<Type, TransformSpec?>(1, 8), null);
570public Type? Type;
681Type? objType = obj?.GetType();
700public PropertyFetch(Type? type)
709internal Type? Type { get; }
715public static PropertyFetch FetcherForProperty(DiagnosticSourceEventSource eventSource, Type? type, string propertyName)
729foreach (Type iFaceType in typeInfo.GetInterfaces())
778private static PropertyFetch CreateEnumeratePropertyFetch(Type type, TypeInfo enumerableOfTType)
780Type elemType = enumerableOfTType.GetGenericArguments()[0];
787Type instantiatedTypedPropertyFetcher = typeof(EnumeratePropertyFetch<>)
794private static PropertyFetch CreatePropertyFetch(Type type, PropertyInfo propertyInfo)
802Type typedPropertyFetcher = type.IsValueType ?
804Type instantiatedTypedPropertyFetcher = typedPropertyFetcher.GetTypeInfo().MakeGenericType(
818public RefTypedFetchProperty(Type type, PropertyInfo property) : base(type)
837public ValueTypedFetchProperty(Type type, PropertyInfo property) : base(type)
860public ReflectionPropertyFetch(Type type, PropertyInfo property) : base(type)
873public EnumeratePropertyFetch(Type type) : base(type) { }
938public EnumeratePropertyFetch(Type type) : base(type) { }
995private static TransformSpec? MakeImplicitTransforms(DiagnosticSourceEventSource eventSource, Type type)
1028private ConcurrentDictionary<Type, TransformSpec?>? _implicitTransformsTable; // If there is more than one object type for an implicit transform, they go here.
System\Diagnostics\Metrics\Meter.cs (2)
524private static Instrument? GetCachedInstrument(List<Instrument> instrumentList, Type instrumentType, string? unit, string? description, IEnumerable<KeyValuePair<string, object?>>? tags)
540private Instrument GetOrCreateInstrument<T>(Type instrumentType, string name, string? unit, string? description, IEnumerable<KeyValuePair<string, object?>>? tags, Func<Instrument> instrumentCreator)
System.Diagnostics.TraceSource (9)
System.DirectoryServices (5)
System.DirectoryServices.AccountManagement (5)
System.DirectoryServices.Protocols (1)
System.Drawing.Common (25)
Special\NotSupported.cs (25)
26public Bitmap(System.Type type, string resource) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
369public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
370public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
372public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
381public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
391public FontUnitConverter() : base (default(System.Type)) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
707public Icon(System.Type type, string resource) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
729public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
730public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
732public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
822public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
823public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
825public override object ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
834public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type? sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
835public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
837public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1360public ToolboxBitmapAttribute(System.Type t) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1361public ToolboxBitmapAttribute(System.Type t, string name) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1366public System.Drawing.Image? GetImage(System.Type type) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1367public System.Drawing.Image? GetImage(System.Type type, bool large) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1368public System.Drawing.Image? GetImage(System.Type type, string? imgName, bool large) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
1369public static System.Drawing.Image? GetImageFromResource(System.Type t, string? imageName, bool large) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
2735public override bool CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type sourceType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
2736public override bool CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] System.Type? destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
2738public override object? ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type destinationType) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
System.Drawing.Common.Tests (13)
System\Drawing\Imaging\EncoderParameterTests.cs (4)
220public void Ctor_Encoder_Numerator1Array_Denominator1Array_Numerator2Array_Denominator2Array_InvalidParameters_ThrowsExpected(int[]? numerator1, int[]? denominator1, int[]? numerator2, int[]? denominator2, Type expected)
237public void Ctor_Numerator_Denominator_IvalidValues_ThrowsExpected(int[]? numerator, int[]? denominator, Type expected)
247public void Ctor_RangeBegin_RangeEnd_InvalidValues_ThrowsExpected(long[]? rangeBegin, long[]? rangeEnd, Type expected)
308public void Ctor_Encoder_TooBigNumberOfValues_Type_Value_AccessViolationException(EncoderParameterValueType type, int numberOfValues, Type expected)
System.Drawing.Primitives (1)
System.Formats.Asn1 (13)
System.Formats.Nrbf (11)
System.IO.FileSystem.AccessControl (5)
System.IO.IsolatedStorage (6)
System.IO.Packaging (2)
System.IO.Pipes.AccessControl (3)
System.Linq (1)
System.Linq.Expressions (916)
System\Dynamic\Utils\DelegateHelpers.cs (24)
23public static Func<Type, Func<object?[], object?>, Delegate> CreateObjectArrayDelegate { get; }
26private static Func<Type, Func<object?[], object?>, Delegate> CreateObjectArrayDelegateInternal()
33return Type.GetType("Internal.Runtime.Augments.DynamicDelegateAugments, System.Private.CoreLib", throwOnError: true)!
35.CreateDelegate<Func<Type, Func<object?[], object?>, Delegate>>();
39return new Func<Type, Func<object?[], object?>, Delegate>((_x, _y) => throw new NotImplementedException());
55internal static Delegate CreateObjectArrayDelegate(Type delegateType, Func<object?[], object?> handler)
70private static readonly CacheDict<Type, MethodInfo> s_thunks = new CacheDict<Type, MethodInfo>(256);
111Type delHelpers = typeof(DelegateHelpers);
119Type delHelpers = typeof(DelegateHelpers);
128private static MethodInfo? GetCSharpThunk(Type returnType, bool hasReturnValue, ParameterInfo[] parameters)
144Type parameterType = parameter.ParameterType;
155Type[] thunkTypeArgs = thunkTypeArgCount == 0 ? Type.EmptyTypes : new Type[thunkTypeArgCount];
201private static Delegate CreateObjectArrayDelegateRefEmit(Type delegateType, Func<object?[], object?> handler)
207Type returnType = delegateInvokeMethod.ReturnType;
234Type[] paramTypes = new Type[parameters.Length + 1];
277Type paramType = parameters[i].ParameterType;
291Type boxType = ConvertToBoxableType(paramType);
319Type byrefToType = parameters[i].ParameterType.GetElementType()!;
348private static Type ConvertToBoxableType(Type t)
System\Dynamic\Utils\TypeUtils.cs (97)
15private static readonly Type[] s_arrayAssignableInterfaces = typeof(int[]).GetInterfaces()
22public static Type GetNonNullableType(this Type type) => IsNullableType(type) ? type.GetGenericArguments()[0] : type;
25public static Type GetNullableType(this Type type)
40public static Type LiftPrimitiveOrThrow(this Type type)
93public static ConstructorInfo GetNullableConstructor(Type nullableType)
100public static bool IsNullableType(this Type type) => type.IsConstructedGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
102public static bool IsNullableOrReferenceType(this Type type) => !type.IsValueType || IsNullableType(type);
104public static bool IsBool(this Type type) => GetNonNullableType(type) == typeof(bool);
106public static bool IsNumeric(this Type type)
131public static bool IsInteger(this Type type)
153public static bool IsInteger64(this Type type)
169public static bool IsArithmetic(this Type type)
191public static bool IsUnsignedInt(this Type type)
208public static bool IsIntegerOrBool(this Type type)
231public static bool IsNumericOrBool(this Type type) => IsNumeric(type) || IsBool(type);
234public static bool IsValidInstanceType(MemberInfo member, Type instanceType)
236Type? targetType = member.DeclaringType;
274static Type[] GetTypeInterfaces(Type instanceType) => instanceType.GetInterfaces();
275foreach (Type interfaceType in GetTypeInterfaces(instanceType))
288public static bool HasIdentityPrimitiveOrNullableConversionTo(this Type source, Type dest)
319public static bool HasReferenceConversionTo(this Type source, Type dest)
331Type nnSourceType = GetNonNullableType(source);
332Type nnDestType = GetNonNullableType(dest);
364private static bool StrictHasReferenceConversionTo(this Type source, Type dest, bool skipNonArray)
439private static bool HasArrayToInterfaceConversion(Type source, Type dest)
447Type[] destParams = dest.GetGenericArguments();
453Type destGen = dest.GetGenericTypeDefinition();
455foreach (Type iface in s_arrayAssignableInterfaces)
466private static bool HasInterfaceToArrayConversion(Type source, Type dest)
474Type[] sourceParams = source.GetGenericArguments();
480Type sourceGen = source.GetGenericTypeDefinition();
482foreach (Type iface in s_arrayAssignableInterfaces)
493private static bool IsCovariant(Type t)
499private static bool IsContravariant(Type t)
505private static bool IsInvariant(Type t)
511private static bool IsDelegate(Type t)
517public static bool IsLegalExplicitVariantDelegateConversion(Type source, Type dest)
536Type genericDelegate = source.GetGenericTypeDefinition();
543Type[] genericParameters = genericDelegate.GetGenericArguments();
544Type[] sourceArguments = source.GetGenericArguments();
545Type[] destArguments = dest.GetGenericArguments();
555Type sourceArgument = sourceArguments[iParam];
556Type destArgument = destArguments[iParam];
566Type genericParameter = genericParameters[iParam];
591public static bool IsConvertible(this Type type)
620public static bool HasReferenceEquality(Type left, Type right)
637public static bool HasBuiltInEqualityOperator(Type left, Type right)
674Type nnType = GetNonNullableType(left);
678public static bool IsImplicitlyConvertibleTo(this Type source, Type destination) =>
687public static MethodInfo? GetUserDefinedCoercionMethod(Type convertFrom, Type convertToType)
689Type nnExprType = GetNonNullableType(convertFrom);
690Type nnConvType = GetNonNullableType(convertToType);
721private static MethodInfo? FindConversionOperator(MethodInfo[] methods, Type? typeFrom, Type? typeTo)
738private static bool IsImplicitNumericConversion(Type source, Type destination)
856private static bool IsImplicitReferenceConversion(Type source, Type destination) =>
859private static bool IsImplicitBoxingConversion(Type source, Type destination) =>
862private static bool IsImplicitNullableConversion(Type source, Type destination) =>
865public static Type? FindGenericType(Type definition, Type? type)
894public static MethodInfo? GetBooleanOperator(Type type, string name)
912public static Type GetNonRefType(this Type type) => type.IsByRef ? type.GetElementType()! : type;
914public static bool AreEquivalent(Type? t1, Type? t2) => t1 != null && t1.IsEquivalentTo(t2);
916public static bool AreReferenceAssignable(Type dest, Type src)
927public static bool IsSameOrSubclass(Type type, Type subType) =>
930public static void ValidateType(Type type, string? paramName) => ValidateType(type, paramName, false, false);
932public static void ValidateType(Type type, string? paramName, bool allowByRef, bool allowPointer)
948public static bool ValidateType(Type type, string? paramName, int index)
967public static MethodInfo GetInvokeMethod(this Type delegateType)
973internal static bool IsUnsigned(this Type type) => IsUnsigned(GetNonNullableType(type).GetTypeCode());
991internal static bool IsFloatingPoint(this Type type) => IsFloatingPoint(GetNonNullableType(type).GetTypeCode());
1008public static MethodInfo GetArrayGetMethod(Type arrayType)
1016public static MethodInfo GetArraySetMethod(Type arrayType)
1024public static MethodInfo GetArrayAddressMethod(Type arrayType)
System\Linq\Expressions\BinaryExpression.cs (51)
313internal static BinaryExpression Create(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo? method, LambdaExpression? conversion)
336Type left = Left.Type;
337Type right = Right.Type;
354Type left = Left.Type;
355Type right = Right.Type;
466public sealed override Type Type => typeof(bool);
493public sealed override Type Type => Left.Type;
525public sealed override Type Type => Right.Type;
535internal OpAssignMethodConversionBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression conversion)
548internal SimpleBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type)
557public sealed override Type Type { get; }
566internal MethodBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method)
613Type nnLeftType = left.Type.GetNonNullableType();
614Type nnRightType = right.Type.GetNonNullableType();
717private static MethodInfo? GetUserDefinedBinaryOperator(ExpressionType binaryType, Type leftType, Type rightType, string name)
721Type[] types = new Type[] { leftType, rightType };
722Type nnLeftType = leftType.GetNonNullableType();
723Type nnRightType = rightType.GetNonNullableType();
737private static bool IsLiftingConditionalLogicalOperator(Type left, Type right, MethodInfo? method, ExpressionType binaryType)
745internal static bool ParameterIsAssignable(ParameterInfo pi, Type argType)
747Type pType = pi.ParameterType;
753private static void ValidateParamsWithOperandsOrThrow(Type paramType, Type operandType, ExpressionType exprType, string name)
799private static void ValidateUserDefinedConditionalLogicOperator(ExpressionType nodeType, Type left, Type right, MethodInfo method)
827Type? declaringType = method.DeclaringType;
843private static void VerifyOpTrueFalse(ExpressionType nodeType, Type left, MethodInfo opTrue, string paramName)
856private static bool IsValidLiftedConditionalLogicalOperator(Type left, Type right, ParameterInfo[] pms)
1270Type returnType;
1323Type returnType;
1383Type resultType = ValidateCoalesceArgTypes(left.Type, right.Type);
1392Type delegateType = conversion.Type;
1423private static Type ValidateCoalesceArgTypes(Type left, Type right)
1425Type leftStripped = left.GetNonNullableType();
1548Type delegateType = conversion.Type;
2230private static bool IsSimpleShift(Type left, Type right)
2236private static Type GetResultTypeOfShift(Type left, Type right)
2275Type resultType = GetResultTypeOfShift(left.Type, right.Type);
2334Type resultType = GetResultTypeOfShift(left.Type, right.Type);
2371Type resultType = GetResultTypeOfShift(left.Type, right.Type);
2430Type resultType = GetResultTypeOfShift(left.Type, right.Type);
2851Type arrayType = array.Type;
System\Linq\Expressions\BlockExpression.cs (9)
56/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
57public override Type Type => GetExpression(ExpressionCount - 1).Type;
642internal ScopeWithType(IReadOnlyList<ParameterExpression> variables, IReadOnlyList<Expression> expressions, Type type)
648public sealed override Type Type { get; }
925public static BlockExpression Block(Type type, params Expression[] expressions)
937public static BlockExpression Block(Type type, IEnumerable<Expression> expressions)
960public static BlockExpression Block(Type type, IEnumerable<ParameterExpression>? variables, params Expression[] expressions)
999public static BlockExpression Block(Type type, IEnumerable<ParameterExpression>? variables, IEnumerable<Expression> expressions)
1027private static BlockExpression BlockCore(Type? type, ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> expressions)
System\Linq\Expressions\Compiler\ILGen.cs (48)
17private static readonly MethodInfo s_nullableGetValueOrDefault = typeof(Nullable<>).GetMethod("GetValueOrDefault", Type.EmptyTypes)!;
63internal static void EmitLoadValueIndirect(this ILGenerator il, Type type)
116internal static void EmitStoreValueIndirect(this ILGenerator il, Type type)
161internal static void EmitLoadElement(this ILGenerator il, Type type)
213internal static void EmitStoreElement(this ILGenerator il, Type type)
256internal static void EmitType(this ILGenerator il, Type type)
361internal static bool CanEmitConstant(object? value, Type type)
368if (value is Type t)
377private static bool CanEmitILConstant(Type type)
404internal static bool TryEmitConstant(this ILGenerator il, object? value, Type type, ILocalCache locals)
422if (value is Type t)
427if (type != typeof(Type))
441Type? dt = mb.DeclaringType;
463private static bool ShouldLdtoken(Type t)
478Type? dt = mb.DeclaringType;
482private static bool TryEmitILConstant(this ILGenerator il, object value, Type type)
488Type nonNullType = type.GetNonNullableType();
552internal static void EmitConvertToType(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
564Type nnExprType = typeFrom.GetNonNullableType();
565Type nnType = typeTo.GetNonNullableType();
599private static void EmitCastToType(this ILGenerator il, Type typeFrom, Type typeTo)
617private static void EmitNumericConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked)
787private static void EmitNullableToNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
803Type nnTypeFrom = typeFrom.GetNonNullableType();
804Type nnTypeTo = typeTo.GetNonNullableType();
821private static void EmitNonNullableToNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
825Type nnTypeTo = typeTo.GetNonNullableType();
831private static void EmitNullableToNonNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
842private static void EmitNullableToNonNullableStructConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
852Type nnTypeFrom = typeFrom.GetNonNullableType();
857private static void EmitNullableToReferenceConversion(this ILGenerator il, Type typeFrom)
866private static void EmitNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked, ILocalCache locals)
879internal static void EmitHasValue(this ILGenerator il, Type nullableType)
888internal static void EmitGetValue(this ILGenerator il, Type nullableType)
897internal static void EmitGetValueOrDefault(this ILGenerator il, Type nullableType)
934internal static void EmitArray(this ILGenerator il, Type elementType, int count)
950internal static void EmitArray(this ILGenerator il, Type arrayType)
961Type[] types = new Type[arrayType.GetArrayRank()];
1056internal static void EmitDefault(this ILGenerator il, Type type, ILocalCache? locals)
System\Linq\Expressions\Compiler\LambdaCompiler.Address.cs (16)
13private void EmitAddress(Expression node, Type type)
22private void EmitAddress(Expression node, Type type, CompilationFlags flags)
66private void AddressOf(BinaryExpression node, Type type)
83private void AddressOf(ParameterExpression node, Type type)
112private void AddressOf(MemberExpression node, Type type)
117Type? objectType = null;
131private void EmitMemberAddress(MemberInfo member, Type? objectType)
165private void AddressOf(MethodCallExpression node, Type type)
186private void AddressOf(IndexExpression node, Type type)
207private void AddressOf(UnaryExpression node, Type type)
217private void EmitExpressionAddress(Expression node, Type type)
232private WriteBack? EmitAddressWriteBack(Expression node, Type type)
274Type? instanceType = null;
323Type? instanceType = null;
377private LocalBuilder GetInstanceLocal(Type type)
379Type instanceLocalType = type.IsValueType ? type.MakeByRefType() : type;
System\Linq\Expressions\Compiler\LambdaCompiler.Binary.cs (21)
100Type resultType;
129private void EmitBinaryOperator(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull)
148private void EmitUnliftedBinaryOp(ExpressionType op, Type leftType, Type rightType)
255private void EmitShiftMask(Type leftType)
266private void EmitConvertArithmeticResult(ExpressionType op, Type resultType)
287private void EmitLiftedBinaryOp(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull)
346private void EmitLiftedRelational(ExpressionType op, Type type)
367Type unnullable = type.GetNonNullableType();
384private void EmitLiftedToNullRelational(ExpressionType op, Type type)
410Type unnullable = type.GetNonNullableType();
417private void EmitLiftedBinaryArithmetic(ExpressionType op, Type leftType, Type rightType, Type resultType)
479Type resultNonNullableType = resultType.GetNonNullableType();
505Type type = typeof(bool?);
536Type type = typeof(bool?);
System\Linq\Expressions\Compiler\LambdaCompiler.Expressions.cs (31)
123private void EmitExpressionAsType(Expression node, Type type, CompilationFlags flags)
232Type? objectType = null;
258Type? objectType = null;
293private void EmitGetIndexCall(IndexExpression node, Type? objectType)
307private void EmitGetArrayElement(Type arrayType)
321private void EmitSetIndexCall(IndexExpression node, Type? objectType)
335private void EmitSetArrayElement(Type arrayType)
373Type? objectType = null;
392private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type? objectType)
398private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type? objectType, CompilationFlags flags)
422Type[] types = new Type[count];
451private void EmitCall(Type? objectType, MethodInfo method)
523Type type = parameter.ParameterType;
571private void EmitConstant(object? value, Type type)
594Type siteType = site.GetType();
614private static FieldInfo GetCallSiteTargetField(Type siteType)
655Type type = node.Expression.Type;
793Type? objectType = null;
836Type? instanceType = null;
846private void EmitMemberGet(MemberInfo member, Type? objectType)
869private void EmitInstance(Expression instance, out Type type)
905Type elementType = node.Type.GetElementType()!;
941private void EmitBinding(MemberBinding binding, Type objectType)
957private void EmitMemberAssignment(MemberAssignment binding, Type objectType)
973Type type = GetMemberType(binding.Member);
991Type type = GetMemberType(binding.Member);
1027private void EmitMemberInit(ReadOnlyCollection<MemberBinding> bindings, bool keepOnStack, Type objectType)
1071private void EmitListInit(ReadOnlyCollection<ElementInit> initializers, bool keepOnStack, Type objectType)
1102private static Type GetMemberType(MemberInfo member)
1112private void EmitLift(ExpressionType nodeType, Type resultType, MethodCallExpression mc, ParameterExpression[] paramList, Expression[] argList)
System\Linq\Expressions\DynamicExpression.cs (65)
22internal DynamicExpression(Type delegateType, CallSiteBinder binder)
51internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, ReadOnlyCollection<Expression> arguments)
63internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0)
75internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
87internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
99internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
115public override Type Type => typeof(object);
133public Type DelegateType { get; }
244public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments)
266public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable<Expression> arguments)
288public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0)
311public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1)
335public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2)
360public static new DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
379public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable<Expression>? arguments)
397public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[]? arguments)
415public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0)
434public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
454public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
475public static new DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
496internal DynamicExpressionN(Type delegateType, CallSiteBinder binder, IReadOnlyList<Expression> arguments)
524internal TypedDynamicExpressionN(Type returnType, Type delegateType, CallSiteBinder binder, IReadOnlyList<Expression> arguments)
531public sealed override Type Type { get; }
538internal DynamicExpression1(Type delegateType, CallSiteBinder binder, Expression arg0)
582internal TypedDynamicExpression1(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0)
588public sealed override Type Type { get; }
596internal DynamicExpression2(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
651internal TypedDynamicExpression2(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
657public sealed override Type Type { get; }
665internal DynamicExpression3(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
726internal TypedDynamicExpression3(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
732public sealed override Type Type { get; }
740internal DynamicExpression4(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
807internal TypedDynamicExpression4(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
813public sealed override Type Type { get; }
833public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[]? arguments)
851public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable<Expression>? arguments)
891public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0)
921public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1)
954public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2)
990public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
1012private static MethodInfo GetValidMethodForDynamic(Type delegateType)
1037public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments)
1059public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0)
1072Type delegateType = info.DelegateType ?? info.MakeDelegateType(returnType, arg0);
1095public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1)
1112Type delegateType = info.DelegateType ?? info.MakeDelegateType(returnType, arg0, arg1);
1136public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2)
1157Type delegateType = info.DelegateType ?? info.MakeDelegateType(returnType, arg0, arg1, arg2);
1182public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
1207Type delegateType = info.DelegateType ?? info.MakeDelegateType(returnType, arg0, arg1, arg2, arg3);
1229public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable<Expression> arguments)
1240private static DynamicExpression MakeDynamic(CallSiteBinder binder, Type returnType, ReadOnlyCollection<Expression> arguments)
1253Type delegateType = DelegateHelpers.MakeCallSiteDelegate(arguments, returnType);
1276var type = arg.Type;
System\Linq\Expressions\Expression.cs (19)
31private static readonly CacheDict<Type, MethodInfo> s_lambdaDelegateCache = new CacheDict<Type, MethodInfo>(40);
32private static volatile CacheDict<Type, Func<Expression, string?, bool, ReadOnlyCollection<ParameterExpression>, LambdaExpression>>? s_lambdaFactories;
43public ExtensionInfo(ExpressionType nodeType, Type type)
50internal readonly Type Type;
61protected Expression(ExpressionType nodeType, Type type)
104public virtual Type Type
304public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable<Expression> arguments) =>
324public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0) =>
345public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1) =>
367public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2) =>
390public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3) =>
410public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments) =>
427public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable<Expression>? arguments) =>
444public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0) =>
462public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1) =>
481public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2) =>
501public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3) =>
518public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[]? arguments) =>
System\Linq\Expressions\GotoExpression.cs (21)
38internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression? value, Type type)
49/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
50public sealed override Type Type { get; }
134/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
140public static GotoExpression Break(LabelTarget target, Type type)
151/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
158public static GotoExpression Break(LabelTarget target, Expression? value, Type type)
181/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
188public static GotoExpression Continue(LabelTarget target, Type type)
211/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
218public static GotoExpression Return(LabelTarget target, Type type)
244/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
251public static GotoExpression Return(LabelTarget target, Expression? value, Type type)
274/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
281public static GotoExpression Goto(LabelTarget target, Type type)
307/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
314public static GotoExpression Goto(LabelTarget target, Expression? value, Type type)
326/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
333public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression? value, Type type)
339private static void ValidateGoto(LabelTarget target, ref Expression? value, string targetParameter, string valueParameter, Type? type)
358private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName)
System\Linq\Expressions\Interpreter\InstructionList.cs (32)
344public void EmitLoad(object? value, Type? type)
575public void EmitInitializeLocal(int index, Type type)
637public void EmitNewArray(Type elementType) => Emit(new NewArrayInstruction(elementType));
640public void EmitNewArrayBounds(Type elementType, int rank)
646public void EmitNewArrayInit(Type elementType, int elementCount)
655public void EmitAdd(Type type, bool @checked)
660public void EmitSub(Type type, bool @checked)
665public void EmitMul(Type type, bool @checked)
670public void EmitDiv(Type type)
675public void EmitModulo(Type type)
684public void EmitExclusiveOr(Type type)
689public void EmitAnd(Type type)
694public void EmitOr(Type type)
699public void EmitLeftShift(Type type)
704public void EmitRightShift(Type type)
709public void EmitEqual(Type type, bool liftedToNull = false)
714public void EmitNotEqual(Type type, bool liftedToNull = false)
719public void EmitLessThan(Type type, bool liftedToNull)
724public void EmitLessThanOrEqual(Type type, bool liftedToNull)
729public void EmitGreaterThan(Type type, bool liftedToNull)
734public void EmitGreaterThanOrEqual(Type type, bool liftedToNull)
758public void EmitCast(Type toType)
763public void EmitCastToEnum(Type toType)
768public void EmitCastReferenceToEnum(Type toType)
778public void EmitNot(Type type)
787public void EmitDefaultValue(Type type)
817public void EmitNegate(Type type)
822public void EmitNegateChecked(Type type)
827public void EmitIncrement(Type type)
832public void EmitDecrement(Type type)
837public void EmitTypeIs(Type type)
842public void EmitTypeAs(Type type)
System\Linq\Expressions\InvocationExpression.cs (12)
19internal InvocationExpression(Expression expression, Type returnType)
28/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
29public sealed override Type Type { get; }
129public InvocationExpressionN(Expression lambda, IReadOnlyList<Expression> arguments, Type returnType)
155public InvocationExpression0(Expression lambda, Type returnType)
185public InvocationExpression1(Expression lambda, Type returnType, Expression arg0)
223public InvocationExpression2(Expression lambda, Type returnType, Expression arg0, Expression arg1)
264public InvocationExpression3(Expression lambda, Type returnType, Expression arg0, Expression arg1, Expression arg2)
308public InvocationExpression4(Expression lambda, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3)
355public InvocationExpression5(Expression lambda, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4)
745Type delegateType = expression.Type;
748Type? exprType = TypeUtils.FindGenericType(typeof(Expression<>), expression.Type);
System\Linq\Expressions\LambdaExpression.cs (48)
24private static readonly MethodInfo s_expressionCompileMethodInfo = typeof(Expression<>).GetMethod("Compile", Type.EmptyTypes)!;
43public sealed override Type Type => TypeCore;
45internal abstract Type TypeCore { get; }
47internal abstract Type PublicType { get; }
76public Type ReturnType => Type.GetInvokeMethod().ReturnType;
120internal static MethodInfo GetCompileMethod(Type lambdaExpressionType)
127return typeof(LambdaExpression).GetMethod("Compile", Type.EmptyTypes)!;
209internal sealed override Type TypeCore => typeof(TDelegate);
211internal override Type PublicType => typeof(Expression<TDelegate>);
612internal static LambdaExpression CreateLambda(Type delegateType, Expression body, string? name, bool tailCall, ReadOnlyCollection<ParameterExpression> parameters)
618CacheDict<Type, Func<Expression, string?, bool, ReadOnlyCollection<ParameterExpression>, LambdaExpression>>? factories =
619s_lambdaFactories ??= new CacheDict<Type, Func<Expression, string?, bool, ReadOnlyCollection<ParameterExpression>, LambdaExpression>>(50);
787public static LambdaExpression Lambda(Type delegateType, Expression body, params ParameterExpression[]? parameters)
800public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, params ParameterExpression[]? parameters)
812public static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable<ParameterExpression>? parameters)
825public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, IEnumerable<ParameterExpression>? parameters)
859Type[] typeArgs = new Type[paramCount + 1];
876Type delegateType = Compiler.DelegateHelpers.MakeDelegateType(typeArgs);
889public static LambdaExpression Lambda(Type delegateType, Expression body, string? name, IEnumerable<ParameterExpression>? parameters)
906public static LambdaExpression Lambda(Type delegateType, Expression body, string? name, bool tailCall, IEnumerable<ParameterExpression>? parameters)
914private static void ValidateLambdaArgs(Type delegateType, ref Expression body, ReadOnlyCollection<ParameterExpression> parameters, string paramName)
926CacheDict<Type, MethodInfo> ldc = s_lambdaDelegateCache;
950Type pType = pi.ParameterType;
991private static TryGetFuncActionArgsResult ValidateTryGetFuncActionArgs(Type[]? typeArgs)
1000Type a = typeArgs[i];
1021/// Creates a <see cref="System.Type"/> object that represents a generic System.Func delegate type that has specific type arguments.
1024/// <param name="typeArgs">An array of <see cref="System.Type"/> objects that specify the type arguments for the System.Func delegate type.</param>
1027public static Type GetFuncType(params Type[]? typeArgs)
1039Type result = Compiler.DelegateHelpers.GetFuncType(typeArgs);
1050/// Creates a <see cref="System.Type"/> object that represents a generic System.Func delegate type that has specific type arguments.
1053/// <param name="typeArgs">An array of <see cref="System.Type"/> objects that specify the type arguments for the System.Func delegate type.</param>
1057public static bool TryGetFuncType(Type[] typeArgs, [NotNullWhen(true)] out Type? funcType)
1069/// Creates a <see cref="System.Type"/> object that represents a generic System.Action delegate type that has specific type arguments.
1071/// <param name="typeArgs">An array of <see cref="System.Type"/> objects that specify the type arguments for the System.Action delegate type.</param>
1074public static Type GetActionType(params Type[]? typeArgs)
1086Type result = Compiler.DelegateHelpers.GetActionType(typeArgs);
1097/// Creates a <see cref="System.Type"/> object that represents a generic System.Action delegate type that has specific type arguments.
1099/// <param name="typeArgs">An array of <see cref="System.Type"/> objects that specify the type arguments for the System.Action delegate type.</param>
1103public static bool TryGetActionType(Type[] typeArgs, [NotNullWhen(true)] out Type? actionType)
1115/// Gets a <see cref="System.Type"/> object that represents a generic System.Func or System.Action delegate type that has specific type arguments.
1119/// <param name="typeArgs">An array of <see cref="System.Type"/> objects that specify the type arguments of the delegate type.</param>
1125public static Type GetDelegateType(params Type[] typeArgs)
System\Linq\Expressions\MethodCallExpression.cs (13)
35/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
36public sealed override Type Type => Method.ReturnType;
1142public static MethodCallExpression Call(Expression instance, string methodName, Type[]? typeArguments, params Expression[]? arguments)
1167[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type type,
1169Type[]? typeArguments,
1261private static void ValidateCallInstanceType(Type instanceType, MethodInfo method)
1290private static bool TryQuote(Type parameterType, ref Expression argument)
1298[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type type,
1300Type[]? typeArgs,
1356Type argType = arg.Type;
1357Type pType = parms[i].ParameterType;
1373private static MethodInfo? ApplyTypeArgs(MethodInfo m, Type[]? typeArgs)
1414Type arrayType = array.Type;
System\Linq\Expressions\SwitchExpression.cs (8)
18internal SwitchExpression(Type type, Expression switchValue, Expression? defaultBody, MethodInfo? comparison, ReadOnlyCollection<SwitchCase> cases)
30/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
31public sealed override Type Type { get; }
150public static SwitchExpression Switch(Type? type, Expression switchValue, Expression? defaultBody, MethodInfo? comparison, params SwitchCase[]? cases)
177public static SwitchExpression Switch(Type? type, Expression switchValue, Expression? defaultBody, MethodInfo? comparison, IEnumerable<SwitchCase>? cases)
186Type resultType;
227Type rightOperandType = c.TestValues[i].Type;
294private static void ValidateSwitchCaseType(Expression @case, bool customType, Type resultType, string parameterName)
System\Linq\Expressions\TryExpression.cs (5)
24internal TryExpression(Type type, Expression body, Expression? @finally, Expression? fault, ReadOnlyCollection<CatchBlock> handlers)
36/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
37public sealed override Type Type { get; }
153public static TryExpression MakeTry(Type? type, Expression body, Expression? @finally, Expression? fault, IEnumerable<CatchBlock>? handlers)
182private static void ValidateTryAndCatchHaveSameType(Type? type, Expression tryBody, ReadOnlyCollection<CatchBlock> handlers)
System\Linq\Expressions\UnaryExpression.cs (26)
18internal UnaryExpression(ExpressionType nodeType, Expression expression, Type type, MethodInfo? method)
29/// <returns>The <see cref="System.Type"/> that represents the static type of the expression.</returns>
30public sealed override Type Type { get; }
303public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type)
318public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo? method) =>
359Type operandType = operand.Type;
360Type[] types = new Type[] { operandType };
361Type nnOperandType = operandType.GetNonNullableType();
403private static UnaryExpression GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
413private static UnaryExpression? GetUserDefinedCoercion(ExpressionType coercionType, Expression expression, Type convertToType)
426private static UnaryExpression GetMethodBasedCoercionOperator(ExpressionType unaryType, Expression operand, Type convertToType, MethodInfo method)
687/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
690public static UnaryExpression TypeAs(Expression expression, Type type)
707/// <param name="type">The new <see cref="System.Type"/> of the expression.</param>
709public static UnaryExpression Unbox(Expression expression, Type type)
725/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
729public static UnaryExpression Convert(Expression expression, Type type)
737/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
745public static UnaryExpression Convert(Expression expression, Type type, MethodInfo? method)
765/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
769public static UnaryExpression ConvertChecked(Expression expression, Type type)
777/// <param name="type">A <see cref="System.Type"/> to set the <see cref="Type"/> property equal to.</param>
785public static UnaryExpression ConvertChecked(Expression expression, Type type, MethodInfo? method)
859public static UnaryExpression Rethrow(Type type)
880public static UnaryExpression Throw(Expression? value, Type type)
System\Runtime\CompilerServices\CallSite.cs (12)
54private static volatile CacheDict<Type, Func<CallSiteBinder, CallSite>>? s_siteCtors;
87public static CallSite Create(Type delegateType, CallSiteBinder binder)
93CacheDict<Type, Func<CallSiteBinder, CallSite>>? ctors = s_siteCtors;
97s_siteCtors = ctors = new CacheDict<Type, Func<CallSiteBinder, CallSite>>(100);
286Type target = typeof(T);
290&& target.IsGenericType && IsSimpleSignature(invoke, out Type[] args))
334private static bool IsSimpleSignature(MethodInfo invoke, out Type[] sig)
339Type[] args = new Type[invoke.ReturnType != typeof(void) ? pis.Length : pis.Length - 1];
362Type returnType = invoke.GetReturnType();
370Type[] typeArgs = new[] { typeof(T) };
684private static Expression Convert(Expression arg, Type type)
System.Linq.Queryable (50)
System\Linq\EnumerableRewriter.cs (37)
22private Dictionary<Type, Type>? _equivalentTypeCache;
37Type[]? typeArgs = (mInfo.IsGenericMethod) ? mInfo.GetGenericArguments() : null;
91private static Expression FixupQuotedExpression(Type type, Expression expression)
104Type strippedType = StripExpression(expr.Type);
107Type elementType = type.GetElementType()!;
122private static Type GetPublicType(Type t)
133foreach (Type iType in t.GetInterfaces())
146private Type GetEquivalentType(Type type)
148Type? equiv;
152_equivalentTypeCache ??= new Dictionary<Type, Type>
159Type pubType = GetPublicType(type);
162Type genericType = pubType.GetGenericTypeDefinition();
179Type? typeArg = singleTypeGenInterfacesWithGetType
207Type t = GetPublicType(sq.Enumerable.GetType());
218private static MethodInfo FindEnumerableMethodForQueryable(string name, ReadOnlyCollection<Expression> args, params Type[]? typeArgs)
236static MethodInfo[] GetEnumerableStaticMethods(Type type) =>
284Type leftParam = left[i].ParameterType;
285Type rightParam = right[i].ParameterType;
297private static MethodInfo FindMethod(Type type, string name, ReadOnlyCollection<Expression> args, Type[]? typeArgs)
313private static bool ArgsMatch(MethodInfo m, ReadOnlyCollection<Expression> args, Type[]? typeArgs)
335static ParameterInfo[] GetConstrutedGenericParameters(MethodInfo method, Type[] genericTypes) =>
340Type parameterType = mParams[i].ParameterType;
363private static Type StripExpression(Type type)
366Type tmp = isArray ? type.GetElementType()! : type;
367Type? eType = TypeHelper.FindGenericType(typeof(Expression<>), tmp);
380Type type = c.Type;
386Type trueType = ifTrue.Type;
387Type falseType = ifFalse.Type;
397Type type = node.Type;
409Type type = node.Value!.Type;
429Type type = node!.Type;
System.Memory.Data (3)
System.Net.Http.Json (23)
System\Net\Http\Json\HttpClientJsonExtensions.cs (2)
19private static Task<object?> FromJsonAsyncCore(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) =>
27private static Task<object?> FromJsonAsyncCore(Func<HttpClient, Uri?, CancellationToken, Task<HttpResponseMessage>> getMethod, HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) =>
System\Net\Http\Json\HttpClientJsonExtensions.Delete.cs (6)
33public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) =>
48public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) =>
91public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) =>
104public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) =>
144public static Task<object?> DeleteFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, CancellationToken cancellationToken = default) =>
158public static Task<object?> DeleteFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken = default) =>
System\Net\Http\Json\HttpClientJsonExtensions.Get.cs (6)
23public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) =>
28public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default) =>
41public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) =>
44public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default) =>
55public static Task<object?> GetFromJsonAsync(this HttpClient client, [StringSyntax(StringSyntaxAttribute.Uri)] string? requestUri, Type type, CancellationToken cancellationToken = default) =>
60public static Task<object?> GetFromJsonAsync(this HttpClient client, Uri? requestUri, Type type, CancellationToken cancellationToken = default) =>
System\Net\Http\Json\HttpContentJsonExtensions.cs (5)
30public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken = default)
49public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, CancellationToken cancellationToken = default)
90private static async Task<object?> ReadFromJsonAsyncCore(HttpContent content, Type type, JsonSerializerOptions? options, CancellationToken cancellationToken)
108public static Task<object?> ReadFromJsonAsync(this HttpContent content, Type type, JsonSerializerContext context, CancellationToken cancellationToken = default)
128private static async Task<object?> ReadFromJsonAsyncCore(HttpContent content, Type type, JsonSerializerContext context, CancellationToken cancellationToken)
System.Net.Quic (3)
System.Net.Requests (1)
System.Net.Security (22)
src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (22)
92Type? socketsHttpHandlerType = Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http", throwOnError: false);
93Type? httpMessageHandlerType = Type.GetType("System.Net.Http.HttpMessageHandler, System.Net.Http", throwOnError: false);
94Type? httpClientType = Type.GetType("System.Net.Http.HttpClient, System.Net.Http", throwOnError: false);
95Type? httpRequestMessageType = Type.GetType("System.Net.Http.HttpRequestMessage, System.Net.Http", throwOnError: false);
96Type? httpResponseMessageType = Type.GetType("System.Net.Http.HttpResponseMessage, System.Net.Http", throwOnError: false);
97Type? httpResponseHeadersType = Type.GetType("System.Net.Http.Headers.HttpResponseHeaders, System.Net.Http", throwOnError: false);
98Type? httpContentType = Type.GetType("System.Net.Http.HttpContent, System.Net.Http", throwOnError: false);
99Type? taskOfHttpResponseMessageType = Type.GetType("System.Threading.Tasks.Task`1[[System.Net.Http.HttpResponseMessage, System.Net.Http]], System.Runtime", throwOnError: false);
109ConstructorInfo? socketsHttpHandlerCtor = socketsHttpHandlerType.GetConstructor(Type.EmptyTypes);
112ConstructorInfo? httpClientCtor = httpClientType.GetConstructor(new Type[] { httpMessageHandlerType });
114ConstructorInfo? httpRequestMessageCtor = httpRequestMessageType.GetConstructor(Type.EmptyTypes);
115MethodInfo? sendMethod = httpClientType.GetMethod("Send", new Type[] { httpRequestMessageType, typeof(CancellationToken) });
116MethodInfo? sendAsyncMethod = httpClientType.GetMethod("SendAsync", new Type[] { httpRequestMessageType, typeof(CancellationToken) });
122MethodInfo? readAsStreamMethod = httpContentType.GetMethod("ReadAsStream", Type.EmptyTypes);
System.Net.WebProxy (1)
System.Numerics.Tensors (1)
System.ObjectModel (8)
System.Private.CoreLib (2002)
src\libraries\System.Private.CoreLib\src\System\Activator.RuntimeType.cs (4)
21public static object? CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicConstructors)] Type type, BindingFlags bindingAttr, Binder? binder, object?[]? args, CultureInfo? culture, object?[]? activationAttributes)
90public static object? CreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type, bool nonPublic) =>
93internal static object? CreateInstance(Type type, bool nonPublic, bool wrapExceptions)
129Type? type = assembly.GetType(typeName, throwOnError: true, ignoreCase);
src\libraries\System.Private.CoreLib\src\System\Array.cs (16)
73public static unsafe Array CreateInstance(Type elementType, int length)
87public static unsafe Array CreateInstance(Type elementType, int length1, int length2)
103public static unsafe Array CreateInstance(Type elementType, int length1, int length2, int length3)
119public static unsafe Array CreateInstance(Type elementType, params int[] lengths)
144public static unsafe Array CreateInstance(Type elementType, int[] lengths, int[] lowerBounds)
173public static Array CreateInstance(Type elementType, params long[] lengths)
196/// <returns>A new one-dimensional <see cref="Array"/> of the specified <see cref="Type"/> with the specified length.</returns>
203/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int)"/>, as it has
205public static unsafe Array CreateInstanceFromArrayType(Type arrayType, int length)
224/// Creates a multidimensional <see cref="Array"/> of the specified <see cref="Type"/> and dimension lengths, with zero-based indexing.
240/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int[])"/>, as it has
242public static unsafe Array CreateInstanceFromArrayType(Type arrayType, params int[] lengths)
270/// Creates a multidimensional <see cref="Array"/> of the specified <see cref="Type"/> and dimension lengths, with the specified lower bounds.
275/// <returns>A new multidimensional <see cref="Array"/> of the specified <see cref="Type"/> with the specified length and lower bound for each dimension.</returns>
292/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int[], int[])"/>, as it has
294public static unsafe Array CreateInstanceFromArrayType(Type arrayType, int[] lengths, int[] lowerBounds)
src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (41)
76Type[] paramArrayTypes = new Type[candidates.Length];
78Type[] argTypes = new Type[args.Length];
96Type? paramArrayType;
186Type pCls;
207if (defaultValueBinding && args[index] == Type.Missing)
460Type valueType;
471Type pCls = candidates[i].FieldType;
540public sealed override MethodBase? SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[]? modifiers)
545Type[] realTypes = new Type[types.Length];
570Type pCls = par[j].ParameterType;
576Type? type = types[j];
633public sealed override PropertyInfo? SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type? returnType,
634Type[]? indexes, ParameterModifier[]? modifiers)
639foreach (Type index in indexes)
665Type pCls = par[j].ParameterType;
750public override object ChangeType(object value, Type type, CultureInfo? cultureInfo)
791public static MethodBase? ExactBinding(MethodBase[] match, Type[] types)
808Type pCls = par[j].ParameterType;
833public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match, Type? returnType, Type[]? types)
845Type pCls = par[j].ParameterType;
864private static int FindMostSpecific(ReadOnlySpan<ParameterInfo> p1, int[] paramOrder1, Type? paramArrayType1,
865ReadOnlySpan<ParameterInfo> p2, int[] paramOrder2, Type? paramArrayType2,
866Type[] types, object?[]? args)
879if (args != null && args[i] == Type.Missing)
882Type c1, c2;
941private static int FindMostSpecificType(Type c1, Type c2, Type? t)
1014private static int FindMostSpecificMethod(MethodBase m1, int[] paramOrder1, Type? paramArrayType1,
1015MethodBase m2, int[] paramOrder2, Type? paramArrayType2,
1016Type[] types, object?[]? args)
1115private static int GetHierarchyDepth(Type t)
1119Type? currentType = t;
1232internal static bool CanChangePrimitive(Type? source, Type? target)
1238Primitives widerCodes = PrimitiveConversions[(int)(Type.GetTypeCode(source))];
1239Primitives targetCode = (Primitives)(1 << (int)(Type.GetTypeCode(target)));
src\libraries\System.Private.CoreLib\src\System\Delegate.cs (8)
55public static Delegate CreateDelegate(Type type, object? firstArgument, MethodInfo method) => CreateDelegate(type, firstArgument, method, throwOnBindFailure: true)!;
58public static Delegate CreateDelegate(Type type, MethodInfo method) => CreateDelegate(type, method, throwOnBindFailure: true)!;
62public static Delegate CreateDelegate(Type type, object target, string method) => CreateDelegate(type, target, method, ignoreCase: false, throwOnBindFailure: true)!;
64public static Delegate CreateDelegate(Type type, object target, string method, bool ignoreCase) => CreateDelegate(type, target, method, ignoreCase, throwOnBindFailure: true)!;
67public static Delegate CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.AllMethods)] Type target, string method) => CreateDelegate(type, target, method, ignoreCase: false, throwOnBindFailure: true)!;
68public static Delegate CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.AllMethods)] Type target, string method, bool ignoreCase) => CreateDelegate(type, target, method, ignoreCase, throwOnBindFailure: true)!;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (37)
368public static Guid GetGuid(Type eventSourceType)
397public static string GetName(Type eventSourceType)
423Type eventSourceType,
446Type eventSourceType,
766Type myType = this.GetType();
1746private static string GetName(Type eventSourceType, EventManifestOptions flags)
1777private static unsafe void DecodeObjects(object?[] decodedObjects, Type[] parameterTypes, EventData* data)
1782Type dataType = parameterTypes[i];
1796TypeCode typeCode = Type.GetTypeCode(dataType);
2117Type pType = infos[i].ParameterType;
2239new TraceLoggingEventTypes(EventName, EventTags.None, new Type[] { typeof(string) });
2554private Type[]? _parameterTypes;
2555public Type[] ParameterTypes
2561static Type[] GetParameterTypes(ParameterInfo[] parameters)
2563var types = new Type[parameters.Length];
2985Type attributeType,
3016Type attributeType,
3078private static bool AttributeTypeNamesMatch(Type attributeType, Type reflectedAttributeType)
3092private static Type? GetEventSourceBaseType(Type eventSourceType, bool allowEventSourceOverride, bool reflectionOnly)
3094Type? ret = eventSourceType;
3134Type eventSourceType,
3204Type? nestedType = eventSourceType.GetNestedType(providerEnumKind);
3469Type staticFieldType = staticField.FieldType;
3538Type dataType = parameter.ParameterType;
3544(dataType.IsEnum && Type.GetTypeCode(dataType.GetEnumUnderlyingType()) <= TypeCode.UInt32))
3922Type? metricsEventSourceType = Type.GetType(
3930MethodInfo? getInstanceMethod = metricsEventSourceType.GetMethod("GetInstance", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static, null, Type.EmptyTypes, null);
5525public void AddEventParameter(Type type, string name)
5553mapsTab ??= new Dictionary<string, Type>();
5711static FieldInfo[] GetEnumFields(Type localEnumType)
5720foreach (Type enumType in mapsTab.Values)
6033private string GetTypeName(Type type)
6048switch (Type.GetTypeCode(type))
6200private Dictionary<string, Type>? mapsTab;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\InvokeTypeInfo.cs (1)
18Type type,
src\libraries\System.Private.CoreLib\src\System\Enum.cs (42)
60Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
87public static string? GetName(Type enumType, object value)
105Type underlyingType = enumType.GetEnumUnderlyingType();
106switch (Type.GetTypeCode(underlyingType)) // can't use InternalGetCorElementType as enumType may actually be the underlying type
224Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
248public static string[] GetNames(Type enumType)
281public static Type GetUnderlyingType(Type enumType)
307public static Array GetValues(Type enumType)
332public static Array GetValuesAsUnderlyingType(Type enumType)
475Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
519public static bool IsDefined(Type enumType, object value)
548public static object Parse(Type enumType, string value) =>
560public static object Parse(Type enumType, ReadOnlySpan<char> value) =>
576public static object Parse(Type enumType, string value, bool ignoreCase)
601public static object Parse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase)
672public static bool TryParse(Type enumType, string? value, [NotNullWhen(true)] out object? result) =>
680public static bool TryParse(Type enumType, ReadOnlySpan<char> value, [NotNullWhen(true)] out object? result) =>
692public static bool TryParse(Type enumType, string? value, bool ignoreCase, [NotNullWhen(true)] out object? result)
712public static bool TryParse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase, [NotNullWhen(true)] out object? result) =>
716private static unsafe bool TryParse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, [NotNullWhen(true)] out object? result)
892Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
1001Type underlyingType = GetUnderlyingType(enumType);
1150Type valueType = value.GetType();
1624public static string Format(Type enumType, object value, [StringSyntax(StringSyntaxAttribute.EnumFormat)] string format)
1631Type valueType = value.GetType();
1647Type underlyingType = GetUnderlyingType(rtType);
1750Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
1809Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
2125private static RuntimeType ValidateRuntimeType(Type enumType)
2146private static void ThrowInvalidRuntimeType(Type enumType) =>
2191object IConvertible.ToType(Type type, IFormatProvider? provider) => Convert.DefaultToType(this, type, provider);
2193public static object ToObject(Type enumType, object value)
2211Type valueType = value.GetType();
2224public static object ToObject(Type enumType, sbyte value) =>
2227public static object ToObject(Type enumType, short value) =>
2230public static object ToObject(Type enumType, int value) =>
2233public static object ToObject(Type enumType, byte value) =>
2237public static object ToObject(Type enumType, ushort value) =>
2241public static object ToObject(Type enumType, uint value) =>
2244public static object ToObject(Type enumType, long value) =>
2248public static object ToObject(Type enumType, ulong value) =>
src\libraries\System.Private.CoreLib\src\System\Reflection\Assembly.cs (17)
31Type[] types = GetTypes();
42public virtual Type[] GetTypes()
51Type[][] moduleTypes = new Type[m.Length][];
60Type[] ret = new Type[finalLength];
71public virtual IEnumerable<Type> ExportedTypes
77public virtual Type[] GetExportedTypes() { throw NotImplemented.ByDesign; }
79public virtual Type[] GetForwardedTypes() { throw NotImplemented.ByDesign; }
97public virtual Stream? GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; }
105public virtual Type? GetType(string name) => GetType(name, throwOnError: false, ignoreCase: false);
107public virtual Type? GetType(string name, bool throwOnError) => GetType(name, throwOnError: throwOnError, ignoreCase: false);
109public virtual Type? GetType(string name, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; }
111public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
117public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
132Type? t = GetType(typeName, throwOnError: false, ignoreCase: ignoreCase);
206public static Assembly? GetAssembly(Type type)
src\libraries\System.Private.CoreLib\src\System\Reflection\CustomAttributeExtensions.cs (18)
11public static Attribute? GetCustomAttribute(this Assembly element, Type attributeType)
15public static Attribute? GetCustomAttribute(this Module element, Type attributeType)
19public static Attribute? GetCustomAttribute(this MemberInfo element, Type attributeType)
23public static Attribute? GetCustomAttribute(this ParameterInfo element, Type attributeType)
45public static Attribute? GetCustomAttribute(this MemberInfo element, Type attributeType, bool inherit)
49public static Attribute? GetCustomAttribute(this ParameterInfo element, Type attributeType, bool inherit)
93public static IEnumerable<Attribute> GetCustomAttributes(this Assembly element, Type attributeType)
97public static IEnumerable<Attribute> GetCustomAttributes(this Module element, Type attributeType)
101public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element, Type attributeType)
105public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element, Type attributeType)
127public static IEnumerable<Attribute> GetCustomAttributes(this MemberInfo element, Type attributeType, bool inherit)
131public static IEnumerable<Attribute> GetCustomAttributes(this ParameterInfo element, Type attributeType, bool inherit)
147public static bool IsDefined(this Assembly element, Type attributeType)
151public static bool IsDefined(this Module element, Type attributeType)
155public static bool IsDefined(this MemberInfo element, Type attributeType)
159public static bool IsDefined(this ParameterInfo element, Type attributeType)
164public static bool IsDefined(this MemberInfo element, Type attributeType, bool inherit)
168public static bool IsDefined(this ParameterInfo element, Type attributeType, bool inherit)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\DynamicMethod.cs (28)
30Type? returnType,
31Type[]? parameterTypes)
46Type? returnType,
47Type[]? parameterTypes,
63Type? returnType,
64Type[]? parameterTypes,
82Type? returnType,
83Type[]? parameterTypes,
104Type? returnType,
105Type[]? parameterTypes,
124Type? returnType,
125Type[]? parameterTypes,
126Type owner)
143Type? returnType,
144Type[]? parameterTypes,
145Type owner,
165Type? returnType,
166Type[]? parameterTypes,
167Type owner,
216Type? returnType,
217Type[]? signature,
218Type? owner,
317public override Type? DeclaringType => null;
319public override Type? ReflectedType => null;
346public override object[] GetCustomAttributes(Type attributeType, bool inherit)
368public override bool IsDefined(Type attributeType, bool inherit)
375public override Type ReturnType => _returnType;
417Type[] parameterTypes = _parameterTypes;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\ILGenerator.cs (19)
43Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes);
45public abstract void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes);
47public abstract void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes);
53public abstract void Emit(OpCode opcode, Type cls);
73public abstract void BeginCatchBlock(Type? exceptionType);
89public virtual void ThrowException([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type excType)
98ConstructorInfo con = excType.GetConstructor(Type.EmptyTypes) ?? throw new ArgumentException(SR.Arg_NoDefCTorWithoutTypeName, nameof(excType));
104private static readonly Type[] s_parameterTypes = [typeof(string)];
110Type consoleType = Type.GetType(ConsoleTypeFullName, throwOnError: true)!;
122Emit(OpCodes.Call, Type.GetType(ConsoleTypeFullName, throwOnError: true)!.GetMethod("get_Out")!);
125Type cls = localBuilder.LocalType;
145Emit(OpCodes.Call, Type.GetType(ConsoleTypeFullName, throwOnError: true)!.GetMethod("get_Out")!);
157Type cls = fld.FieldType;
172public virtual LocalBuilder DeclareLocal(Type localType)
177public abstract LocalBuilder DeclareLocal(Type localType, bool pinned);
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilder.cs (14)
77public void SetParameters(params Type[] parameterTypes)
80public void SetReturnType(Type? returnType)
83public void SetSignature(Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
84Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
88protected abstract void SetSignatureCore(Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
89Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers);
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\ModuleBuilder.cs (39)
22public EnumBuilder DefineEnum(string name, TypeAttributes visibility, Type underlyingType)
68protected abstract EnumBuilder DefineEnumCore(string name, TypeAttributes visibility, Type underlyingType);
70public MethodBuilder DefineGlobalMethod(string name, MethodAttributes attributes, Type? returnType, Type[]? parameterTypes)
74Type? returnType, Type[]? parameterTypes)
78Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
79Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
89Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
90Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers);
100Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
107Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
114Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet);
123[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
127[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces)
135[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, int typesize)
139[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packsize)
143[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packingSize, int typesize)
151[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize);
158public MethodInfo GetArrayMethod(Type arrayClass, string methodName, CallingConventions callingConvention,
159Type? returnType, Type[]? parameterTypes)
167protected abstract MethodInfo GetArrayMethodCore(Type arrayClass, string methodName,
168CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes);
187public abstract int GetTypeMetadataToken(Type type);
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\SymbolType.cs (26)
24internal Type _baseType = null!;
43internal static Type? FormCompoundType(string? format, Type baseType, int curIndex)
215internal SymbolType(Type baseType, TypeKind typeKind)
264public override Type MakePointerType()
269public override Type MakeByRefType()
275public override Type MakeArrayType()
281public override Type MakeArrayType(int rank)
322Type baseType;
333Type baseType;
347Type baseType;
368public override Type BaseType => typeof(Array);
372CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
385CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
410public override Type GetInterface(string name, bool ignoreCase)
416public override Type[] GetInterfaces()
435Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
447public override Type[] GetNestedTypes(BindingFlags bindingAttr)
453public override Type GetNestedType(string name, BindingFlags bindingAttr)
477public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
491Type baseType;
528public override Type? GetElementType()
538public override Type UnderlyingSystemType => this;
545public override object[] GetCustomAttributes(Type attributeType, bool inherit)
550public override bool IsDefined(Type attributeType, bool inherit)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\TypeBuilder.cs (92)
27public void AddInterfaceImplementation([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType)
34protected abstract void AddInterfaceImplementationCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType);
37public Type CreateType()
47public ConstructorBuilder DefineConstructor(MethodAttributes attributes, CallingConventions callingConvention, Type[]? parameterTypes)
51Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
55Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers);
62public EventBuilder DefineEvent(string name, EventAttributes attributes, Type eventtype)
69protected abstract EventBuilder DefineEventCore(string name, EventAttributes attributes, Type eventtype);
71public FieldBuilder DefineField(string fieldName, Type type, FieldAttributes attributes)
74public FieldBuilder DefineField(string fieldName, Type type, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers,
83protected abstract FieldBuilder DefineFieldCore(string fieldName, Type type, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers,
113Type? returnType, Type[]? parameterTypes)
116public MethodBuilder DefineMethod(string name, MethodAttributes attributes, Type? returnType, Type[]? parameterTypes)
120Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
121Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
139Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
140Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers);
159[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
163[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces)
171[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packSize, int typeSize);
174[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, int typeSize)
178[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packSize)
182[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, PackingSize packSize, int typeSize)
191CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes,
198CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes,
207Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
208Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
224Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
225Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
228public PropertyBuilder DefineProperty(string name, PropertyAttributes attributes, Type? returnType, Type[]? parameterTypes)
232CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes)
236Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
237Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
243Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
244Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
254Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
255Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers);
289public void SetParent([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
292protected abstract void SetParentCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent);
294public override Type MakePointerType()
299public override Type MakeByRefType()
305public override Type MakeArrayType()
311public override Type MakeArrayType(int rank)
319public override Type MakeGenericType(params Type[] typeArguments)
327public static MethodInfo GetMethod(Type type, MethodInfo method)
374public static ConstructorInfo GetConstructor(Type type, ConstructorInfo constructor)
407public static FieldInfo GetField(Type type, FieldInfo field)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\TypeBuilderInstantiation.cs (41)
18private Type _genericType;
19private Type[] _typeArguments;
32internal static Type MakeGenericType(Type type, Type[] typeArguments)
41foreach (Type t in typeArguments)
51internal TypeBuilderInstantiation(Type type, Type[] inst)
67public override Type? DeclaringType => _genericType.DeclaringType;
69public override Type? ReflectedType => _genericType.ReflectedType;
77public override Type MakePointerType()
81public override Type MakeByRefType()
85public override Type MakeArrayType()
89public override Type MakeArrayType(int rank)
115private Type Substitute(Type[] substitutes)
117Type[] inst = GetGenericArguments();
118Type[] instSubstituted = new Type[inst.Length];
122Type t = inst[i];
141public override Type? BaseType
151Type? typeBldrBase = _genericType.BaseType;
165protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
171protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
184public override Type GetInterface(string name, bool ignoreCase) { throw new NotSupportedException(); }
187public override Type[] GetInterfaces() { throw new NotSupportedException(); }
196protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
202public override Type[] GetNestedTypes(BindingFlags bindingAttr) { throw new NotSupportedException(); }
205public override Type GetNestedType(string name, BindingFlags bindingAttr) { throw new NotSupportedException(); }
210public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) { throw new NotSupportedException(); }
228public override Type GetElementType() { throw new NotSupportedException(); }
230public override Type UnderlyingSystemType => this;
231public override Type[] GetGenericArguments() { return _typeArguments; }
252public override Type GetGenericTypeDefinition() { return _genericType; }
255public override Type MakeGenericType(params Type[] inst) { throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericTypeDefinition, this)); }
256public override bool IsAssignableFrom([NotNullWhen(true)] Type? c) { throw new NotSupportedException(); }
258public override bool IsSubclassOf(Type c)
267public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); }
269public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); }
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokerEmitUtil.cs (8)
26Type[] delegateParameters = [typeof(object), typeof(object), typeof(object), typeof(object), typeof(object)];
94Type[] delegateParameters = [typeof(object), typeof(Span<object>)];
151Type[] delegateParameters = [typeof(object), typeof(object), typeof(IntPtr*)];
199private static void Unbox(ILGenerator il, Type parameterType)
239Type returnType = method.DeclaringType!;
342s_Pointer_Box ??= typeof(Pointer).GetMethod(nameof(Pointer.Box), [typeof(void*), typeof(Type)])!;
346s_Type_GetTypeFromHandle ??= typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle), [typeof(RuntimeTypeHandle)])!;
src\libraries\System.Private.CoreLib\src\System\Reflection\ModifiedType.cs (29)
16private readonly Type _unmodifiedType;
18internal ModifiedType(Type unmodifiedType, TypeSignature typeSignature)
29protected static Type Create(Type unmodifiedType, TypeSignature typeSignature)
31Type modifiedType;
51protected Type UnmodifiedType => _unmodifiedType;
56public override Type[] GetRequiredCustomModifiers()
62public override Type[] GetOptionalCustomModifiers()
71public override bool Equals(Type? other) => throw new NotSupportedException(SR.NotSupported_ModifiedType);
75public override Type UnderlyingSystemType => _unmodifiedType;
79public override Type GetGenericTypeDefinition() => _unmodifiedType.GetGenericTypeDefinition();
96public override Type? BaseType => throw new NotSupportedException(SR.NotSupported_ModifiedType);
97public override Type? DeclaringType => throw new NotSupportedException(SR.NotSupported_ModifiedType);
98public override Type? ReflectedType => throw new NotSupportedException(SR.NotSupported_ModifiedType);
102CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_ModifiedType);
109CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
121public override Type[] GetFunctionPointerCallingConventions() => _unmodifiedType.GetFunctionPointerCallingConventions();
122public override Type[] GetFunctionPointerParameterTypes() => _unmodifiedType.GetFunctionPointerParameterTypes();
123public override Type GetFunctionPointerReturnType() => _unmodifiedType.GetFunctionPointerReturnType();
127public override Type? GetInterface(string name, bool ignoreCase) => throw new NotSupportedException(SR.NotSupported_ModifiedType);
130public override Type[] GetInterfaces() => throw new NotSupportedException(SR.NotSupported_ModifiedType);
131public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => _unmodifiedType.GetInterfaceMap(interfaceType);
141Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
151public override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_ModifiedType);
154public override Type? GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_ModifiedType);
192public override Type? GetElementType() => _unmodifiedType.GetElementType(); // Supported
197public override object[] GetCustomAttributes(Type attributeType, bool inherit) => _unmodifiedType.GetCustomAttributes(attributeType, inherit);
198public override bool IsDefined(Type attributeType, bool inherit) => _unmodifiedType.IsDefined(attributeType, inherit);
src\libraries\System.Private.CoreLib\src\System\Reflection\Module.cs (24)
32public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
36public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
47public MethodInfo? GetMethod(string name, Type[] types) => GetMethod(name, DefaultLookup, null, CallingConventions.Any, types, null);
49public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
62protected virtual MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { throw NotImplemented.ByDesign; }
80public virtual Type[] GetTypes() { throw NotImplemented.ByDesign; }
83public virtual Type? GetType(string className) => GetType(className, throwOnError: false, ignoreCase: false);
85public virtual Type? GetType(string className, bool ignoreCase) => GetType(className, throwOnError: false, ignoreCase: ignoreCase);
87public virtual Type? GetType(string className, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; }
90public virtual Type[] FindTypes(TypeFilter? filter, object? filterCriteria)
92Type[] c = GetTypes();
104Type[] ret = new Type[cnt];
119public virtual FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; }
124public virtual MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; }
129public virtual MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; }
137public Type ResolveType(int metadataToken) => ResolveType(metadataToken, null, null);
139public virtual Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) { throw NotImplemented.ByDesign; }
179private static bool FilterTypeNameImpl(Type cls, object filterCriteria, StringComparison comparison)
src\libraries\System.Private.CoreLib\src\System\Reflection\NullabilityInfoContext.cs (23)
337private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser)
350private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser, ref int index)
355Type underlyingType = type;
395Type[] genericArguments = underlyingType.GetGenericArguments();
425Type? metaType = null;
443Type? type = member.DeclaringType;
452private static Type GetPropertyMetaType(PropertyInfo property)
462private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType, Type? reflectedType)
475Type[] genericArguments = metaType.GetGenericArguments();
495private bool TryUpdateGenericParameterNullability(NullabilityInfo nullability, Type genericParameter, Type? reflectedType)
533private bool TryUpdateGenericTypeParameterNullabilityFromReflectedType(NullabilityInfo nullability, Type genericParameter, Type context, Type reflectedType)
542Type contextTypeDefinition = context.IsGenericType && !context.IsGenericTypeDefinition ? context.GetGenericTypeDefinition() : context;
548Type? baseType = contextTypeDefinition.BaseType;
560Type[] genericArguments = baseType.GetGenericArguments();
561Type genericArgument = genericArguments[genericParameter.GenericParameterPosition];
575static int CountNullabilityStates(Type type)
577Type underlyingType = Nullable.GetUnderlyingType(type) ?? type;
581foreach (Type genericArgument in underlyingType.GetGenericArguments())
645private static bool IsValueTypeOrValueTypeByRef(Type type) =>
src\libraries\System.Private.CoreLib\src\System\Reflection\SignatureType.cs (33)
41public sealed override Type MakeArrayType() => new SignatureArrayType(this, rank: 1, isMultiDim: false);
43public sealed override Type MakeArrayType(int rank)
49public sealed override Type MakeByRefType() => new SignatureByRefType(this);
50public sealed override Type MakePointerType() => new SignaturePointerType(this);
54public sealed override Type MakeGenericType(params Type[] typeArguments) => throw new NotSupportedException(SR.NotSupported_SignatureType); // There is no SignatureType for type definition types so it would never be legal to call this.
57public sealed override Type? GetElementType() => ElementType;
59public abstract override Type GetGenericTypeDefinition();
60public abstract override Type[] GenericTypeArguments { get; }
61public abstract override Type[] GetGenericArguments();
68public sealed override bool Equals(Type? o) => base.Equals(o);
71public sealed override Type UnderlyingSystemType => this; // Equals(Type) depends on this.
84public sealed override Type ReflectedType => throw new NotSupportedException(SR.NotSupported_SignatureType);
85public sealed override Type BaseType => throw new NotSupportedException(SR.NotSupported_SignatureType);
88public sealed override Type[] GetInterfaces() => throw new NotSupportedException(SR.NotSupported_SignatureType);
89public sealed override bool IsAssignableFrom([NotNullWhen(true)] Type? c) => throw new NotSupportedException(SR.NotSupported_SignatureType);
93public sealed override Type DeclaringType => throw new NotSupportedException(SR.NotSupported_SignatureType);
96public sealed override Type[] GetGenericParameterConstraints() => throw new NotSupportedException(SR.NotSupported_SignatureType);
101public sealed override Type GetEnumUnderlyingType() => throw new NotSupportedException(SR.NotSupported_SignatureType);
130public sealed override Type GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType);
133public sealed override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException(SR.NotSupported_SignatureType);
142protected sealed override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
145protected sealed override MethodInfo GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
148protected sealed override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
172public sealed override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_SignatureType);
173public sealed override bool IsDefined(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_SignatureType);
178public sealed override Type GetInterface(string name, bool ignoreCase) => throw new NotSupportedException(SR.NotSupported_SignatureType);
181protected sealed override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException(SR.NotSupported_SignatureType);
188public sealed override Type[] FindInterfaces(TypeFilter filter, object? filterCriteria) => throw new NotSupportedException(SR.NotSupported_SignatureType);
189public sealed override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => throw new NotSupportedException(SR.NotSupported_SignatureType);
192public sealed override bool IsEquivalentTo([NotNullWhen(true)] Type? other) => throw new NotSupportedException(SR.NotSupported_SignatureType);
200public sealed override bool IsSubclassOf(Type c) => throw new NotSupportedException(SR.NotSupported_SignatureType);
src\libraries\System.Private.CoreLib\src\System\Reflection\TypeDelegator.cs (19)
27protected Type typeImpl = null!;
34public TypeDelegator([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type delegatingType)
58public override Type? BaseType => typeImpl.BaseType;
62CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
72CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
91public override Type[] GetFunctionPointerCallingConventions() => typeImpl.GetFunctionPointerCallingConventions();
92public override Type[] GetFunctionPointerParameterTypes() => typeImpl.GetFunctionPointerParameterTypes();
93public override Type GetFunctionPointerReturnType() => typeImpl.GetFunctionPointerReturnType();
97public override Type? GetInterface(string name, bool ignoreCase) => typeImpl.GetInterface(name, ignoreCase);
100public override Type[] GetInterfaces() => typeImpl.GetInterfaces();
110Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
125public override Type[] GetNestedTypes(BindingFlags bindingAttr) => typeImpl.GetNestedTypes(bindingAttr);
128public override Type? GetNestedType(string name, BindingFlags bindingAttr) => typeImpl.GetNestedType(name, bindingAttr);
160public override Type? GetElementType() => typeImpl.GetElementType();
163public override Type UnderlyingSystemType => typeImpl.UnderlyingSystemType;
167public override object[] GetCustomAttributes(Type attributeType, bool inherit) => typeImpl.GetCustomAttributes(attributeType, inherit);
169public override bool IsDefined(Type attributeType, bool inherit) => typeImpl.IsDefined(attributeType, inherit);
170public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => typeImpl.GetInterfaceMap(interfaceType);
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\UnmanagedCallersOnlyAttribute.cs (1)
31public Type[]? CallConvs;
src\libraries\System.Private.CoreLib\src\System\Runtime\Serialization\SerializationInfo.cs (33)
20private Type[] _types;
26private Type _rootType;
30public SerializationInfo(Type type, IFormatterConverter converter)
41_types = new Type[DefaultSize];
50public SerializationInfo(Type type, IFormatterConverter converter, bool requireSameTokenInPartialTrust)
82public void SetType(Type type)
98public Type ObjectType => _rootType;
121Type[] newTypes = new Type[newSize];
133public void AddValue(string name, object? value, Type type)
227internal void AddValueInternal(string name, object? value, Type type)
265internal void UpdateValue(string name, object value, Type type)
302private object? GetElement(string name, out Type foundType)
318private object? GetElementNoThrow(string name, out Type? foundType)
335public object? GetValue(string name, Type type)
342object? value = GetElement(name, out Type foundType);
353internal object? GetValueNoThrow(string name, Type type)
358object? value = GetElementNoThrow(name, out Type? foundType);
374object? value = GetElement(name, out Type foundType);
380object? value = GetElement(name, out Type foundType);
387object? value = GetElement(name, out Type foundType);
393object? value = GetElement(name, out Type foundType);
399object? value = GetElement(name, out Type foundType);
406object? value = GetElement(name, out Type foundType);
412object? value = GetElement(name, out Type foundType);
419object? value = GetElement(name, out Type foundType);
425object? value = GetElement(name, out Type foundType);
432object? value = GetElement(name, out Type foundType);
438object? value = GetElement(name, out Type foundType);
445object? value = GetElement(name, out Type foundType);
451object? value = GetElement(name, out Type foundType);
457object? value = GetElement(name, out Type foundType);
463object? value = GetElement(name, out Type foundType);
src\libraries\System.Private.CoreLib\src\System\Type.cs (96)
21public new Type GetType() => base.GetType();
43public override Type? DeclaringType => null;
46public override Type? ReflectedType => null;
47public abstract Type UnderlyingSystemType { get; }
73public abstract Type? GetElementType();
78public virtual Type GetGenericTypeDefinition() => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
79public virtual Type[] GenericTypeArguments => (IsGenericType && !IsGenericTypeDefinition) ? GetGenericArguments() : EmptyTypes;
80public virtual Type[] GetGenericArguments() => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
82public virtual Type[] GetOptionalCustomModifiers() => EmptyTypes;
83public virtual Type[] GetRequiredCustomModifiers() => EmptyTypes;
87public virtual Type[] GetGenericParameterConstraints()
143public bool IsAssignableTo([NotNullWhen(true)] Type? targetType) => targetType?.IsAssignableFrom(this) ?? false;
160public ConstructorInfo? GetConstructor(Type[] types) => GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, types, null);
173/// An empty array of the type <see cref="Type"/> (that is, Type[] types = Array.Empty{Type}()) to get a constructor that takes no parameters.
181public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Type[] types) => GetConstructor(bindingAttr, binder: null, types, modifiers: null);
184public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetConstructor(bindingAttr, binder, CallingConventions.Any, types, modifiers);
187public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
199protected abstract ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers);
231public virtual Type[] GetFunctionPointerCallingConventions() => throw new NotSupportedException();
232public virtual Type GetFunctionPointerReturnType() => throw new NotSupportedException();
233public virtual Type[] GetFunctionPointerParameterTypes() => throw new NotSupportedException();
260/// Searches for the <see cref="MemberInfo"/> on the current <see cref="Type"/> that matches the specified <see cref="MemberInfo"/>.
263/// The <see cref="MemberInfo"/> to find on the current <see cref="Type"/>.
265/// <returns>An object representing the member on the current <see cref="Type"/> that matches the specified member.</returns>
268/// <exception cref="ArgumentException"><paramref name="member"/> does not match a member on the current <see cref="Type"/>.</exception>
315/// An array of <see cref="Type"/> objects representing the number, order, and type of the parameters for the method to get.
317/// An empty array of <see cref="Type"/> objects (as provided by the <see cref="EmptyTypes"/> field) to get a method that takes no parameters.
321public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Type[] types) => GetMethod(name, bindingAttr, binder: null, types, modifiers: null);
324public MethodInfo? GetMethod(string name, Type[] types) => GetMethod(name, types, null);
327public MethodInfo? GetMethod(string name, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, DefaultLookup, null, types, modifiers);
330public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
333public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
346protected abstract MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers);
349public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types) => GetMethod(name, genericParameterCount, types, null);
352public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, genericParameterCount, DefaultLookup, null, types, modifiers);
365/// An array of <see cref="Type"/> objects representing the number, order, and type of the parameters for the method to get.
367/// An empty array of <see cref="Type"/> objects (as provided by the <see cref="EmptyTypes"/> field) to get a method that takes no parameters.
371public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Type[] types) => GetMethod(name, genericParameterCount, bindingAttr, null, types, null);
374public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, genericParameterCount, bindingAttr, binder, CallingConventions.Any, types, modifiers);
377public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
390protected virtual MethodInfo? GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
399public Type? GetNestedType(string name) => GetNestedType(name, DefaultLookup);
402public abstract Type? GetNestedType(string name, BindingFlags bindingAttr);
405public Type[] GetNestedTypes() => GetNestedTypes(DefaultLookup);
408public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
424public PropertyInfo? GetProperty(string name, Type? returnType)
432public PropertyInfo? GetProperty(string name, Type[] types) => GetProperty(name, null, types);
435public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types) => GetProperty(name, returnType, types, null);
438public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types, ParameterModifier[]? modifiers) => GetProperty(name, DefaultLookup, null, returnType, types, modifiers);
441public PropertyInfo? GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
450protected abstract PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers);
480public static Type[] GetTypeArray(object[] args)
484Type[] cls = new Type[args.Length];
495public static TypeCode GetTypeCode(Type? type)
549Type systemType = UnderlyingSystemType;
559public static Type? GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
561public static Type? GetTypeFromCLSID(Guid clsid, bool throwOnError) => GetTypeFromCLSID(clsid, null, throwOnError: throwOnError);
563public static Type? GetTypeFromCLSID(Guid clsid, string? server) => GetTypeFromCLSID(clsid, server, throwOnError: false);
565public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError) => Marshal.GetTypeFromCLSID(clsid, server, throwOnError);
568public static Type? GetTypeFromProgID(string progID) => GetTypeFromProgID(progID, null, throwOnError: false);
570public static Type? GetTypeFromProgID(string progID, bool throwOnError) => GetTypeFromProgID(progID, null, throwOnError: throwOnError);
572public static Type? GetTypeFromProgID(string progID, string? server) => GetTypeFromProgID(progID, server, throwOnError: false);
574public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) => Marshal.GetTypeFromProgID(progID, server, throwOnError);
576public abstract Type? BaseType { get; }
593public Type? GetInterface(string name) => GetInterface(name, ignoreCase: false);
596public abstract Type? GetInterface(string name, bool ignoreCase);
598public abstract Type[] GetInterfaces();
600public virtual InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
603public virtual bool IsEquivalentTo([NotNullWhen(true)] Type? other) => this == other;
608public virtual Type GetEnumUnderlyingType()
643public virtual Type MakeArrayType() => throw new NotSupportedException();
645public virtual Type MakeArrayType(int rank) => throw new NotSupportedException();
646public virtual Type MakeByRefType() => throw new NotSupportedException();
650public virtual Type MakeGenericType(params Type[] typeArguments) => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
652public virtual Type MakePointerType() => throw new NotSupportedException();
654public static Type MakeGenericSignatureType(Type genericTypeDefinition, params Type[] typeArguments) => new SignatureConstructedGenericType(genericTypeDefinition, typeArguments);
656public static Type MakeGenericMethodParameter(int position)
670Type elementType = GetRootElementType();
683public override bool Equals(object? o) => o == null ? false : Equals(o as Type);
686Type systemType = UnderlyingSystemType;
691public virtual bool Equals(Type? o) => o == null ? false : ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType);
694public static bool operator ==(Type? left, Type? right)
709public static bool operator !=(Type? left, Type? right)
715public static Type? ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly);
725public static readonly Type[] EmptyTypes = Array.Empty<Type>();
src\System\Attribute.CoreCLR.cs (52)
16private static Attribute[] InternalGetCustomAttributes(PropertyInfo element, Type type, bool inherit)
29Type[] indexParamTypes = GetIndexParameterTypes(element);
35Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
53private static bool InternalIsDefined(PropertyInfo element, Type attributeType, bool inherit)
67Type[] indexParamTypes = GetIndexParameterTypes(element);
86private static PropertyInfo? GetParentDefinition(PropertyInfo property, Type[] propertyParameters)
120private static Attribute[] InternalGetCustomAttributes(EventInfo element, Type type, bool inherit)
141Dictionary<Type, AttributeUsageAttribute> types = new Dictionary<Type, AttributeUsageAttribute>(11);
178private static bool InternalIsDefined(EventInfo element, Type attributeType, bool inherit)
237private static Attribute[] InternalParamGetCustomAttributes(ParameterInfo param, Type? type, bool inherit)
248List<Type> disAllowMultiple = new List<Type>();
257Type objType = objAttr[i]!.GetType();
285Type objType = objAttr[i]!.GetType();
326private static bool InternalParamIsDefined(ParameterInfo param, Type type, bool inherit)
351Type objType = objAttr[i].GetType();
367private static void CopyToAttributeList(List<Attribute> attributeList, Attribute[] attributes, Dictionary<Type, AttributeUsageAttribute> types)
373Type attrType = attributes[i].GetType();
380private static Type[] GetIndexParameterTypes(PropertyInfo element)
386Type[] indexParamTypes = new Type[indexParams.Length];
394return Type.EmptyTypes;
397private static void AddAttributesToList(List<Attribute> attributeList, Attribute[] attributes, Dictionary<Type, AttributeUsageAttribute> types)
401Type attrType = attributes[i].GetType();
421private static AttributeUsageAttribute InternalGetAttributeUsage(Type type)
436private static Attribute[] CreateAttributeArrayHelper(Type elementType, int elementCount) =>
445public static Attribute[] GetCustomAttributes(MemberInfo element, Type attributeType)
450public static Attribute[] GetCustomAttributes(MemberInfo element, Type attributeType, bool inherit)
483public static bool IsDefined(MemberInfo element, Type attributeType)
488public static bool IsDefined(MemberInfo element, Type attributeType, bool inherit)
505public static Attribute? GetCustomAttribute(MemberInfo element, Type attributeType)
510public static Attribute? GetCustomAttribute(MemberInfo element, Type attributeType, bool inherit)
532public static Attribute[] GetCustomAttributes(ParameterInfo element, Type attributeType)
537public static Attribute[] GetCustomAttributes(ParameterInfo element, Type attributeType, bool inherit)
569public static bool IsDefined(ParameterInfo element, Type attributeType)
574public static bool IsDefined(ParameterInfo element, Type attributeType, bool inherit)
603public static Attribute? GetCustomAttribute(ParameterInfo element, Type attributeType)
608public static Attribute? GetCustomAttribute(ParameterInfo element, Type attributeType, bool inherit)
627public static Attribute[] GetCustomAttributes(Module element, Type attributeType)
644public static Attribute[] GetCustomAttributes(Module element, Type attributeType, bool inherit)
655public static bool IsDefined(Module element, Type attributeType)
660public static bool IsDefined(Module element, Type attributeType, bool inherit)
673public static Attribute? GetCustomAttribute(Module element, Type attributeType)
678public static Attribute? GetCustomAttribute(Module element, Type attributeType, bool inherit)
697public static Attribute[] GetCustomAttributes(Assembly element, Type attributeType)
702public static Attribute[] GetCustomAttributes(Assembly element, Type attributeType, bool inherit)
725public static bool IsDefined(Assembly element, Type attributeType)
730public static bool IsDefined(Assembly element, Type attributeType, bool inherit)
743public static Attribute? GetCustomAttribute(Assembly element, Type attributeType)
748public static Attribute? GetCustomAttribute(Assembly element, Type attributeType, bool inherit)
src\System\Delegate.CoreCLR.cs (9)
57protected Delegate([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.AllMethods)] Type target, string method)
187Type targetType = declaringType.GetGenericTypeDefinition();
188Type? currentType;
225public static Delegate? CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure)
260public static Delegate? CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.AllMethods)] Type target, string method, bool ignoreCase, bool throwOnBindFailure)
296public static Delegate? CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure)
331public static Delegate? CreateDelegate(Type type, object? firstArgument, MethodInfo method, bool throwOnBindFailure)
367internal static Delegate CreateDelegateNoSecurityCheck(Type type, object? target, RuntimeMethodHandle method)
src\System\Reflection\Emit\DynamicILGenerator.cs (27)
35public override LocalBuilder DeclareLocal(Type localType, bool pinned)
129public override void Emit(OpCode opcode, Type type)
173Type? returnType,
174Type[]? parameterTypes,
175Type[]? optionalParameterTypes)
213public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes)
241public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
328public override void BeginCatchBlock(Type? exceptionType)
390private int GetMemberRefToken(MethodInfo methodInfo, Type[]? optionalParameterTypes)
392Type[]? parameterTypes;
393Type[][]? requiredCustomModifiers;
394Type[][]? optionalCustomModifiers;
408parameterTypes = new Type[paramInfo.Length];
409requiredCustomModifiers = new Type[parameterTypes.Length][];
410optionalCustomModifiers = new Type[parameterTypes.Length][];
441Type? returnType,
442Type[]? parameterTypes)
451Type? returnType,
452Type[]? parameterTypes,
453Type[][]? requiredCustomModifiers,
454Type[][]? optionalCustomModifiers,
455Type[]? optionalParameterTypes)
467private void AddParameters(SignatureHelper sigHelp, Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
1016Type t = m.DeclaringType!.GetGenericTypeDefinition();
src\System\Reflection\Emit\RuntimeEnumBuilder.cs (18)
87public override Type? BaseType => m_typeBuilder.BaseType;
93CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
107CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
135public override Type? GetInterface(string name, bool ignoreCase)
141public override Type[] GetInterfaces()
160Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
172public override Type[] GetNestedTypes(BindingFlags bindingAttr)
178public override Type? GetNestedType(string name, BindingFlags bindingAttr)
195public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
246public override Type? GetElementType()
257public override Type GetEnumUnderlyingType()
262public override Type UnderlyingSystemType => GetEnumUnderlyingType();
271public override object[] GetCustomAttributes(Type attributeType, bool inherit)
283public override Type? DeclaringType => m_typeBuilder.DeclaringType;
287public override Type? ReflectedType => m_typeBuilder.ReflectedType;
290public override bool IsDefined(Type attributeType, bool inherit)
301Type underlyingType, // underlying type for an Enum
src\System\Reflection\Emit\RuntimeGenericTypeParameterBuilder.cs (28)
46public override Type? DeclaringType => m_type.DeclaringType;
48public override Type? ReflectedType => m_type.ReflectedType;
61public override Type MakePointerType()
66public override Type MakeByRefType()
72public override Type MakeArrayType()
78public override Type MakeArrayType(int rank)
100public override Type? BaseType => m_type.BaseType;
103protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
109protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
122public override Type GetInterface(string name, bool ignoreCase) { throw new NotSupportedException(); }
125public override Type[] GetInterfaces() { throw new NotSupportedException(); }
134protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) { throw new NotSupportedException(); }
140public override Type[] GetNestedTypes(BindingFlags bindingAttr) { throw new NotSupportedException(); }
143public override Type GetNestedType(string name, BindingFlags bindingAttr) { throw new NotSupportedException(); }
148public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) { throw new NotSupportedException(); }
172public override Type GetElementType() { throw new NotSupportedException(); }
176public override Type UnderlyingSystemType => this;
178public override Type[] GetGenericArguments() { throw new InvalidOperationException(); }
196public override Type GetGenericTypeDefinition() { throw new InvalidOperationException(); }
200public override Type MakeGenericType(params Type[] typeArguments) { throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericTypeDefinition, this)); }
204public override bool IsAssignableFrom([NotNullWhen(true)] Type? c) { throw new NotSupportedException(); }
206public override bool IsSubclassOf(Type c) { throw new NotSupportedException(); }
212public override object[] GetCustomAttributes(Type attributeType, bool inherit) { throw new NotSupportedException(); }
214public override bool IsDefined(Type attributeType, bool inherit) { throw new NotSupportedException(); }
223protected override void SetBaseTypeConstraintCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? baseTypeConstraint)
228protected override void SetInterfaceConstraintsCore(params Type[]? interfaceConstraints)
src\System\Reflection\Emit\RuntimeILGenerator.cs (20)
169private int GetMethodToken(MethodBase method, Type[]? optionalParameterTypes, bool useMethodDef)
176Type? returnType,
177Type[]? parameterTypes,
178Type[]? optionalParameterTypes)
515Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes)
556public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes)
599public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
616Type[] parameters = methodInfo.GetParameterTypes();
696Type[] parameters = con.GetParameterTypes();
706public override void Emit(OpCode opcode, Type cls)
1003public override void BeginCatchBlock(Type? exceptionType)
1164public override LocalBuilder DeclareLocal(Type localType, bool pinned)
1263internal Type[] m_catchClass;
1279m_catchClass = new Type[4];
1290Type? catchClass, // catch exception type
1352internal void MarkCatchAddr(int catchAddr, Type? catchException)
1414internal Type[] GetCatchClass()
src\System\Reflection\Emit\RuntimeMethodBuilder.cs (36)
45internal Type[]? m_parameterTypes;
46private Type m_returnType;
47private Type[]? m_returnTypeRequiredCustomModifiers;
48private Type[]? m_returnTypeOptionalCustomModifiers;
49private Type[][]? m_parameterTypeRequiredCustomModifiers;
50private Type[][]? m_parameterTypeOptionalCustomModifiers;
60Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
61Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
73foreach (Type t in parameterTypes)
100m_parameterTypes = new Type[parameterTypes.Length];
145Type[] catchClass;
240internal override Type[] GetParameterTypes() => m_parameterTypes ??= Type.EmptyTypes;
242internal static Type? GetMethodBaseReturnType(MethodBase? method)
278m_parameterTypes ??= Type.EmptyTypes;
409public override Type? DeclaringType
421public override Type? ReflectedType => DeclaringType;
455public override Type ReturnType => m_returnType;
487public override object[] GetCustomAttributes(Type attributeType, bool inherit)
492public override bool IsDefined(Type attributeType, bool inherit)
508public override Type[] GetGenericArguments() => m_inst ?? Type.EmptyTypes;
512public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
614Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
615Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
631m_parameterTypes = new Type[parameterTypes.Length];
714Type? caType = con.DeclaringType;
720Type? caType = con.DeclaringType;
src\System\Reflection\Emit\RuntimeModuleBuilder.cs (90)
49private readonly Dictionary<string, Type> _typeBuilderDict;
71_typeBuilderDict = new Dictionary<string, Type>();
77internal void AddType(string name, Type type) => _typeBuilderDict.Add(name, type);
79internal void CheckTypeNameConflict(string strTypeName, Type? enclosingType)
81if (_typeBuilderDict.TryGetValue(strTypeName, out Type? foundType) &&
89private static Type? GetType(string strFormat, Type baseType)
180internal Type? FindTypeBuilderWithName(string strTypeName, bool ignoreCase)
194if (_typeBuilderDict.TryGetValue(strTypeName, out Type? foundType))
203private int GetTypeRefNested(Type type, Module? refedModule)
206Type? enclosingType = type.DeclaringType;
258Type[] parameterTypes = new Type[parameters.Length];
259Type[][] requiredCustomModifiers = new Type[parameters.Length][];
260Type[][] optionalCustomModifiers = new Type[parameters.Length][];
304private int GetMemberRefToken(MethodBase method, Type[]? optionalParameterTypes)
372internal SignatureHelper GetMemberRefSignature(CallingConventions call, Type? returnType,
373Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers,
374Type[]? optionalParameterTypes, int cGenericParameters)
460Type[] parameterTypes = new Type[parameters.Length];
461Type[][] requiredCustomModifiers = new Type[parameterTypes.Length][];
462Type[][] optionalCustomModifiers = new Type[parameterTypes.Length][];
489public override object[] GetCustomAttributes(Type attributeType, bool inherit)
494public override bool IsDefined(Type attributeType, bool inherit)
509public override Type[] GetTypes()
517internal Type[] GetTypesNoLock()
519Type[] typeList = new Type[_typeBuilderDict.Count];
522foreach (Type builder in _typeBuilderDict.Values)
543public override Type? GetType(string className)
549public override Type? GetType(string className, bool ignoreCase)
555public override Type? GetType(string className, bool throwOnError, bool ignoreCase)
564private Type? GetTypeNoLock(string className, bool throwOnError, bool ignoreCase)
574Type? baseType = InternalModule.GetType(className, throwOnError, ignoreCase);
661public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
667public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
673public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
679public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
723CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
742protected override TypeBuilder DefineTypeCore(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize)
756protected override EnumBuilder DefineEnumCore(string name, TypeAttributes visibility, Type underlyingType)
776MethodAttributes attributes, CallingConventions callingConvention, Type? returnType,
777Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
792Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
793Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
804Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
805Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
881internal int GetTypeTokenInternal(Type type, bool getGenericDefinition = false)
889public override int GetTypeMetadataToken(Type type)
894private int GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition)
995Type declaringType = method.DeclaringType ??
1003Type[] tt = new Type[paramInfo.Length];
1021Type[] parameterTypes = new Type[parameters.Length];
1022Type[][] requiredCustomModifiers = new Type[parameterTypes.Length][];
1023Type[][] optionalCustomModifiers = new Type[parameterTypes.Length][];
1057internal int GetMethodTokenInternal(MethodBase method, Type[]? optionalParameterTypes, bool useMethodDef)
1122internal int GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention,
1123Type? returnType, Type[]? parameterTypes)
1131private int GetArrayMethodTokenNoLock(Type arrayClass, string methodName, CallingConventions callingConvention,
1132Type? returnType, Type[]? parameterTypes)
1151protected override MethodInfo GetArrayMethodCore(Type arrayClass, string methodName, CallingConventions callingConvention,
1152Type? returnType, Type[]? parameterTypes)
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (75)
137internal static bool IsTypeEqual(Type? t1, Type? t2)
144Type? runtimeType1;
145Type? runtimeType2;
181internal static unsafe void SetConstantValue(RuntimeModuleBuilder module, int tk, Type destType, object? value)
188Type type = value.GetType();
213Type? underlyingType;
312private Type? m_typeParent;
314private List<Type>? m_typeInterfaces;
325private Type? m_enumUnderlyingType;
358m_typeInterfaces = new List<Type>();
372m_typeInterfaces = new List<Type>();
380string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, RuntimeModuleBuilder module,
483Type? temp = m_module.FindTypeBuilderWithName(strValueClassName, false);
611public override Type? DeclaringType => m_DeclaringType;
613public override Type? ReflectedType => m_DeclaringType;
659public override Type? BaseType => m_typeParent;
663CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
682CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
726public override Type? GetInterface(string name, bool ignoreCase)
735public override Type[] GetInterfaces()
770Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
785public override Type[] GetNestedTypes(BindingFlags bindingAttr)
794public override Type? GetNestedType(string name, BindingFlags bindingAttr)
811public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
840public override bool IsAssignableFrom([NotNullWhen(true)] Type? c)
845Type? fromRuntimeType;
876Type[] interfaces = fromTypeBuilder.GetInterfaces();
920public override Type GetElementType()
937public override bool IsSubclassOf(Type c)
939Type? p = this;
957public override Type UnderlyingSystemType
989public override object[] GetCustomAttributes(Type attributeType, bool inherit)
1002public override bool IsDefined(Type attributeType, bool inherit)
1022internal void SetInterfaces(params Type[]? interfaces)
1026m_typeInterfaces = new List<Type>();
1051public override Type[] GetGenericArguments() => m_inst ?? EmptyTypes;
1062public override Type GetGenericTypeDefinition() { if (IsGenericTypeDefinition) return this; if (m_genTypeDef == null) throw new InvalidOperationException(); return m_genTypeDef; }
1087Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
1088Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
1119Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
1120Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
1250Type? genericTypeDefinition = m_typeParent.GetGenericTypeDefinition();
1258Type inst = genericTypeDefinition.MakeGenericType(m_typeParent.GetGenericArguments());
1287Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
1303Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
1332protected override TypeBuilder DefineNestedTypeCore(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packSize, int typeSize)
1343protected override FieldBuilder DefineFieldCore(string fieldName, Type type, Type[]? requiredCustomModifiers,
1344Type[]? optionalCustomModifiers, FieldAttributes attributes)
1391Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
1392Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
1431protected override EventBuilder DefineEventCore(string name, EventAttributes attributes, Type eventtype)
1499m_typeInterfaces ??= new List<Type>();
1685protected override void SetParentCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
1713protected override void AddInterfaceImplementationCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType)
src\System\Reflection\Emit\SignatureHelper.cs (66)
19public static SignatureHelper GetMethodSigHelper(Module? mod, Type? returnType, Type[]? parameterTypes)
24public static SignatureHelper GetMethodSigHelper(Module? mod, CallingConventions callingConvention, Type? returnType)
29internal static SignatureHelper GetMethodSpecSigHelper(Module? scope, Type[] inst)
33foreach (Type t in inst)
40Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
41Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
49Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
50Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
77internal static SignatureHelper GetMethodSigHelper(Module? mod, CallingConvention unmanagedCallConv, Type? returnType)
112public static SignatureHelper GetMethodSigHelper(CallingConventions callingConvention, Type? returnType)
117internal static SignatureHelper GetMethodSigHelper(CallingConvention unmanagedCallingConvention, Type? returnType)
132public static SignatureHelper GetPropertySigHelper(Module? mod, Type? returnType, Type[]? parameterTypes)
138Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
139Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
145Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
146Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
164internal static SignatureHelper GetTypeSigToken(Module module, Type type)
190Type returnType, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
202Type returnType, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
207private SignatureHelper(Module mod, Type type)
260private void AddOneArgTypeHelper(Type argument, bool pinned)
268private void AddOneArgTypeHelper(Type clsArgument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
279Type t = optionalCustomModifiers[i];
300Type t = requiredCustomModifiers[i];
321private void AddOneArgTypeHelper(Type clsArgument) { AddOneArgTypeHelperWorker(clsArgument, false); }
322private void AddOneArgTypeHelperWorker(Type clsArgument, bool lastWasGenericInst)
339Type[] args = clsArgument.GetGenericArguments();
343foreach (Type t in args)
539private unsafe void InternalAddRuntimeType(Type type)
730internal void AddDynamicArgument(DynamicScope dynamicScope, Type clsArgument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
740Type t = optionalCustomModifiers[i];
763Type t = requiredCustomModifiers[i];
788public void AddArgument(Type clsArgument)
793public void AddArgument(Type argument, bool pinned)
801public void AddArguments(Type[]? arguments, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
818public void AddArgument(Type argument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
src\System\Reflection\RuntimeModule.cs (21)
27private static RuntimeTypeHandle[]? ConvertToTypeHandleArray(Type[]? genericArguments)
36Type? typeArg = genericArguments[i]?.UnderlyingSystemType;
74public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
109Type declaringType = RuntimeMethodHandle.GetDeclaringType(methodHandle);
130private FieldInfo? ResolveLiteralField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
142Type declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
158public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
219public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
251public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
323CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
330CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
358public override object[] GetCustomAttributes(Type attributeType, bool inherit)
368public override bool IsDefined(Type attributeType, bool inherit)
393public override Type? GetType(
430public override Type[] GetTypes() => GetDefinedTypes();
src\System\Reflection\TypeNameResolver.CoreCLR.cs (11)
18private Func<Assembly?, string, bool, Type?>? _typeResolver;
28internal static Type? GetType(
39internal static Type? GetType(
42Func<Assembly?, string, bool, Type?>? typeResolver,
77internal static Type? GetType(
188private Type? GetType(string escapedTypeName, ReadOnlySpan<string> nestedTypeNames, TypeName parsedName)
203Type? type;
280private Type? GetTypeFromDefaultAssemblies(string typeName, ReadOnlySpan<string> nestedTypeNames, TypeName parsedName)
285Type? type = requestingAssembly.GetTypeCore(typeName, nestedTypeNames, throwOnError: false, ignoreCase: _ignoreCase);
293Type? type = coreLib.GetTypeCore(typeName, nestedTypeNames, throwOnError: false, ignoreCase: _ignoreCase);
301Type? type = resolvedAssembly.GetTypeCore(typeName, nestedTypeNames, throwOnError: false, ignoreCase: _ignoreCase);
src\System\RuntimeType.CoreCLR.cs (63)
829Type[] interfaces;
839foreach (Type iface in interfaces)
985Type[] iFaces = iList.GetInterfaces();
1008Type[] ifaces = RuntimeTypeHandle.GetInterfaces(declaringType);
1009foreach (Type iface in ifaces)
1043Type[] constraints = declaringType.GetGenericParameterConstraints();
1052Type[] temp = constraint.GetInterfaces();
1492public Type[] FunctionPointerReturnAndParameterTypes { get; }
1494private FunctionPointerCache(Type[] functionPointerReturnAndParameterTypes)
1508internal Type[] FunctionPointerReturnAndParameterTypes
1555Type type = m_runtimeType;
1603Type DefaultMemberAttrType = typeof(DefaultMemberAttribute);
2018if (definition is Type)
2033Type genericArgument = genericArguments[i];
2034Type genericParameter = genericParameters[i];
2240Type type, BindingFlags bindingFlags, string name, bool prefixLookup, string? ns)
2257RuntimeMethodInfo method, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2264RuntimeConstructorInfo constructor, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2273MethodBase methodBase, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2380if (argumentTypes[i] is Type t && !t.MatchesParameterTypeExactly(parameterInfos[i]))
2519Type[]? types, bool allowPrefixLookup)
2544Type[]? types, bool allowPrefixLookup)
2565string? name, BindingFlags bindingAttr, Type[]? types, bool allowPrefixLookup)
2632private ListBuilder<Type> GetNestedTypeCandidates(string? fullname, BindingFlags bindingAttr, bool allowPrefixLookup)
2640ListBuilder<Type> candidates = new ListBuilder<Type>(cache.Length);
2686public override Type[] GetInterfaces()
2689return new ReadOnlySpan<Type>(candidates).ToArray();
2693public override Type[] GetNestedTypes(BindingFlags bindingAttr)
2706ListBuilder<Type> nestedTypes = GetNestedTypeCandidates(null, bindingAttr, false);
2729public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
2799Type[]? types, ParameterModifier[]? modifiers)
2807Type[]? types, ParameterModifier[]? modifiers)
2814Type[]? types, ParameterModifier[]? modifiers)
2850Type[] types, ParameterModifier[]? modifiers)
2876string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
2983public override Type? GetInterface(string fullname, bool ignoreCase)
3018public override Type? GetNestedType(string fullname, BindingFlags bindingAttr)
3056ListBuilder<Type> nestedTypes = default;
3284public override bool IsSubclassOf(Type type)
3543public override Type GetGenericTypeDefinition()
3582public override Type[] GetGenericArguments()
3584Type[] types = GetRootElementType().TypeHandle.GetInstantiationPublic();
3589public override Type MakeGenericType(Type[] instantiation)
3620Type instantiationElem = instantiation[i] ?? throw new ArgumentNullException();
3640return Reflection.Emit.TypeBuilderInstantiation.MakeGenericType(this, (Type[])(instantiation.Clone()));
3645Type ret;
3673public override Type[] GetGenericParameterConstraints()
3678Type[] constraints = new RuntimeTypeHandle(this).GetConstraints();
3705public override Type MakePointerType() => new RuntimeTypeHandle(this).MakePointer();
3707public override Type MakeByRefType() => new RuntimeTypeHandle(this).MakeByRef();
3709public override Type MakeArrayType() => new RuntimeTypeHandle(this).MakeSZArray();
3711public override Type MakeArrayType(int rank)
3790public override Type[] GetFunctionPointerCallingConventions()
3801public override Type[] GetFunctionPointerParameterTypes()
3808Type[] parameters = Cache.FunctionPointerReturnAndParameterTypes;
3819public override Type GetFunctionPointerReturnType()
3844public override Type? DeclaringType => Cache.GetEnclosingType();
3855Type elementType = GetRootElementType();
3892Type[] argsType = args.Length != 0 ? new Type[args.Length] : EmptyTypes;
src\System\Type.CoreCLR.cs (10)
16public static Type? GetType(string typeName, bool throwOnError, bool ignoreCase)
25public static Type? GetType(string typeName, bool throwOnError)
34public static Type? GetType(string typeName)
42public static Type? GetType(
45Func<Assembly?, string, bool, Type?>? typeResolver)
54public static Type? GetType(
57Func<Assembly?, string, bool, Type?>? typeResolver,
68public static Type? GetType(
71Func<Assembly?, string, bool, Type?>? typeResolver,
82public static Type? GetTypeFromHandle(RuntimeTypeHandle handle)
System.Private.DataContractSerialization (988)
System\Runtime\Serialization\ClassDataContract.cs (33)
36internal ClassDataContract(Type type) : base(new ClassDataContractCriticalHelper(type))
43private ClassDataContract(Type type, XmlDictionaryString ns, string[] memberNames) : base(new ClassDataContractCriticalHelper(type, ns, memberNames))
251internal static ClassDataContract CreateClassDataContractForKeyValue(Type type, XmlDictionaryString ns, string[] memberNames)
260Type declaringType = memberContract.MemberInfo.DeclaringType!;
275internal static XmlDictionaryString? GetChildNamespaceToDeclare(DataContract dataContract, Type childType, XmlDictionary dictionary)
288private static bool IsArraySegment(Type t)
302Type type)
324foreach (Type interfaceType in type.GetInterfaces())
349type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, Type.EmptyTypes) != null);
589private static Type[]? s_serInfoCtorArgs;
619Type type) : base(type)
633Type? baseType = type.BaseType;
725Type type, XmlDictionaryString ns, string[] memberNames) : base(type)
744private void EnsureIsReferenceImported(Type type)
801Type type = UnderlyingType;
1037private XmlQualifiedName GetXmlNameAndSetHasDataContract(Type type)
1051Type type)
1071Type type = UnderlyingType;
1076Type? prevAttributeType = null;
1118private static bool IsValidCallback(MethodInfo method, ParameterInfo[] parameters, Type attributeType, MethodInfo? currentCallback, ref Type? prevAttributeType)
1260Type type = UnderlyingType;
1265ConstructorInfo? ctor = type.GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, Type.EmptyTypes);
1278private static Type[] SerInfoCtorArgs => s_serInfoCtorArgs ??= new Type[] { typeof(SerializationInfo), typeof(StreamingContext) };
1316Type type = UnderlyingType;
1327Type boundType;
1336Type[] underlyingParamTypes = new Type[paramContracts.Length];
1345Type[] paramTypes = type.GetGenericArguments();
1349Type paramType = paramTypes[i];
1500internal Type ObjectType
1504Type type = UnderlyingType;
System\Runtime\Serialization\CodeGenerator.cs (56)
24s_getTypeFromHandle = typeof(Type).GetMethod("GetTypeFromHandle");
52s_arraySetValue = typeof(Array).GetMethod("SetValue", new Type[] { typeof(object), typeof(int) });
66s_objectToString = typeof(object).GetMethod("ToString", Type.EmptyTypes);
80s_stringFormat = typeof(string).GetMethod("Format", new Type[] { typeof(string), typeof(object[]) });
89internal static MethodInfo GetInvokeMethod(Type delegateType)
95private Type _delegateType = null!; // initialized in BeginMethod
111internal void BeginMethod(DynamicMethod dynamicMethod, Type delegateType, Type[] argTypes)
121internal void BeginMethod(string methodName, Type delegateType, bool allowPrivateMemberAccess)
125Type[] paramTypes = new Type[parameters.Length];
133private void BeginMethod(Type returnType, string methodName, Type[] argTypes, bool allowPrivateMemberAccess)
142private void InitILGeneration(Type[] argTypes)
180internal static Type GetVariableType(object var)
190internal LocalBuilder DeclareLocal(Type type, object initialValue)
198internal LocalBuilder DeclareLocal(Type type)
203internal LocalBuilder DeclareLocal(Type type, bool isPinned)
282internal void ForEach(LocalBuilder local, Type elementType,
317Type type = GetVariableType(value);
318TypeCode typeCode = Type.GetTypeCode(type);
518internal void InitObj(Type valueType)
523internal void NewArray(Type elementType, object len)
531Type objType = GetVariableType(obj).GetElementType()!;
545Type arrayType = GetVariableType(obj);
552Type objType = arrayType.GetElementType()!;
566private static bool IsStruct(Type objType)
571internal Type LoadMember(MemberInfo memberInfo)
573Type? memberType;
631internal void LoadDefaultValue(Type type)
635switch (Type.GetTypeCode(type))
719internal void ConvertAddress(Type source, Type target)
724internal void ConvertValue(Type source, Type target)
730internal void Castclass(Type target)
735internal void Box(Type type)
740internal void Unbox(Type type)
764internal void Ldobj(Type type)
766OpCode opCode = GetLdindOpCode(Type.GetTypeCode(type));
777internal void Stobj(Type type)
793internal void Ldtoken(Type t)
800Type valueType = o.GetType();
801if (o is Type t)
812switch (Type.GetTypeCode(valueType))
982internal void Ldelem(Type arrayElementType)
990OpCode opCode = GetLdelemOpCode(Type.GetTypeCode(arrayElementType));
996internal void Ldelema(Type arrayElementType)
1022internal void Stelem(Type arrayElementType)
1028OpCode opCode = GetStelemOpCode(Type.GetTypeCode(arrayElementType));
1150private void InternalConvert(Type source, Type target, bool isAddress)
1158OpCode opCode = GetConvOpCode(Type.GetTypeCode(target));
1305internal void ToString(Type type)
1321internal Type ArgType;
1322internal ArgBuilder(int index, Type argType)
System\Runtime\Serialization\CollectionDataContract.cs (93)
85internal CollectionDataContract(Type type) : base(new CollectionDataContractCriticalHelper(type))
92internal CollectionDataContract(Type type, DataContract itemContract) : base(new CollectionDataContractCriticalHelper(type, itemContract))
99internal CollectionDataContract(Type type, CollectionKind kind) : base(new CollectionDataContractCriticalHelper(type, kind))
106private CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, string? serializationExceptionMessage, string? deserializationExceptionMessage)
114private CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo? addMethod, ConstructorInfo? constructor)
122private CollectionDataContract(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo? addMethod, ConstructorInfo? constructor, bool isConstructorCheckRequired)
130private CollectionDataContract(Type type, string invalidCollectionInSharedContractMessage) : base(new CollectionDataContractCriticalHelper(type, invalidCollectionInSharedContractMessage))
150private static Type[] KnownInterfaces => CollectionDataContractCriticalHelper.KnownInterfaces;
154internal Type ItemType => _helper.ItemType;
395internal Type GetCollectionElementType()
402private static Type[]? s_knownInterfaces;
404private Type _itemType = null!; // _itemType is always set except for the "invalid" CollectionDataContract
428internal static Type[] KnownInterfaces =>
430s_knownInterfaces ??= new Type[]
444private void Init(CollectionKind kind, Type? itemType, CollectionDataContractAttribute? collectionContractAttribute)
502Type type) : base(type)
516Type type,
528Type type,
543Type type,
544CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, string? serializationExceptionMessage, string? deserializationExceptionMessage)
566Type type,
567CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo? addMethod, ConstructorInfo? constructor)
580internal CollectionDataContractCriticalHelper(Type type, CollectionKind kind, Type itemType, MethodInfo getEnumeratorMethod, MethodInfo? addMethod, ConstructorInfo? constructor, bool isConstructorCheckRequired)
590Type type,
599internal Type ItemType => _itemType;
787static MethodInfo GetBuildIncrementCollectionCountGenericDelegate(Type type) => BuildIncrementCollectionCountDelegateMethod.MakeGenericMethod(type);
793private static MethodInfo GetBuildIncrementCollectionCountGenericDelegate(Type type) => BuildIncrementCollectionCountDelegateMethod.MakeGenericMethod(type);
820Type[]? keyValueTypes = ItemType.GetGenericArguments();
836static MethodInfo GetBuildCreateGenericDictionaryEnumeratorGenericMethod(Type[] keyValueTypes) => GetBuildCreateGenericDictionaryEnumeratorMethodInfo.MakeGenericMethod(keyValueTypes[0], keyValueTypes[1]);
841internal Type GetCollectionElementType()
846Type? enumeratorType;
849Type[] keyValueTypes = ItemType.GetGenericArguments();
861MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
870Type ienumeratorInterface = Globals.TypeOfIEnumerator;
873Type[] interfaceTypes = enumeratorType.GetInterfaces();
874foreach (Type interfaceType in interfaceTypes)
890Type elementType = getCurrentMethod.ReturnType;
910private DataContract? GetSharedTypeContract(Type type)
925internal static bool IsCollectionInterface(Type type)
929return ((IList<Type>)KnownInterfaces).Contains(type);
934internal static bool IsCollection(Type type)
941internal static bool IsCollection(Type type, [NotNullWhen(true)] out Type? itemType)
948internal static bool IsCollection(Type type, bool constructorRequired, bool skipIfReadOnlyContract)
955private static bool IsCollectionHelper(Type type, [NotNullWhen(true)] out Type? itemType, bool constructorRequired, bool skipIfReadOnlyContract = false)
967internal static bool TryCreate(Type type, [NotNullWhen(true)] out DataContract? dataContract)
974internal static bool TryCreateGetOnlyCollectionDataContract(Type type, [NotNullWhen(true)] out DataContract? dataContract)
992Type type,
994Type interfaceType)
996Type? t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault();
1000private static bool IsArraySegment(Type t)
1007private static bool IsCollectionOrTryCreate(Type type, bool tryCreate, out DataContract? dataContract, out Type itemType, bool constructorRequired, bool skipIfReadOnlyContract = false)
1023Type? baseType = type.BaseType;
1051Type interfaceTypeToCheck = type.IsGenericType ? type.GetGenericTypeDefinition() : type;
1052Type[] knownInterfaces = KnownInterfaces;
1060Type[] genericArgs = type.GetGenericArguments();
1106defaultCtor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Type.EmptyTypes);
1127Type? knownInterfaceType = null;
1130Type[] interfaceTypes = type.GetInterfaces();
1131foreach (Type interfaceType in interfaceTypes)
1133Type interfaceTypeToCheck = interfaceType.IsGenericType ? interfaceType.GetGenericTypeDefinition() : interfaceType;
1134Type[] knownInterfaces = KnownInterfaces;
1165GetCollectionMethods(type, knownInterfaceType, new Type[] { itemType },
1204Type[]? addMethodTypeArray = null;
1214addMethodTypeArray = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject };
1224addMethodTypeArray = new Type[] { itemType };
1246internal static bool IsCollectionDataContract(Type type)
1253private static bool HandleIfInvalidCollection(Type type, bool tryCreate, bool hasCollectionDataContract, bool createContractWithException, string message, string? param, ref DataContract? dataContract)
1272private static void GetReadOnlyCollectionExceptionMessages(Type type, bool hasCollectionDataContract, string message, string? param, out string serializationExceptionMessage, out string deserializationExceptionMessage)
1288Type type,
1290Type interfaceType,
1293Type? t = type.GetInterfaces().Where(it => it.Equals(interfaceType)).FirstOrDefault();
1304Type type,
1306Type interfaceType,
1307Type[] addMethodTypeArray, bool addMethodOnInterface, out MethodInfo? getEnumeratorMethod, out MethodInfo? addMethod)
1319Type[] parentInterfaceTypes = interfaceType.GetInterfaces();
1324foreach (Type parentInterfaceType in parentInterfaceTypes)
1346getEnumeratorMethod = type.GetMethod(Globals.GetEnumeratorMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
1349Type? ienumerableInterface =
1359Type type,
1361Type ienumerableInterface)
1364private static bool IsKnownInterface(Type type)
1366Type typeToCheck = type.IsGenericType ? type.GetGenericTypeDefinition() : type;
1367foreach (Type knownInterfaceType in KnownInterfaces)
1388Type type = UnderlyingType;
1389Type[] paramTypes = type.GetGenericArguments();
1395Type boundType = type.MakeGenericType(paramTypes);
System\Runtime\Serialization\DataContract.cs (106)
55internal static DataContract GetDataContract(Type type)
79internal static DataContract GetDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type? type)
86internal static DataContract GetGetOnlyCollectionDataContract(int id, RuntimeTypeHandle typeHandle, Type? type)
99internal static DataContract GetGetOnlyCollectionDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type? type)
121internal static DataContract? GetBuiltInDataContract(Type type)
151internal static void ThrowInvalidDataContractException(string? message, Type? type)
159public virtual Type UnderlyingType => _helper.UnderlyingType;
161public virtual Type OriginalUnderlyingType => _helper.OriginalUnderlyingType;
165internal Type TypeForInitialization => _helper.TypeForInitialization;
304private static readonly ContextAwareDictionary<Type, DataContract?> s_typeToBuiltInContract = new();
318private readonly Type _underlyingType;
319private Type? _originalUnderlyingType;
332private Type _typeForInitialization;
336internal static DataContract GetDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type? type)
352internal static DataContract GetGetOnlyCollectionDataContractSkipValidation(int id, RuntimeTypeHandle typeHandle, Type? type)
428private static DataContract CreateDataContract(int id, RuntimeTypeHandle typeHandle, Type? type)
438type ??= Type.GetTypeFromHandle(typeHandle)!;
450private static DataContract CreateDataContract(Type type)
453Type originalType = type;
508private static DataContract CreateGetOnlyCollectionDataContract(int id, RuntimeTypeHandle typeHandle, Type? type)
516type ??= Type.GetTypeFromHandle(typeHandle)!;
533internal static Type GetDataContractAdapterType(Type type)
551internal static Type GetDataContractOriginalType(Type type)
578internal static DataContract? GetBuiltInDataContract(Type type)
583return s_typeToBuiltInContract.GetOrAdd(type, static (Type key) =>
623Type? type = typeName.AsSpan(7) switch
665internal static bool TryCreateBuiltInDataContract(Type type, [NotNullWhen(true)] out DataContract? dataContract)
673switch (Type.GetTypeCode(type))
929internal static void ThrowInvalidDataContractException(string? message, Type? type)
942Type type)
950internal Type UnderlyingType => _underlyingType;
952internal Type OriginalUnderlyingType => _originalUnderlyingType ??= GetDataContractOriginalType(_underlyingType);
956internal Type TypeForInitialization => _typeForInitialization;
959private void SetTypeForInitialization(Type classType)
1050MethodInfo? method = UnderlyingType.GetMethod(Globals.ParseMethodName, BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(string) });
1087internal static bool IsTypeSerializable(Type type)
1094private static bool IsTypeSerializable(Type type, HashSet<Type>? previousCollectionTypes)
1110if (CollectionDataContract.IsCollection(type, out Type? itemType))
1112previousCollectionTypes ??= new HashSet<Type>();
1123private static void ValidatePreviousCollectionTypes(Type collectionType, Type itemType, HashSet<Type> previousCollectionTypes)
1134List<Type> itemTypeClosure = new List<Type>();
1135Queue<Type> itemTypeQueue = new Queue<Type>();
1149foreach (Type argType in itemType.GetGenericArguments())
1161internal static Type UnwrapRedundantNullableType(Type type)
1163Type nullableType = type;
1172internal static Type UnwrapNullableType(Type type)
1220public static XmlQualifiedName GetXmlName(Type type)
1227internal static XmlQualifiedName GetXmlName(Type type, out bool hasDataContract)
1229return GetXmlName(type, new HashSet<Type>(), out hasDataContract);
1234internal static XmlQualifiedName GetXmlName(Type type, HashSet<Type> previousCollectionTypes, out bool hasDataContract)
1260private static XmlQualifiedName GetDCTypeXmlName(Type type, DataContractAttribute dataContractAttribute)
1290private static XmlQualifiedName GetNonDCTypeXmlName(Type type, HashSet<Type> previousCollectionTypes)
1294if (CollectionDataContract.IsCollection(type, out Type? itemType))
1315private static bool TryGetBuiltInXmlAndArrayTypeXmlName(Type type, HashSet<Type> previousCollectionTypes, [NotNullWhen(true)] out XmlQualifiedName? xmlName)
1331Type itemType = type.GetElementType()!;
1338internal static bool TryGetDCAttribute(Type type, [NotNullWhen(true)] out DataContractAttribute? dataContractAttribute)
1357internal static XmlQualifiedName GetCollectionXmlName(Type type, Type itemType, out CollectionDataContractAttribute? collectionContractAttribute)
1359return GetCollectionXmlName(type, itemType, new HashSet<Type>(), out collectionContractAttribute);
1364internal static XmlQualifiedName GetCollectionXmlName(Type type, Type itemType, HashSet<Type> previousCollectionTypes, out CollectionDataContractAttribute? collectionContractAttribute)
1410private static string GetArrayPrefix(ref Type itemType)
1451internal static XmlQualifiedName GetDefaultXmlName(Type type)
1458private static string GetDefaultXmlLocalName(Type type)
1487Type[] genParams = type.GetGenericArguments();
1490Type genParam = genParams[i];
1515private static string GetDefaultDataContractNamespace(Type type)
1571internal static string GetDefaultXmlNamespace(Type type)
1644private static void CheckExplicitDataContractNamespaceUri(string dataContractNs, Type type)
1673internal static string GetClrTypeFullName(Type type)
1871private static string ExpandGenericParameters(string format, Type type)
1923internal static bool IsTypeNullable(Type type)
1932internal static DataContractDictionary? ImportKnownTypeAttributes(Type type)
1935Dictionary<Type, Type> typesChecked = new Dictionary<Type, Type>();
1942private static void ImportKnownTypeAttributes(Type? type, Dictionary<Type, Type> typesChecked, ref DataContractDictionary? knownDataContracts)
1984MethodInfo? method = type.GetMethod(methodName, BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, Type.EmptyTypes);
1997foreach (Type ty in (IEnumerable<Type>)types)
2048internal static void CheckAndAdd(Type type, Dictionary<Type, Type> typesChecked, [NotNullIfNotNull(nameof(nameToDataContractTable))] ref DataContractDictionary? nameToDataContractTable)
2113internal static bool IsTypeVisible(Type t)
2128foreach (Type genericType in t.GetGenericArguments())
2137internal static bool IsTypeAndDeclaringTypeVisible(Type t)
2193private static bool IsTypeVisibleInSerializationModule(Type type)
2275internal GenericNameProvider(Type type)
2348Type? paramType = o as Type;
System\Runtime\Serialization\DataContractSerializer.cs (37)
18private Type _rootType;
26private ReadOnlyCollection<Type>? _knownTypeCollection;
27internal IList<Type>? _knownTypeList;
66public DataContractSerializer(Type type)
67: this(type, (IEnumerable<Type>?)null)
71public DataContractSerializer(Type type, IEnumerable<Type>? knownTypes)
76public DataContractSerializer(Type type, string rootName, string rootNamespace)
81public DataContractSerializer(Type type, string rootName, string rootNamespace, IEnumerable<Type>? knownTypes)
86internal DataContractSerializer(Type type, string rootName, string rootNamespace, IEnumerable<Type>? knownTypes,
93public DataContractSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace)
98public DataContractSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNamespace, IEnumerable<Type>? knownTypes)
103internal DataContractSerializer(Type type, IEnumerable<Type>? knownTypes, int maxItemsInObjectGraph, bool ignoreExtensionDataObject, bool preserveObjectReferences)
108public DataContractSerializer(Type type, DataContractSerializerSettings? settings)
116private void Initialize(Type type,
117IEnumerable<Type>? knownTypes,
130_knownTypeList = new List<Type>();
131foreach (Type knownType in knownTypes)
147private void Initialize(Type type, XmlDictionaryString? rootName, XmlDictionaryString? rootNamespace,
148IEnumerable<Type>? knownTypes,
162public ReadOnlyCollection<Type> KnownTypes
168new ReadOnlyCollection<Type>(_knownTypeList) :
169ReadOnlyCollection<Type>.Empty;
373Type declaredType = contract.UnderlyingType;
374Type graphType = (graph == null) ? declaredType : graph.GetType();
424internal static DataContract GetDataContract(DataContract declaredTypeContract, Type declaredType, Type objectType)
513internal override Type? GetSerializeType(object? graph)
518internal override Type? GetDeserializeType()
526internal static object? SurrogateToDataContractType(ISerializationSurrogateProvider serializationSurrogateProvider, object? oldObj, Type surrogatedDeclaredType, ref Type objType)
538internal static Type GetSurrogatedType(ISerializationSurrogateProvider serializationSurrogateProvider, Type type)
System\Runtime\Serialization\DataContractSet.cs (39)
23private readonly List<Type>? _referencedTypes;
24private readonly List<Type>? _referencedCollectionTypes;
26public DataContractSet(ISerializationSurrogateProvider? dataContractSurrogate, IEnumerable<Type>? referencedTypes, IEnumerable<Type>? referencedCollectionTypes)
30_referencedTypes = referencedTypes != null ? new List<Type>(referencedTypes) : null;
31_referencedCollectionTypes = referencedCollectionTypes != null ? new List<Type>(referencedCollectionTypes) : null;
72internal static void EnsureTypeNotGeneric(Type type)
80internal void Add(Type type)
216internal XmlQualifiedName GetXmlName(Type clrType)
220Type dcType = DataContractSurrogateCaller.GetDataContractType(_surrogateProvider, clrType);
228public DataContract GetDataContract(Type type)
237Type dcType = DataContractSurrogateCaller.GetDataContractType(_surrogateProvider, type);
265if (dataMember.MemberInfo is not Type)
267Type dataMemberType = dataMember.MemberType;
272Type dcType = DataContractSurrogateCaller.GetDataContractType(_surrogateProvider, dataMemberType);
324foreach (Type type in _referencedTypes)
345foreach (Type type in _referencedCollectionTypes)
361private void AddReferencedType(Dictionary<XmlQualifiedName, object> referencedTypes, Type type)
383if (value is Type referencedType)
388List<Type> types = new List<Type>();
396List<Type> types = (List<Type>)value;
408private static bool IsTypeReferenceable(Type type)
434public Type? GetReferencedType(XmlQualifiedName xmlName, DataContract dataContract, out DataContract? referencedContract, out object[]? genericParameters, bool? supportGenericTypes = null)
436Type? type = GetReferencedTypeInternal(xmlName, dataContract);
463private Type? GetReferencedGenericTypeInternal(GenericInfo genInfo, out DataContract? referencedContract, out object[]? genericParameters)
468Type? type = GetReferencedTypeInternal(genInfo.XmlName, null);
501Type? paramType = GetReferencedGenericTypeInternal(paramInfo, out paramContract, out object[]? paramParameters);
504genericParameters[i] = new Tuple<Type, object[]?>(paramType, paramParameters);
525private Type? GetReferencedTypeInternal(XmlQualifiedName xmlName, DataContract? dataContract)
527Type? type;
560internal bool TryGetReferencedType(XmlQualifiedName xmlName, DataContract? dataContract, [NotNullWhen(true)] out Type? type)
567internal bool TryGetReferencedCollectionType(XmlQualifiedName xmlName, DataContract? dataContract, [NotNullWhen(true)] out Type? type)
574private bool TryGetReferencedType(XmlQualifiedName xmlName, DataContract? dataContract, bool useReferencedCollectionTypes, [NotNullWhen(true)] out Type? type)
579type = value as Type;
587List<Type> types = (List<Type>)value;
592Type conflictingType = types[i];
System\Runtime\Serialization\DataContractSurrogateCaller.cs (11)
16internal static Type GetDataContractType(ISerializationSurrogateProvider surrogateProvider, Type type)
26internal static object? GetObjectToSerialize(ISerializationSurrogateProvider surrogateProvider, object? obj, Type objType, Type membertype)
38internal static object? GetDeserializedObject(ISerializationSurrogateProvider surrogateProvider, object? obj, Type objType, Type memberType)
47internal static object? GetCustomDataToExport(ISerializationSurrogateProvider2 surrogateProvider, MemberInfo memberInfo, Type dataContractType)
54internal static object? GetCustomDataToExport(ISerializationSurrogateProvider2 surrogateProvider, Type clrType, Type dataContractType)
61internal static void GetKnownCustomDataTypes(ISerializationSurrogateProvider2 surrogateProvider, Collection<Type> customDataTypes)
68internal static Type? GetReferencedTypeOnImport(ISerializationSurrogateProvider2 surrogateProvider, string typeName, string typeNamespace, object? customData)
System\Runtime\Serialization\Json\DataContractJsonSerializer.cs (34)
24internal IList<Type>? knownTypeList;
27private ReadOnlyCollection<Type>? _knownTypeCollection;
36private Type _rootType;
41public DataContractJsonSerializer(Type type)
42: this(type, (IEnumerable<Type>?)null)
48public DataContractJsonSerializer(Type type, string? rootName)
55public DataContractJsonSerializer(Type type, XmlDictionaryString? rootName)
62public DataContractJsonSerializer(Type type, IEnumerable<Type>? knownTypes)
69public DataContractJsonSerializer(Type type, string? rootName, IEnumerable<Type>? knownTypes)
76public DataContractJsonSerializer(Type type, XmlDictionaryString? rootName, IEnumerable<Type>? knownTypes)
83public DataContractJsonSerializer(Type type, DataContractJsonSerializerSettings? settings)
94internal DataContractJsonSerializer(Type type,
96IEnumerable<Type>? knownTypes,
116public ReadOnlyCollection<Type> KnownTypes
122new ReadOnlyCollection<Type>(knownTypeList) :
123ReadOnlyCollection<Type>.Empty;
418internal override Type? GetDeserializeType()
423internal override Type? GetSerializeType(object? graph)
497Type declaredType = contract.UnderlyingType;
498Type graphType = (graph == null) ? declaredType : graph.GetType();
558private void AddCollectionItemTypeToKnownTypes(Type knownType)
560Type? itemType;
561Type typeToCheck = knownType;
576private void Initialize(Type type,
577IEnumerable<Type>? knownTypes,
591this.knownTypeList = new List<Type>();
592foreach (Type knownType in knownTypes)
614private void Initialize(Type type,
616IEnumerable<Type>? knownTypes,
642internal static DataContract GetDataContract(DataContract declaredTypeContract, Type declaredType, Type objectType)
System\Runtime\Serialization\Json\JsonFormatGeneratorStatics.cs (17)
57private static Type[]? s_serInfoCtorArgs;
118typeof(ExtensionDataObject).GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes))!;
193s_getUninitializedObjectMethod = typeof(XmlFormatReaderGenerator).GetMethod("UnsafeGetUninitializedObject", Globals.ScanAllMembers, new Type[] { typeof(Type) });
206s_isStartElementMethod0 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, Type.EmptyTypes);
218s_isStartElementMethod2 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
316s_serializationExceptionCtor = typeof(SerializationException).GetConstructor(new Type[] { typeof(string) });
322public static Type[] SerInfoCtorArgs => s_serInfoCtorArgs ??= new Type[] { typeof(SerializationInfo), typeof(StreamingContext) };
353s_typeHandleProperty = typeof(Type).GetProperty("TypeHandle");
401s_writeAttributeStringMethod = typeof(XmlWriterDelegator).GetMethod("WriteAttributeString", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) });
413s_writeEndElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteEndElement", Globals.ScanAllMembers, Type.EmptyTypes);
463s_writeStartElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
476s_writeStartElementStringMethod = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(string) });
489s_parseEnumMethod = typeof(Enum).GetMethod("Parse", BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(Type), typeof(string) });
502s_getJsonMemberNameMethod = typeof(XmlObjectSerializerReadContextComplexJson).GetMethod("GetJsonMemberName", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator) });
System\Runtime\Serialization\Json\JsonFormatReaderGenerator.cs (27)
55private Type? _objectType;
178private static void BeginMethod(CodeGenerator ilg, string methodName, Type delegateType, bool allowPrivateMemberAccess)
182Type[] paramTypes = new Type[parameters.Length];
202Type type = classContract.ObjectType;
367Type memberType = dataMember.MemberType;
467private LocalBuilder ReadValue(Type type, string name)
558private void InternalDeserialize(LocalBuilder value, Type type, string name)
562Type declaredType = type;
585Type innerType = innerValue.LocalType, outerType = outerValue.LocalType;
590Type type = Globals.TypeOfNullable.MakeGenericType(innerType);
591_ilg.New(type.GetConstructor(new Type[] { innerType })!);
594_ilg.Call(outerType.GetConstructor(new Type[] { innerType })!);
601Type type = collectionContract.UnderlyingType;
602Type itemType = collectionContract.ItemType;
611constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Type.EmptyTypes)!;
615constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, Type.EmptyTypes)!;
726private void ReadSimpleDictionary(CollectionDataContract collectionContract, Type keyValueType)
728Type[] keyValueTypes = keyValueType.GetGenericArguments();
729Type keyType = keyValueTypes[0];
730Type valueType = keyValueTypes[1];
733Type keyTypeOriginal = keyType;
822Type type = collectionContract.UnderlyingType;
823Type itemType = collectionContract.ItemType;
910private bool TryReadPrimitiveArray(Type itemType)
917switch (Type.GetTypeCode(itemType))
962private LocalBuilder ReadCollectionItem(CollectionDataContract collectionContract, Type itemType)
System\Runtime\Serialization\Json\JsonFormatWriterGenerator.cs (29)
113private static void BeginMethod(CodeGenerator ilg, string methodName, Type delegateType, bool allowPrivateMemberAccess)
117Type[] paramTypes = new Type[parameters.Length];
126private void InitArgs(Type objType)
243Type memberType = member.MemberType;
316Type itemType = collectionContract.ItemType;
363Type? enumeratorType;
364Type[]? keyValueTypes = null;
374keyValueTypes = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject };
381MethodInfo? moveNextMethod = enumeratorType.GetMethod(Globals.MoveNextMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
382MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
392Type ienumeratorInterface = Globals.TypeOfIEnumerator;
396Type[] interfaceTypes = enumeratorType.GetInterfaces();
397foreach (Type interfaceType in interfaceTypes)
413Type elementType = getCurrentMethod.ReturnType;
420ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfIDictionaryEnumerator })!;
427Type ctorParam = Globals.TypeOfIEnumeratorGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(keyValueTypes));
428ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { ctorParam })!;
438Type genericDictionaryKeyValueType = Globals.TypeOfKeyValue.MakeGenericType(keyValueTypes);
508private bool TryWritePrimitive(Type type, LocalBuilder? value, MemberInfo? memberInfo, LocalBuilder? arrayItemIndex, LocalBuilder? name, int nameIndex)
556private bool TryWritePrimitiveArray(Type type, Type itemType, LocalBuilder value, LocalBuilder itemName)
563switch (Type.GetTypeCode(itemType))
596new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!;
625Type memberType = memberValue.LocalType;
698private void InternalSerialize(MethodInfo methodInfo, LocalBuilder memberValue, Type memberType, bool writeXsiType)
710_ilg.Call(typeof(RuntimeTypeHandle).GetMethod("Equals", new Type[] { typeof(RuntimeTypeHandle) })!);
721Type memberType = memberValue.LocalType;
727Type innerType = memberType.GetGenericArguments()[0];
System\Runtime\Serialization\Json\XmlObjectSerializerWriteContextComplexJson.cs (13)
39internal IList<Type>? SerializerKnownTypeList
173protected override void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type? objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
206private void HandleCollectionAssignedToObject(Type declaredType, ref DataContract dataContract, ref object obj, ref bool verifyKnownType)
242internal override void SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
245Type declaredType = rootTypeDataContract!.UnderlyingType;
264private void VerifyType(DataContract dataContract, Type declaredType)
294Type dataType = dataNode.DataType;
320internal static void VerifyObjectCompatibilityWithInterface(DataContract contract, object graph, Type declaredType)
322Type contractType = contract.GetType();
339Type objType = obj.GetType();
369internal override DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type? type)
378internal override DataContract GetDataContractSkipValidation(int typeId, RuntimeTypeHandle typeHandle, Type? type)
System\Runtime\Serialization\PrimitiveDataContract.cs (9)
25Type type, XmlDictionaryString name, XmlDictionaryString ns) : base(new PrimitiveDataContractCriticalHelper(type, name, ns))
32internal static PrimitiveDataContract? GetPrimitiveDataContract(Type type)
70_helper.XmlFormatWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!;
72_helper.XmlFormatWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!;
86_helper.XmlFormatContentWriterMethod = typeof(XmlWriterDelegator).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { UnderlyingType })!;
88_helper.XmlFormatContentWriterMethod = typeof(XmlObjectSerializerWriteContext).GetMethod(WriteMethodName, Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), UnderlyingType })!;
128Type thisType = GetType();
129Type otherType = other.GetType();
143Type type,
System\Runtime\Serialization\ReflectionClassWriter.cs (5)
46public static void ReflectionWriteValue(XmlWriterDelegator xmlWriter, XmlObjectSerializerWriteContext context, Type type, object? value, bool writeXsiType, PrimitiveDataContract? primitiveContractForParamType)
48Type memberType = type;
75MethodInfo getValue = memberType.GetMethod("get_Value", Type.EmptyTypes)!;
154Type type = obj.GetType();
168private static void ReflectionInternalSerialize(XmlWriterDelegator xmlWriter, XmlObjectSerializerWriteContext context, object obj, bool isDeclaredType, bool writeXsiType, Type memberType, bool isNullableOfT = false)
System\Runtime\Serialization\ReflectionReader.cs (25)
20private delegate object? CollectionReadItemDelegate(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, CollectionDataContract collectionContract, Type itemType, string itemName, string itemNs);
27private static readonly Type[] s_arrayConstructorParameters = new Type[] { Globals.TypeOfInt };
140object? GetReadDictionaryItemDelegate(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, CollectionDataContract collectionContract, Type itemType, string itemName, string itemNs)
152Type itemType = collectionContract.ItemType;
249protected object? ReflectionReadValue(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, Type type, string name, string ns, PrimitiveDataContract? primitiveContractForOriginalType = null)
277private object? ReadItemOfPrimitiveType(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, Type type, string name, string ns, PrimitiveDataContract? primitiveContract, int nullables)
345private CollectionReadItemDelegate GetReflectionReadValueDelegate(Type type)
365object? GetReadItemOfPrimitiveTypeDelegate(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, CollectionDataContract collectionContract, Type itemType, string itemName, string itemNs)
385Type type = dataMember.MemberType;
393private object? ReflectionInternalDeserialize(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, CollectionDataContract? collectionContract, Type type, string name, string ns)
432Type classType = classContract.UnderlyingType;
441Type objType = obj.GetType();
482Type arrayType = collectionContract.ItemType.MakeArrayType();
489Type type = Globals.TypeOfDictionaryGeneric.MakeGenericType(collectionContract.ItemType.GetGenericArguments());
490ConstructorInfo ci = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes)!;
553Type keyType = collectionContract.ItemType.GenericTypeArguments[0];
554Type valueType = collectionContract.ItemType.GenericTypeArguments[1];
584Type collectionType = resultCollectionObject.GetType();
585Type genericCollectionType = typeof(ICollection<T>);
586Type typeIList = Globals.TypeOfIList;
621static MethodInfo MakeGenericMethod(MethodInfo method, Type keyType, Type valueType) => method.MakeGenericMethod(keyType, valueType);
626private static bool ReflectionTryReadPrimitiveArray(XmlReaderDelegator xmlReader, XmlObjectSerializerReadContext context, XmlDictionaryString collectionItemName, XmlDictionaryString collectionItemNamespace, Type itemType, int arraySize, [NotNullWhen(true)] out object? resultArray)
634switch (Type.GetTypeCode(itemType))
System\Runtime\Serialization\SchemaExporter.cs (11)
250private XmlElement ExportGenericInfo(Type clrType, string elementName, string elementNs)
252Type? itemType;
265Type[]? genericArguments = null;
347Collection<Type> knownTypes = new Collection<Type>();
511Type clrType = dataContract.UnderlyingType;
593internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName xmlName, out XmlSchemaType? xsdType, out bool hasRoot)
606private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName xmlName, out XmlSchemaType? xsdType, out bool hasRoot)
632MethodInfo? getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
695Type clrType,
747internal static bool IsSpecialXmlType(Type type, [NotNullWhen(true)] out XmlQualifiedName? typeName, [NotNullWhen(true)] out XmlSchemaType? xsdType, out bool hasRoot)
System\Runtime\Serialization\XmlFormatGeneratorStatics.cs (24)
22s_writeStartElementMethod2 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
36s_writeStartElementMethod3 = typeof(XmlWriterDelegator).GetMethod("WriteStartElement", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
50s_writeEndElementMethod = typeof(XmlWriterDelegator).GetMethod("WriteEndElement", Globals.ScanAllMembers, Type.EmptyTypes);
64s_writeNamespaceDeclMethod = typeof(XmlWriterDelegator).GetMethod("WriteNamespaceDecl", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString) });
84s_dictionaryEnumeratorCtor = typeof(CollectionDataContract.DictionaryEnumerator).GetConstructor(Globals.ScanAllMembers, new Type[] { Globals.TypeOfIDictionaryEnumerator });
141s_isStartElementMethod2 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, new Type[] { typeof(XmlDictionaryString), typeof(XmlDictionaryString) });
155s_isStartElementMethod0 = typeof(XmlReaderDelegator).GetMethod("IsStartElement", Globals.ScanAllMembers, Type.EmptyTypes);
170s_getUninitializedObjectMethod = typeof(XmlFormatReaderGenerator).GetMethod("UnsafeGetUninitializedObject", Globals.ScanAllMembers, new Type[] { typeof(int) })!;
209internal static ConstructorInfo SerializationExceptionCtor => s_serializationExceptionCtor ??= typeof(SerializationException).GetConstructor(new Type[] { typeof(string) })!;
212internal static ConstructorInfo ExtensionDataObjectCtor => s_extensionDataObjectCtor ??= typeof(ExtensionDataObject).GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes)!;
223s_hashtableCtor = Globals.TypeOfHashtable.GetConstructor(Globals.ScanAllMembers, Type.EmptyTypes);
265s_storeCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("StoreCollectionMemberInfo", Globals.ScanAllMembers, new Type[] { typeof(object) });
279s_resetCollectionMemberInfoMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ResetCollectionMemberInfo", Globals.ScanAllMembers, Type.EmptyTypes);
364s_internalDeserializeMethod = typeof(XmlObjectSerializerReadContext).GetMethod("InternalDeserialize", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(int), typeof(RuntimeTypeHandle), typeof(string), typeof(string) });
451s_readIfNullOrRefMethod = typeof(XmlObjectSerializerReadContext).GetMethod("ReadIfNullOrRef", Globals.ScanAllMembers, new Type[] { typeof(XmlReaderDelegator), typeof(Type), typeof(bool) });
663s_createUnexpectedStateExceptionMethod = typeof(XmlObjectSerializerReadContext).GetMethod("CreateUnexpectedStateException", Globals.ScanAllMembers, new Type[] { typeof(XmlNodeType), typeof(XmlReaderDelegator) });
708s_writeNullMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("WriteNull", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(Type), typeof(bool) });
736s_incrementCollectionCountMethod = typeof(XmlObjectSerializerWriteContext).GetMethod("IncrementCollectionCount", Globals.ScanAllMembers, new Type[] { typeof(XmlWriterDelegator), typeof(ICollection) });
774internal static object? GetDefaultValue(Type type)
1025s_getTypeHandleMethod = typeof(Type).GetMethod("get_TypeHandle");
1053s_throwInvalidDataContractExceptionMethod = typeof(DataContract).GetMethod("ThrowInvalidDataContractException", Globals.ScanAllMembers, new Type[] { typeof(string), typeof(Type) });
System\Runtime\Serialization\XmlFormatReaderGenerator.cs (20)
64private Type? _objectType;
256Type type = _objectType = classContract.UnderlyingType;
426Type memberType = dataMember.MemberType;
504private LocalBuilder ReadValue(Type type, string name, string ns)
595private void InternalDeserialize(LocalBuilder value, Type type, string name, string ns)
599Type declaredType = type.IsPointer ? Globals.TypeOfReflectionPointer : type;
618Type innerType = innerValue.LocalType, outerType = outerValue.LocalType;
623Type type = Globals.TypeOfNullable.MakeGenericType(innerType);
624_ilg.New(type.GetConstructor(new Type[] { innerType })!);
627_ilg.Call(outerType.GetConstructor(new Type[] { innerType })!);
635Type type = collectionContract.UnderlyingType;
636Type itemType = collectionContract.ItemType;
647constructor = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes)!;
777Type type = collectionContract.UnderlyingType;
778Type itemType = collectionContract.ItemType;
839private bool TryReadPrimitiveArray(Type itemType, LocalBuilder size)
848switch (Type.GetTypeCode(itemType))
890private LocalBuilder ReadCollectionItem(CollectionDataContract collectionContract, Type itemType, string itemName, string itemNs)
997Type type)
1010var type = DataContract.GetDataContractForInitialization(id).TypeForInitialization;
System\Runtime\Serialization\XmlFormatWriterGenerator.cs (27)
154private void InitArgs(Type objType)
313Type memberType = member.MemberType;
396Type itemType = collectionContract.ItemType;
442Type? enumeratorType;
443Type[]? keyValueTypes = null;
453keyValueTypes = new Type[] { Globals.TypeOfObject, Globals.TypeOfObject };
460MethodInfo? moveNextMethod = enumeratorType.GetMethod(Globals.MoveNextMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
461MethodInfo? getCurrentMethod = enumeratorType.GetMethod(Globals.GetCurrentMethodName, BindingFlags.Instance | BindingFlags.Public, Type.EmptyTypes);
471Type ienumeratorInterface = Globals.TypeOfIEnumerator;
475Type[] interfaceTypes = enumeratorType.GetInterfaces();
476foreach (Type interfaceType in interfaceTypes)
492Type elementType = getCurrentMethod.ReturnType;
504Type ctorParam = Globals.TypeOfIEnumeratorGeneric.MakeGenericType(Globals.TypeOfKeyValuePair.MakeGenericType(keyValueTypes!));
505ConstructorInfo dictEnumCtor = enumeratorType.GetConstructor(Globals.ScanAllMembers, new Type[] { ctorParam })!;
541private bool TryWritePrimitive(Type type, LocalBuilder? value, MemberInfo? memberInfo, LocalBuilder? arrayItemIndex, LocalBuilder ns, LocalBuilder? name, int nameIndex)
589private bool TryWritePrimitiveArray(Type type, Type itemType, LocalBuilder value, LocalBuilder itemName, LocalBuilder itemNamespace)
596switch (Type.GetTypeCode(itemType))
628_ilg.Call(typeof(XmlWriterDelegator).GetMethod(writeArrayMethod, Globals.ScanAllMembers, new Type[] { type, typeof(XmlDictionaryString), typeof(XmlDictionaryString) })!);
638Type memberType = memberValue.LocalType;
711private void InternalSerialize(MethodInfo methodInfo, LocalBuilder memberValue, Type memberType, bool writeXsiType)
718_ilg.Call(null, typeof(Type).GetMethod("GetTypeHandle")!, memberValue);
722_ilg.Call(typeof(RuntimeTypeHandle).GetMethod("Equals", new Type[] { typeof(RuntimeTypeHandle) })!);
734Type memberType = memberValue.LocalType;
740Type innerType = memberType.GetGenericArguments()[0];
760private static bool NeedsPrefix(Type type, XmlDictionaryString ns)
765private void WriteStartElement(Type type, XmlDictionaryString ns, LocalBuilder namespaceLocal, LocalBuilder? nameLocal, int nameIndex)
System\Runtime\Serialization\XmlObjectSerializerContext.cs (18)
24protected IList<Type>? serializerKnownTypeList;
100internal DataContract GetDataContract(Type type)
107internal virtual DataContract GetDataContract(RuntimeTypeHandle typeHandle, Type? type)
121internal virtual DataContract GetDataContractSkipValidation(int typeId, RuntimeTypeHandle typeHandle, Type? type)
149internal virtual void CheckIfTypeSerializable(Type memberType, bool isMemberTypeSerializable)
157internal virtual Type GetSurrogatedType(Type type)
190internal static DataContractDictionary? GetDataContractsForKnownTypes(IList<Type> knownTypeList)
194Dictionary<Type, Type> typesChecked = new Dictionary<Type, Type>();
197Type knownType = knownTypeList[i];
208internal bool IsKnownType(DataContract dataContract, DataContractDictionary? knownDataContracts, Type? declaredType)
228internal bool IsKnownType(DataContract dataContract, Type? declaredType)
236internal Type? ResolveNameFromKnownTypes(XmlQualifiedName typeName)
251protected DataContract? ResolveDataContractFromKnownTypes(string typeName, string? typeNs, DataContract? memberTypeContract, Type? declaredType)
261Type? dataContractType = _dataContractResolver.ResolveName(typeName, typeNs, declaredType, KnownTypeResolver);
System\Runtime\Serialization\XmlObjectSerializerReadContext.cs (13)
58internal static void ThrowNullValueReturnedForGetOnlyCollectionException(Type type)
64internal static void ThrowArrayExceededSizeException(int arraySize, Type type)
92return InternalDeserialize(xmlReader, name, ns, Type.GetTypeFromHandle(declaredTypeHandle)!, ref dataContract);
97internal virtual object? InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, string? name, string? ns)
105internal virtual object? InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract? dataContract, string? name, string? ns)
113protected bool TryHandleNullOrRef(XmlReaderDelegator reader, string? name, string? ns, Type declaredType, ref object? retObj)
140protected object? InternalDeserialize(XmlReaderDelegator reader, string? name, string? ns, Type declaredType, ref DataContract dataContract)
294internal string ReadIfNullOrRef(XmlReaderDelegator xmlReader, Type memberType, bool isMemberTypeSerializable)
380internal object? GetExistingObject(string id, Type? type, string? name, string? ns)
424private object? DeserializeFromExtensionData(IDataNode dataNode, Type type, string? name, string? ns)
543public SerializationInfo ReadSerializationInfo(XmlReaderDelegator xmlReader, Type type)
749Type valueType = xmlReader.ValueType;
777private IDataNode ReadUnknownPrimitiveData(XmlReaderDelegator xmlReader, Type type, string? dataContractName, string? dataContractNamespace)
System\Runtime\Serialization\XmlObjectSerializerReadContextComplex.cs (8)
36return InternalDeserializeWithSurrogate(xmlReader, Type.GetTypeFromHandle(declaredTypeHandle)!, null /*surrogateDataContract*/, name, ns);
41internal override object? InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, string? name, string? ns)
51internal override object? InternalDeserialize(XmlReaderDelegator xmlReader, Type declaredType, DataContract? dataContract, string? name, string? ns)
61private object? InternalDeserializeWithSurrogate(XmlReaderDelegator xmlReader, Type declaredType, DataContract? surrogateDataContract, string? name, string? ns)
82internal override void CheckIfTypeSerializable(Type memberType, bool isMemberTypeSerializable)
99internal override Type GetSurrogatedType(Type type)
108Type surrogateType = DataContractSerializer.GetSurrogatedType(_serializationSurrogateProvider, type);
System\Runtime\Serialization\XmlObjectSerializerWriteContext.cs (22)
99Type declaredType = Globals.TypeOfObject;
119SerializeWithXsiType(xmlWriter, obj, objTypeHandle, null /*type*/, declaredTypeID, declaredTypeHandle, Type.GetTypeFromHandle(declaredTypeHandle)!);
144internal virtual void SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
149Type declaredType = rootTypeDataContract.OriginalUnderlyingType;
167protected virtual void SerializeWithXsiType(XmlWriterDelegator xmlWriter, object obj, RuntimeTypeHandle objectTypeHandle, Type? objectType, int declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
179objectType ??= Type.GetTypeFromHandle(objectTypeHandle)!;
232protected void SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, object obj, bool verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
271internal virtual bool WriteClrTypeInfo(XmlWriterDelegator xmlWriter, Type dataContractType, string? clrTypeName, string? clrAssemblyName)
276internal virtual bool WriteClrTypeInfo(XmlWriterDelegator xmlWriter, Type dataContractType, SerializationInfo serInfo)
401internal void WriteNull(XmlWriterDelegator xmlWriter, Type memberType, bool isMemberTypeSerializable)
409internal void WriteNull(XmlWriterDelegator xmlWriter, Type memberType, bool isMemberTypeSerializable, XmlDictionaryString name, XmlDictionaryString? ns)
441internal static bool IsMemberTypeSameAsMemberValue(object obj, Type memberType)
460internal static void ThrowRequiredMemberMustBeEmitted(string memberName, Type type)
517Type objType = obj.GetType();
535internal void WriteSerializationInfo(XmlWriterDelegator xmlWriter, Type objType, SerializationInfo serInfo)
589private void WriteResolvedTypeInfo(XmlWriterDelegator writer, Type objectType, Type declaredType)
600private bool ResolveType(Type objectType, Type declaredType, [NotNullWhen(true)] out XmlDictionaryString? typeName, [NotNullWhen(true)] out XmlDictionaryString? typeNamespace)
712Type dataType = dataNode.DataType;
748Type declaredType = (dataNode.DataContractName == null) ? o.GetType() : Globals.TypeOfObject;
System.Private.Uri (1)
System.Private.Windows.Core (62)
System\Private\Windows\Core\BinaryFormat\Deserializer\ClassRecordFieldInfoDeserializer.cs (1)
28Type type,
System\Private\Windows\Core\BinaryFormat\Deserializer\ClassRecordSerializationInfoDeserializer.cs (1)
30Type type,
System.Private.Windows.Core.TestUtilities (40)
System.Private.Xml (1223)
System\Xml\Schema\XmlValueConverter.cs (160)
213public abstract object ChangeType(bool value, Type destinationType);
214public abstract object ChangeType(int value, Type destinationType);
215public abstract object ChangeType(long value, Type destinationType);
216public abstract object ChangeType(decimal value, Type destinationType);
217public abstract object ChangeType(double value, Type destinationType);
218public abstract object ChangeType(DateTime value, Type destinationType);
219public abstract object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver);
220public abstract object ChangeType(object value, Type destinationType);
221public abstract object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver);
228private readonly Type? _clrTypeDefault;
229private readonly Type? _clrListTypeDefault;
287protected XmlBaseConverter(XmlBaseConverter converterAtomic, Type clrTypeDefault, Type clrListTypeDefault)
295protected static readonly Type ICollectionType = typeof(ICollection);
296protected static readonly Type IEnumerableType = typeof(IEnumerable);
297protected static readonly Type IListType = typeof(IList);
298protected static readonly Type ObjectArrayType = typeof(object[]);
299protected static readonly Type StringArrayType = typeof(string[]);
300protected static readonly Type StringArrayArrayType = typeof(string[][]);
301protected static readonly Type XmlAtomicValueArrayType = typeof(XmlAtomicValue[]);
302protected static readonly Type XPathItemArrayType = typeof(XPathItem[]);
303protected static readonly Type XPathNavigatorArrayType = typeof(XPathNavigator[]);
306protected static readonly Type DecimalType = typeof(decimal);
307protected static readonly Type Int32Type = typeof(int);
308protected static readonly Type Int64Type = typeof(long);
309protected static readonly Type StringType = typeof(string);
310protected static readonly Type XmlAtomicValueType = typeof(XmlAtomicValue);
311protected static readonly Type ObjectType = typeof(object);
312protected static readonly Type ByteType = typeof(byte);
313protected static readonly Type Int16Type = typeof(short);
314protected static readonly Type SByteType = typeof(sbyte);
315protected static readonly Type UInt16Type = typeof(ushort);
316protected static readonly Type UInt32Type = typeof(uint);
317protected static readonly Type UInt64Type = typeof(ulong);
318protected static readonly Type XPathItemType = typeof(XPathItem);
319protected static readonly Type DoubleType = typeof(double);
320protected static readonly Type SingleType = typeof(float);
321protected static readonly Type DateTimeType = typeof(DateTime);
322protected static readonly Type DateTimeOffsetType = typeof(DateTimeOffset);
323protected static readonly Type BooleanType = typeof(bool);
324protected static readonly Type ByteArrayType = typeof(byte[]);
325protected static readonly Type XmlQualifiedNameType = typeof(XmlQualifiedName);
326protected static readonly Type UriType = typeof(Uri);
327protected static readonly Type TimeSpanType = typeof(TimeSpan);
328protected static readonly Type XPathNavigatorType = typeof(XPathNavigator);
384public override object ChangeType(bool value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
385public override object ChangeType(DateTime value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
386public override object ChangeType(decimal value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
387public override object ChangeType(double value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
388public override object ChangeType(int value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
389public override object ChangeType(long value, Type destinationType) { return (object)ChangeType((object)value, destinationType, null); }
390public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver) { return (object)ChangeType((object)value, destinationType, nsResolver); }
391public override object ChangeType(object value, Type destinationType) { return this.ChangeType(value, destinationType, null); }
443protected Type? DefaultClrType
451protected Type? DefaultClrListType
459protected static bool IsDerivedFrom(Type? derivedType, Type baseType)
475protected Exception CreateInvalidClrMappingException(Type sourceType, Type destinationType)
512protected virtual object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
906Type sourceType = value.GetType();
931Type sourceType = value.GetType();
956Type sourceType = value.GetType();
996Type sourceType = value.GetType();
1012public override object ChangeType(decimal value, Type destinationType)
1027public override object ChangeType(int value, Type destinationType)
1042public override object ChangeType(long value, Type destinationType)
1057public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1073public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1078Type sourceType = value.GetType();
1122private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1124Type sourceType = value.GetType();
1135private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1172Type sourceType = value.GetType();
1216Type sourceType = value.GetType();
1245Type sourceType = value.GetType();
1260public override object ChangeType(double value, Type destinationType)
1274public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1289public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1294Type sourceType = value.GetType();
1358Type sourceType = value.GetType();
1398Type sourceType = value.GetType();
1477Type sourceType = value.GetType();
1492public override object ChangeType(DateTime value, Type destinationType)
1506public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1521public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1526Type sourceType = value.GetType();
1574Type sourceType = value.GetType();
1638Type sourceType = value.GetType();
1652public override object ChangeType(bool value, Type destinationType)
1665public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1679public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1684Type sourceType = value.GetType();
1723Type sourceType = value.GetType();
1761public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1799public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1804Type sourceType = value.GetType();
1918private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1920Type sourceType = value.GetType();
1927private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1952Type sourceType = value.GetType();
1965public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1978public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
1983Type sourceType = value.GetType();
2036Type sourceType = value.GetType();
2058Type sourceType = value.GetType();
2080Type sourceType = value.GetType();
2101Type sourceType = value.GetType();
2123Type sourceType = value.GetType();
2145Type sourceType = value.GetType();
2167Type sourceType = value.GetType();
2189Type sourceType = value.GetType();
2237Type sourceType = value.GetType();
2268public override object ChangeType(bool value, Type destinationType)
2278public override object ChangeType(DateTime value, Type destinationType)
2288public override object ChangeType(decimal value, Type destinationType)
2298public override object ChangeType(double value, Type destinationType)
2308public override object ChangeType(int value, Type destinationType)
2318public override object ChangeType(long value, Type destinationType)
2328public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2359public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2364Type sourceType = value.GetType();
2462private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2464Type sourceType = value.GetType();
2470private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2484protected override object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2486Type sourceType = value.GetType();
2504private static bool SupportsType(Type clrType)
2548Type sourceType = value.GetType();
2564Type sourceType = value.GetType();
2579Type sourceType = value.GetType();
2595Type sourceType = value.GetType();
2611Type sourceType = value.GetType();
2627Type sourceType = value.GetType();
2643Type sourceType = value.GetType();
2659Type sourceType = value.GetType();
2678public override object ChangeType(bool value, Type destinationType)
2688public override object ChangeType(DateTime value, Type destinationType)
2698public override object ChangeType(decimal value, Type destinationType)
2708public override object ChangeType(double value, Type destinationType)
2718public override object ChangeType(int value, Type destinationType)
2728public override object ChangeType(long value, Type destinationType)
2738public override object ChangeType(string value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2749public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2754Type sourceType = value.GetType();
2832private object ChangeTypeWildcardDestination(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2834Type sourceType = value.GetType();
2840private object ChangeTypeWildcardSource(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2874public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2899protected XmlListConverter(XmlBaseConverter atomicConverter, Type clrTypeDefault, Type clrListTypeDefault) : base(atomicConverter, clrTypeDefault, clrListTypeDefault)
2930public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2943protected override object ChangeListType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
2945Type sourceType = value.GetType();
2972Type? itemTypeDst = destinationType.GetElementType();
3022private static bool IsListType(Type type)
3125private new InvalidCastException CreateInvalidClrMappingException(Type sourceType, Type destinationType)
3172public override object ChangeType(object value, Type destinationType, IXmlNamespaceResolver? nsResolver)
3177Type sourceType = value.GetType();
System\Xml\Serialization\CodeGenerator.cs (83)
40private Dictionary<(Type, string), Queue<LocalBuilder>>? _freeLocals;
50internal static bool IsNullableGenericType(Type type)
58internal static void AssertHasInterface(Type type, Type iType)
61foreach (Type iFace in type.GetInterfaces())
69internal void BeginMethod(Type returnType, string methodName, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
76internal void BeginMethod(Type returnType, MethodBuilderInfo methodBuilderInfo, Type[] argTypes, string[] argNames, MethodAttributes methodAttributes)
86private void InitILGeneration(Type[] argTypes, string[] argNames, bool isStatic)
93_freeLocals = new Dictionary<(Type, string), Queue<LocalBuilder>>();
149private readonly Dictionary<Type, LocalBuilder> _tmpLocals = new Dictionary<Type, LocalBuilder>();
150internal LocalBuilder GetTempLocal(Type type)
161internal static Type GetVariableType(object var)
217private bool TryDequeueLocal(Type type, string name, [NotNullWhen(true)] out LocalBuilder? local)
224(Type, string) key = (type, name);
241internal LocalBuilder DeclareLocal(Type type, string name)
253internal LocalBuilder DeclareOrGetLocal(Type type, string name)
291Type varType = GetVariableType(forState.End);
304Type.EmptyTypes
384internal void BeginCatchBlock(Type exception)
421internal void InitObj(Type valueType)
426internal void NewArray(Type elementType, object len)
433internal void StackallocSpan(Type elementType, int len)
439_ilGen!.Emit(OpCodes.Newobj, typeof(Span<>).MakeGenericType(elementType).GetConstructor(new Type[] { typeof(void*), typeof(int) })!);
444Type objType = GetVariableType(obj).GetElementType()!;
458Type arrayType = GetVariableType(obj);
462Call(typeof(Array).GetMethod("SetValue", new Type[] { typeof(object), typeof(int) })!);
466Type objType = arrayType.GetElementType()!;
480private static bool IsStruct(Type objType)
486internal Type LoadMember(object obj, MemberInfo memberInfo)
500Type? currentType = propertyInfo.DeclaringType!.BaseType;
535internal Type LoadMember(MemberInfo memberInfo)
537Type? memberType;
568internal Type LoadMemberAddress(MemberInfo memberInfo)
570Type? memberType;
655internal void ConvertAddress(Type source, Type target)
660internal void ConvertValue(Type source, Type target)
665internal void Castclass(Type target)
670internal void Box(Type type)
675internal void Unbox(Type type)
708internal void Ldobj(Type type)
710OpCode opCode = GetLdindOpCode(Type.GetTypeCode(type));
731internal void Stobj(Type type)
763internal void Ldtoken(Type t)
770Type valueType = o.GetType();
771if (o is Type)
773Ldtoken((Type)o);
774Call(typeof(Type).GetMethod("GetTypeFromHandle", BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(RuntimeTypeHandle) })!);
782switch (Type.GetTypeCode(valueType))
820new Type[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) }
833new Type[] { typeof(long) }
847new Type[] { typeof(long) },
859new Type[] { typeof(long), typeof(TimeSpan) },
935internal void Stloc(Type type, string name)
951internal void Ldloc(Type type, string name)
1030internal void Ldelem(Type arrayElementType)
1038OpCode opCode = GetLdelemOpCode(Type.GetTypeCode(arrayElementType));
1045internal void Ldelema(Type arrayElementType)
1078internal void Stelem(Type arrayElementType)
1084OpCode opCode = GetStelemOpCode(Type.GetTypeCode(arrayElementType));
1190private void InternalConvert(Type source, Type target, bool isAddress)
1198OpCode opCode = GetConvOpCode(Type.GetTypeCode(target));
1268[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type parent,
1269Type[] interfaces)
1336internal void IsInst(Type type)
1430internal Type ArgType;
1431internal ArgBuilder(string name, int index, Type argType)
1580public void AddToFreeLocals(Dictionary<(Type, string), Queue<LocalBuilder>> freeLocals)
1584(Type, string) key = (item.Value.LocalType, item.Key);
1605public readonly Type[] ParameterTypes;
1606public MethodBuilderInfo(MethodBuilder methodBuilder, Type[] parameterTypes)
1613public void Validate(Type? returnType, Type[] parameterTypes, MethodAttributes attributes)
1627private readonly Type _sourceType;
1628private readonly Type _targetType;
1632public CodeGeneratorConversionException(Type sourceType, Type targetType, bool isAddress, string reason)
System\Xml\Serialization\Compilation.cs (21)
51internal TempAssembly(XmlMapping[] xmlMappings, Type?[] types, string? defaultNamespace, string? location)
138internal static Assembly? LoadGeneratedAssembly(Type type, string? defaultNamespace, out XmlSerializerImplementation? contract)
214Type contractType = GetTypeFromAssembly(serializer, "XmlSerializerContract");
227private static Assembly? LoadAssemblyByPath(Type type, string assemblyName)
265private static bool IsSerializerVersionMatch(Assembly serializer, Type type, string? defaultNamespace)
279private static string GenerateAssemblyId(Type type)
301internal static bool GenerateSerializerToStream(XmlMapping[] xmlMappings, Type?[] types, string? defaultNamespace, Assembly? assembly, Hashtable assemblies, Stream stream)
315foreach (Type t in scope.Types)
343Type? type = types[i];
438internal static Assembly GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type?[] types)
440var mainType = (types.Length > 0) ? types[0] : null;
463new Type[] { typeof(string) }
495Type writerType = writerCodeGen.GenerateEnd();
528[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type, string methodName)
540internal static Type GetTypeFromAssembly(Assembly assembly, string typeName)
543Type? type = assembly.GetType(typeName);
589internal static void VerifyLoadContext(Type? t, Assembly? assembly)
668private readonly Type _type;
670internal TempAssemblyCacheKey(string? ns, Type type)
695internal TempAssembly? this[string? ns, Type t]
712internal void Add(string? ns, Type t, TempAssembly assembly)
System\Xml\Serialization\Models.cs (22)
21private readonly Dictionary<Type, TypeModel> _models = new Dictionary<Type, TypeModel>();
22private readonly Dictionary<Type, TypeModel> _arrayModels = new Dictionary<Type, TypeModel>();
35internal TypeModel GetTypeModel(Type type)
41internal TypeModel GetTypeModel(Type type, bool directReference)
77internal ArrayModel GetArrayModel(Type type)
98private readonly Type _type;
102[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
112internal Type Type
131[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
143[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
149[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
156[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
203private static void CheckSupportedMember(TypeDesc? typeDesc, MemberInfo member, Type type)
275private readonly Type _fieldType;
279internal FieldModel(string name, Type fieldType, TypeDesc fieldTypeDesc, bool checkSpecified, bool checkShouldPersist) :
283internal FieldModel(string name, Type fieldType, TypeDesc fieldTypeDesc, bool checkSpecified, bool checkShouldPersist, bool readOnly)
294internal FieldModel(MemberInfo memberInfo, Type fieldType, TypeDesc fieldTypeDesc)
300_checkShouldPersistMethodInfo = memberInfo.DeclaringType!.GetMethod($"ShouldSerialize{memberInfo.Name}", Type.EmptyTypes);
345internal Type FieldType
422Type type, TypeDesc typeDesc, ModelScope scope) : base(type, typeDesc, scope) { }
System\Xml\Serialization\Types.cs (43)
90private Type? _type;
123internal TypeDesc(Type type, bool isXsdType, XmlSchemaType dataType, string formatterName, TypeFlags flags)
129internal TypeDesc(Type? type, string name, string fullName, TypeKind kind, TypeDesc? baseTypeDesc, TypeFlags flags, TypeDesc? arrayElementTypeDesc)
174internal Type? Type
357[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
546internal static bool IsKnownType(Type type)
553switch (Type.GetTypeCode(type))
628private static void AddPrimitive(Type type, string dataTypeName, string formatterName, TypeFlags flags)
639private static void AddNonXsdPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, XmlSchemaFacet[] facets, TypeFlags flags)
657private static void AddSoapEncodedPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, TypeFlags flags)
686internal TypeDesc GetTypeDesc(Type type)
692internal TypeDesc GetTypeDesc(Type type, MemberInfo? source, bool directReference)
698internal TypeDesc GetTypeDesc(Type type, MemberInfo? source, bool directReference, bool throwOnError)
717internal TypeDesc GetArrayTypeDesc(Type type)
741internal Type? GetTypeFromTypeDesc(TypeDesc typeDesc)
748return de.Key as Type;
754private TypeDesc ImportTypeDesc(Type type, MemberInfo? memberInfo, bool directReference)
758Type? arrayElementType = null;
759Type? baseType = null;
943for (Type? t = type.DeclaringType; t != null && !t.ContainsGenericParameters && !(t.IsAbstract && t.IsSealed); t = t.DeclaringType)
949private static bool IsArraySegment(Type t)
954internal static bool IsOptionalValue(Type type)
972internal static string TypeName(Type t)
990Type[] arguments = t.GetGenericArguments();
1008internal static Type? GetArrayElementType(Type type, string? memberInfo)
1162[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type derivedType,
1166Type currentType = derivedType;
1167Type typeToBeReplaced = memberInfoToBeReplaced.DeclaringType!;
1222| DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type)
1224ConstructorInfo? ctor = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, Type.EmptyTypes);
1248private static Type? GetEnumeratorElementType(Type type, ref TypeFlags flags)
1252MethodInfo? enumerator = type.GetMethod("GetEnumerator", Type.EmptyTypes);
1276enumerator = type.GetMethod("System.Collections.IEnumerable.GetEnumerator", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, Type.EmptyTypes);
1287Type currentType = (p == null ? typeof(object) : p.PropertyType);
1289MethodInfo? addMethod = type.GetMethod("Add", new Type[] { currentType });
1294addMethod = type.GetMethod("Add", new Type[] { currentType });
1309[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string? memberInfo)
1327for (Type? t = type; t != null; t = t.BaseType)
1351MethodInfo? addMethod = type.GetMethod("Add", new Type[] { indexer.PropertyType });
1358private static Type GetCollectionElementType(
1359[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type,
System\Xml\Serialization\XmlReflectionImporter.cs (43)
100Type type = ((XmlIncludeAttribute)attrs[i]).Type!;
110public void IncludeType(Type type)
117private void IncludeType(Type type, RecursionLimiter limiter)
142public XmlTypeMapping ImportTypeMapping(Type type)
152public XmlTypeMapping ImportTypeMapping(Type type, string? defaultNamespace)
162public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root)
172public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root, string? defaultNamespace)
248private XmlAttributes GetAttributes(Type type, bool canBeSimpleType)
487[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type)
498MethodInfo? getMethod = getMethod = type.GetMethod(provider.MethodName, /* BindingFlags.DeclaredOnly | */ BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
510private SpecialMapping ImportSpecialMapping(Type type, TypeDesc typeDesc, string? ns, ImportContext context)
623private static InvalidOperationException InvalidAttributeUseException(Type type)
647[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
712private TypeMapping? GetTypeMapping(string? typeName, string? ns, TypeDesc typeDesc, NameTable typeLib, Type? type)
957internal string XsdTypeName(Type type)
967internal string XsdTypeName(Type type, XmlAttributes a, string name)
975Type genType = type.GetGenericTypeDefinition();
976Type[] names = genType.GetGenericArguments();
977Type[] types = type.GetGenericArguments();
1004private void SetArrayMappingType(ArrayMapping mapping, string? defaultNs, Type type)
1387Type? choiceIdentifierType = null;
1418Type? choiceIdentifierType = null;
1427private static Type CheckChoiceIdentifierType(Type type, bool isArrayLike, string identifierName, string memberName)
1452private static Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, XmlReflectionMember[] xmlReflectionMembers, bool isArrayLike, string accessorName)
1466private static Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, StructModel structModel, bool isArrayLike, string accessorName)
1496Type enumType = member.FieldType;
1503private void CreateArrayElementsFromAttributes(ArrayMapping arrayMapping, XmlArrayItemAttributes attributes, Type arrayElementType, string? arrayElementNs, RecursionLimiter limiter)
1512Type targetType = xmlArrayItem.Type ?? arrayElementType;
1529private void ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, string? ns, Type? choiceIdentifierType, bool rpc, bool openModel, RecursionLimiter limiter)
1539Type accessorType = model.FieldType;
1571Type arrayElementType = TypeScope.GetArrayElementType(accessorType, $"{model.FieldTypeDesc.FullName}.{model.Name}")!;
1598Type targetType = a.XmlAttribute!.Type == null ? arrayElementType : a.XmlAttribute.Type!;
1628Type targetType = a.XmlText.Type ?? arrayElementType;
1643Type targetType = xmlElement.Type ?? arrayElementType;
1684Type targetType = typeof(IXmlSerializable).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlNode).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlElement);
1885Type targetType = xmlElement.Type ?? accessorType;
1925Type targetType = typeof(IXmlSerializable).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlNode).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlElement);
2076private void CheckAmbiguousChoice(XmlAttributes a, Type accessorType, string accessorName)
2085Type type = elements[i]!.Type == null ? accessorType : elements[i]!.Type!;
2110Type type = items[i]!.Type == null ? accessorType : items[i]!.Type!;
2144private static object? GetDefaultValue(TypeDesc fieldTypeDesc, Type t, XmlAttributes a)
2259internal static XmlTypeMapping GetTopLevelMapping(Type type, string? defaultNamespace)
System\Xml\Serialization\XmlSchemaImporter.cs (18)
31public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType)
52public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType, bool baseTypeCanBeIndirect)
86public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType)
93public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType, bool baseTypeCanBeIndirect)
194public XmlMembersMapping ImportMembersMapping(XmlQualifiedName[] names, Type? baseType, bool baseTypeCanBeIndirect)
249private ElementAccessor ImportElement(XmlQualifiedName name, Type desiredMappingType, Type? baseType)
266private ElementAccessor ImportElement(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns, bool topLevelElement)
326private TypeMapping ImportElementType(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns)
415private TypeMapping? ImportType(XmlQualifiedName name, Type desiredMappingType, Type? baseType, TypeFlags flags, bool addref)
444private TypeMapping? ImportType(XmlSchemaComplexType type, string? typeNs, string identifier, Type desiredMappingType, Type? baseType)
495private StructMapping ImportStructType(XmlSchemaType type, string? typeNs, string identifier, Type? baseType, bool arrayLike)
606private StructMapping ImportStructDataType(XmlSchemaSimpleType dataType, string? typeNs, string identifier, Type baseType)
1663private TypeMapping? ImportDataType(XmlSchemaSimpleType dataType, string? typeNs, string identifier, Type? baseType, TypeFlags flags, bool isList)
System\Xml\Serialization\XmlSerializationILGen.cs (45)
23internal Dictionary<string, Type> CreatedTypes = new Dictionary<string, Type>();
73private static readonly Type[] s_typeType = new Type[] { typeof(Type) };
74private static readonly Type[] s_xmlReaderType = new Type[] { typeof(XmlReader) };
75private static readonly Type[] s_objectXmlSerializationWriterType = new Type[] { typeof(object), typeof(XmlSerializationWriter) };
76private static readonly Type[] s_xmlSerializationReaderType = new Type[] { typeof(XmlSerializationReader) };
79MethodAttributes attributes, Type? returnType, Type[] parameterTypes)
163Type.EmptyTypes,
176Type.EmptyTypes
214new Type[] { typeof(object), typeof(object) }
230internal void GenerateSupportedTypes(Type[] types, TypeBuilder serializerContractTypeBuilder)
239var uniqueTypes = new HashSet<Type>();
242Type type = types[i];
277Type.EmptyTypes);
281Type.EmptyTypes
286Type.EmptyTypes,
294Type.EmptyTypes
298Type.EmptyTypes,
306Type baseSerializerType = baseSerializerTypeBuilder.CreateType();
322Type.EmptyTypes
345new Type[] { typeof(string), typeof(string) }
370new Type[] { (mapping is XmlMembersMapping) ? typeof(object[]) : typeof(object) }
394Type.EmptyTypes
402Type typedSerializerType = typedSerializerTypeBuilder.CreateType();
415new Type[] { typeof(object), typeof(object) }
422Type.EmptyTypes
448Type? type = xmlMappings[i].Accessor.Mapping!.TypeDesc!.Type;
462Type.EmptyTypes
479internal void GenerateSerializerContract(XmlMapping[] xmlMappings, Type[] types, string readerType, string[] readMethods, string writerType, string[] writerMethods, Dictionary<string, string> serializers)
486Type.EmptyTypes
498Type.EmptyTypes,
504Type.EmptyTypes
518Type.EmptyTypes,
524Type.EmptyTypes
538Type.EmptyTypes
544Type.EmptyTypes,
561Type serializerContractType = serializerContractTypeBuilder.CreateType();
577internal void ILGenLoad(string source, Type? type)
586Type memType = (memInfo is FieldInfo) ? ((FieldInfo)memInfo).FieldType : ((PropertyInfo)memInfo).PropertyType;
System\Xml\Serialization\XmlSerializationReader.cs (16)
270private Type? GetPrimitiveType(XmlQualifiedName typeName, bool throwOnUnknown)
1313protected Exception CreateUnknownConstantException(string? value, Type enumType)
1318protected Exception CreateInvalidCastException(Type type, object? value)
1323protected Exception CreateInvalidCastException(Type type, object? value, string? id)
1345protected Array EnsureArrayIndex(Array? a, int index, Type elementType)
1355protected Array? ShrinkArray(Array? a, int length, Type elementType, bool isNullable)
1557Type? fallbackElementType = null;
1562Type? arrayType = (Type?)_types[new XmlQualifiedName(typeName, typeNs)];
1587Type? elementType = null;
1592elementType = (Type?)_types[qname];
1715Type? itemType = null;
1721Type currItemType = currItem.GetType();
1857protected void AddReadCallback(string name, string ns, Type type, XmlSerializationReadCallback read)
5029Writer.Write(typeof(Type).FullName);
5091private void WriteCatchException(Type exceptionType)
System\Xml\Serialization\XmlSerializationReaderILGen.cs (171)
32private static readonly Type[] s_boolType = new Type[] { typeof(bool) };
192Type.EmptyTypes);
229ilg.BeginMethod(typeof(void), "InitIDs", Type.EmptyTypes, Array.Empty<string>(),
234Type.EmptyTypes
239Type.EmptyTypes
244new Type[] { typeof(string) }
261Type readerType = this.typeBuilder.CreateType();
286Type.EmptyTypes
291new Type[] { typeof(string), typeof(string) }
309List<Type> argTypes = new List<Type>();
344ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(),
393Type.EmptyTypes,
402Type.EmptyTypes
407Type.EmptyTypes
522Type.EmptyTypes
537Type.EmptyTypes
547Type.EmptyTypes
562Type.EmptyTypes
591Type.EmptyTypes
636Type.EmptyTypes,
651Type.EmptyTypes
656Type.EmptyTypes
692new Type[] { typeof(string) }
700Type.EmptyTypes
705Type.EmptyTypes
716Type.EmptyTypes
721Type.EmptyTypes
750Type.EmptyTypes
755Type.EmptyTypes
766Type.EmptyTypes
771Type.EmptyTypes
804new Type[] { typeof(string) },
815Type.EmptyTypes
820Type.EmptyTypes
832new Type[] { typeof(string) }
840Type argType = source == "false" ? typeof(bool) : typeof(string);
857new Type[] { argType }
865new Type[] { argType }
873Type.EmptyTypes
878Type.EmptyTypes
889Type.EmptyTypes
894Type.EmptyTypes
965Type.EmptyTypes,
976Type.EmptyTypes
986new Type[] { typeof(object), typeof(object) }
1024List<Type> argTypes = new List<Type>();
1026Type returnType;
1027Type underlyingType;
1048new Type[] { typeof(string), typeof(Hashtable), typeof(string) }
1091new Type[] { typeof(string), typeof(string) }
1112new Type[] { typeof(string), typeof(Type) }
1145List<Type> argTypes = new List<Type>();
1184Type.EmptyTypes
1189Type.EmptyTypes
1204new Type[] { typeof(string) }
1209new Type[] { typeof(string) }
1214Type.EmptyTypes
1228Type.EmptyTypes
1293Type.EmptyTypes)!;
1330List<Type> argTypes = new List<Type>();
1351Type.EmptyTypes
1356Type.EmptyTypes
1395new Type[] { locXsiType.LocalType }
1438new Type[] { typeof(string), typeof(string) }
1443new Type[] { typeof(XmlQualifiedName) }
1461new Type[] { locXsiType.LocalType }
1474new Type[] { typeof(XmlQualifiedName) }
1501new Type[] { typeof(string), typeof(string) }
1615Type.EmptyTypes
1620Type.EmptyTypes
1630Type.EmptyTypes
1639Type.EmptyTypes
1653Type.EmptyTypes
1669Type.EmptyTypes
1682Type.EmptyTypes
1703Type.EmptyTypes
1708Type.EmptyTypes
1746Type.EmptyTypes
1751Type.EmptyTypes
1756Type.EmptyTypes
1811Type.EmptyTypes
1816Type.EmptyTypes
1870new Type[] { typeof(string) }
1875Type.EmptyTypes
1880Type.EmptyTypes
1885Type.EmptyTypes
1901Type.EmptyTypes
1912new Type[] { typeof(string), typeof(string) }
1917Type.EmptyTypes
1945new Type[] { typeof(string) }
1950Type.EmptyTypes
1966Type.EmptyTypes
1971new Type[] { typeof(XmlReader) }
1983new Type[] { localAttr.LocalType }
1992List<Type> argTypes = new List<Type>();
2074new Type[] { typeof(char[]) }
2079Type.EmptyTypes
2084Type.EmptyTypes
2172new Type[] { typeof(string) }
2238Type.EmptyTypes
2243Type.EmptyTypes
2270Type.EmptyTypes
2275Type.EmptyTypes
2326Type.EmptyTypes
2331Type.EmptyTypes
2336Type.EmptyTypes
2341new Type[] { typeof(string) }
2370Type.EmptyTypes
2375Type.EmptyTypes
2385new Type[] { typeof(string) }
2398new Type[] { typeof(string), typeof(bool) }
2510Type.EmptyTypes
2639new Type[] { typeof(Array), typeof(int), typeof(Type), typeof(bool) }
2693Type varType = CodeGenerator.GetVariableType(variable);
2717Type arrayElementType = localA.LocalType.GetElementType()!;
2721new Type[] { typeof(Array), typeof(int), typeof(Type) }
2765private void WriteSourceEnd(string source, Type elementType)
2769private void WriteSourceEnd(string source, Type elementType, Type stackType)
2774Type varType = CodeGenerator.GetVariableType(variable);
2802Type arrayElementType = CodeGenerator.GetVariableType(oVar).GetElementType()!;
2823new Type[] { elementType }
2826Type addParameterType = Add.GetParameters()[0].ParameterType;
2837Type varType = CodeGenerator.GetVariableType(ilg.GetVariable(match.Groups["a"].Value));
2839Type varElementType = varType.GetElementType()!;
2852Type.EmptyTypes
2888Type.EmptyTypes
2893Type.EmptyTypes
2909Type.EmptyTypes
2919Type.EmptyTypes
2931Type.EmptyTypes
2942Type.EmptyTypes
3002Type.EmptyTypes
3025Type.EmptyTypes
3030Type.EmptyTypes
3039Type.EmptyTypes
3056Type.EmptyTypes
3061Type.EmptyTypes
3071Type.EmptyTypes
3095Type.EmptyTypes
3136Type.EmptyTypes
3141Type.EmptyTypes
3152List<Type> argTypes = new List<Type>();
3201Type.EmptyTypes
3226isWrappedAny ? new Type[] { typeof(IXmlSerializable), typeof(bool) } : new Type[] { typeof(IXmlSerializable) }
3297isWrappedAny ? new Type[] { typeof(IXmlSerializable), typeof(bool) } : new Type[] { typeof(IXmlSerializable) }
3316new Type[] { typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }
3334new Type[] { typeof(string), typeof(string), typeof(string) }
3354Type.EmptyTypes
3359Type.EmptyTypes
3379Type.EmptyTypes
3384Type.EmptyTypes
3450new Type[] { typeof(string) }
3461new Type[] { typeof(string) }
3472private void WriteCatchException(Type exceptionType)
3483private void WriteCreateInstance(string source, bool ctorInaccessible, Type type)
3513new Type[] { typeof(object) }
3518new Type[] { typeof(object), typeof(string) }
3601Type.EmptyTypes
System\Xml\Serialization\XmlSerializationWriter.cs (50)
188private XmlQualifiedName GetPrimitiveTypeName(Type type)
194private XmlQualifiedName? GetPrimitiveTypeName(Type type, bool throwIfUnknown)
202internal static XmlQualifiedName? GetPrimitiveTypeNameInternal(Type type)
207switch (Type.GetTypeCode(type))
264Type t = o.GetType();
269switch (Type.GetTypeCode(t))
818protected Exception CreateUnknownTypeException(Type type)
858protected Exception CreateInvalidAnyTypeException(Type type)
1175protected void AddWriteCallback(Type type, string typeName, string? typeNs, XmlSerializationWriteCallback callback)
1186private void WriteArray(string name, string? ns, object o, Type type)
1188Type elementType = TypeScope.GetArrayElementType(type, null)!;
1225Type? elementBaseType = elementType.BaseType;
1317protected void WritePotentiallyReferencingElement(string? n, string? ns, object? o, Type? ambientType)
1323protected void WritePotentiallyReferencingElement(string n, string? ns, object? o, Type? ambientType, bool suppressReference)
1329protected void WritePotentiallyReferencingElement(string? n, string? ns, object? o, Type? ambientType, bool suppressReference, bool isNullable)
1336Type t = o.GetType();
1337if (Type.GetTypeCode(t) == TypeCode.Object && !(o is Guid) && (t != typeof(XmlQualifiedName)) && !(o is XmlNode[]) && (t != typeof(byte[])))
1378private void WriteReferencedElement(object o, Type? ambientType)
1384private void WriteReferencedElement(string? name, string? ns, object o, Type? ambientType)
1387Type t = o.GetType();
1405private TypeEntry? GetTypeEntry(Type t)
1478internal Type? type;
1494internal static bool IsTypeDynamic(Type type)
1508Type[] parameterTypes = type.GetGenericArguments();
1513Type parameterType = parameterTypes[i];
1529internal static bool IsTypeDynamic(Type[] arguments)
1531foreach (Type t in arguments)
1610foreach (Type type in scope.Types)
1619private string WriteTypeInfo(TypeScope scope, TypeDesc typeDesc, Type type)
1634_writer.WriteLine($"static {typeof(Type).FullName} {typeVariable} = {elementTypeVariable}.MakeArrayType();");
1639_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType(");
1648Type? parameterType = Nullable.GetUnderlyingType(type);
1652_writer.WriteLine($"static {typeof(Type).FullName} {typeVariable} = typeof(System.Nullable<>).MakeGenericType(new {typeof(Type).FullName}[] {{{parameterTypeVariable}}});");
1657_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType(");
1686"object", "string", typeof(Type).FullName,
1694[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type)
1731[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type)
1754private string WriteAssemblyInfo(Type type)
1773[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string escapedName, string typeVariable, string memberName)
1822_writer.Write($"new {typeof(Type).FullName}[] {{ ");
1835[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string escapedName, bool collectionUseReflection, bool elementUseReflection)
1849_writer.Write(typeof(Type[]).FullName);
3114Writer.Write(typeof(Type).FullName);
4176private void WriteElementCall(string func, Type cast, string source, string name, string? ns, bool isNullable, bool isAny)
4216Type? type = Type.GetType(mapping.TypeDesc!.Type!.FullName!);
4224Type? type = Type.GetType(mapping.TypeDesc!.Type!.FullName!);
4266Type type = value.GetType();
System\Xml\Serialization\XmlSerializationWriterILGen.cs (125)
33Type.EmptyTypes);
63internal Type GenerateEnd()
89ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(),
101List<Type> argTypes = new List<Type>();
121private void WriteEnumValue(EnumMapping mapping, SourceInfo source, out Type returnType)
136new Type[] { mapping.TypeDesc!.Type! });
143private void WritePrimitiveValue(TypeDesc typeDesc, SourceInfo source, out Type returnType)
154Type argType = typeDesc.Type!;
164new Type[] { argType }
182new Type[] { typeDesc.Type! }
230List<Type> argTypes = new List<Type>();
239Type argType;
257new Type[] { typeof(string), typeof(string) }
282new Type[] { typeof(string), typeof(string) }
295new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool) }
315Type.EmptyTypes
346private static readonly Type[] s_objectArrayType = new Type[] { typeof(object[]) };
347private static readonly Type[] s_objectType = new Type[] { typeof(object) };
368Type.EmptyTypes
376Type.EmptyTypes
559Type.EmptyTypes
579Type.EmptyTypes
600List<Type> argTypes = new List<Type>();
683new Type[] { typeof(long), typeof(string[]), typeof(long[]), typeof(string) }
703Type.EmptyTypes
708new Type[] { typeof(IFormatProvider) }
713new Type[] { typeof(object), typeof(string) }
751List<Type> argTypes = new List<Type>();
758Type oType = CodeGenerator.GetVariableType(oVar);
804Type.EmptyTypes
809new Type[] { typeof(string), typeof(string) }
819new Type[] { typeof(string), typeof(string) }
829new Type[] { mapping.TypeDesc.Type! }
834new Type[] { typeof(string) }
847Type.EmptyTypes
870Type.EmptyTypes
875new Type[] { typeof(string), typeof(string) }
885new Type[] { typeof(string), typeof(string) }
897Type.EmptyTypes
915List<Type> argTypes = new List<Type>(5);
944new Type[] { typeof(string), typeof(string) }
958LocalBuilder tLoc = ilg.DeclareLocal(typeof(Type), "t");
962Type.EmptyTypes
981new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool) }
1014new Type[] { typeof(bool) }
1049new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool), typeof(XmlSerializerNamespaces) }
1059new Type[] { typeof(string), typeof(string) }
1177Type.EmptyTypes
1182new Type[] { typeof(string), typeof(string), typeof(string) }
1196Type.EmptyTypes
1217Type methodType;
1218Type argType;
1228Type.EmptyTypes
1233new Type[] { typeof(string) }
1249new Type[] { typeof(string) }
1270new Type[] { argType }
1292Type.EmptyTypes
1297Type.EmptyTypes
1308Type.EmptyTypes
1315List<Type> argTypes = new List<Type>();
1328Type.EmptyTypes
1366new Type[] { typeof(XmlNode), typeof(object) }
1387Type? targetType,
1456new Type[] { typeof(string), typeof(string) }
1487Type typeIEnumerable = typeof(IEnumerable);
1492Type.EmptyTypes)!;
1498Type typeIEnumerable = typeof(IEnumerable<>).MakeGenericType(arrayElementTypeDesc.Type!);
1503Type.EmptyTypes)!;
1511Type.EmptyTypes)!;
1530Type.EmptyTypes)!;
1714Type.EmptyTypes
1719Type.EmptyTypes
1727new Type[] { typeof(string), typeof(string) }
1750new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) }
1777new Type[] { typeof(string), typeof(string) }
1784Type.EmptyTypes
1789Type.EmptyTypes
1853Type argType;
1866new Type[] { argType }
1878new Type[] { typeof(XmlWriter) }
1883Type.EmptyTypes
1907Type.EmptyTypes
1996List<Type> argTypes = new List<Type>();
2064private void WriteElementCall(string func, Type cast, SourceInfo source, string? name, string? ns, bool isNullable, bool isAny)
2069new Type[] { cast, typeof(string), typeof(string), typeof(bool), typeof(bool) }
2098Type.EmptyTypes
2134Type valueType = value.GetType();
2140new Type[] { valueType, valueType }
2170new Type[] { typeof(string), typeof(string), typeof(string) }
2197new Type[] { typeof(XmlSerializerNamespaces) }
2215private void WriteLocalDecl(string variableName, string initValue, Type type)
2224private void WriteTypeCompare(string variable, Type type)
2229private void WriteInstanceOf(SourceInfo source, Type type)
2233private void WriteArrayTypeCompare(string variable, Type arrayType)
2310foreach (Type type in scope.Types)
2340internal static void ILGenForEnumMember(CodeGenerator ilg, Type type, string memberName)
2354internal static void ILGenForCreateInstance(CodeGenerator ilg, Type type, bool ctorInaccessible, bool cast)
2360Type.EmptyTypes
2378internal static void ILGenForCreateInstance(CodeGenerator ilg, Type type, Type? cast)
2392Type? xName = type.Assembly.GetType("System.Xml.Linq.XName");
2398new Type[] { typeof(string) }
2402new Type[] { xName }
2423new[] { typeof(Type) }
2457MethodInfo constructorInvoke = typeof(ConstructorInfo).GetMethod("Invoke", new Type[] { typeof(object[]) })!;
2468Type.EmptyTypes)!;
2477new Type[] { typeof(Type) }
2489Type localType = initValue.Type!;
2529internal static void WriteCreateInstance(string source, bool ctorInaccessible, Type type, CodeGenerator ilg)
2537internal static void WriteInstanceOf(SourceInfo source, Type type, CodeGenerator ilg)
2550Type localType = (typeName == arrayTypeDesc.CSharpName) ? arrayTypeDesc.Type! : arrayTypeDesc.Type!.MakeArrayType();
2556internal static void WriteTypeCompare(string variable, Type type, CodeGenerator ilg)
2560ilg.Ldloc(typeof(Type), variable);
2564internal static void WriteArrayTypeCompare(string variable, Type arrayType, CodeGenerator ilg)
2568ilg.Ldloc(typeof(Type), variable);
System\Xml\Serialization\XmlSerializer.cs (35)
95public virtual bool CanSerialize(Type type) { throw new NotSupportedException(); }
97public virtual XmlSerializer GetSerializer(Type type) { throw new NotSupportedException(); }
134private readonly Type? _primitiveType;
138private Type? _rootType;
172public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace) :
179public XmlSerializer(Type type, XmlRootAttribute? root) : this(type, null, Type.EmptyTypes, root, null, null)
185public XmlSerializer(Type type, Type[]? extraTypes) : this(type, null, extraTypes, null, null, null)
191public XmlSerializer(Type type, XmlAttributeOverrides? overrides) : this(type, overrides, Type.EmptyTypes, null, null, null)
210public XmlSerializer(Type type) : this(type, (string?)null)
216public XmlSerializer(Type type, string? defaultNamespace)
276public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace, string? location)
291private static XmlTypeMapping GenerateXmlTypeMapping(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace)
312internal static TempAssembly? GenerateTempAssembly(XmlMapping xmlMapping, Type? type, string? defaultNamespace)
319internal static TempAssembly? GenerateTempAssembly(XmlMapping xmlMapping, Type? type, string? defaultNamespace, string? location)
329return new TempAssembly(new XmlMapping[] { xmlMapping }, new Type?[] { type }, defaultNamespace, location);
573return FromMappings(mappings, (Type?)null);
578public static XmlSerializer?[] FromMappings(XmlMapping[]? mappings, Type? type)
616tempAssembly = new TempAssembly(mappings, new Type?[] { type }, null, null);
649private static XmlSerializer[] GetReflectionBasedSerializers(XmlMapping[] mappings, Type? type)
666internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, Stream stream)
682Type type = types[i];
706private static XmlSerializer[] GetSerializersFromCache(XmlMapping[] mappings, Type type)
735TempAssembly tempAssembly = new TempAssembly(pendingMappings, new Type[] { type }, null, null);
754public static XmlSerializer?[] FromTypes(Type[]? types)
768public static string GetXmlSerializerAssemblyName(Type type)
773public static string GetXmlSerializerAssemblyName(Type type, string? defaultNamespace)
843private static XmlTypeMapping? GetKnownMapping(Type type, string? ns)
861switch (Type.GetTypeCode(_primitiveType))
943switch (Type.GetTypeCode(_primitiveType))
System\Xml\Serialization\XmlSerializerFactory.cs (12)
23public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace)
30public XmlSerializer CreateSerializer(Type type, XmlRootAttribute? root)
32return CreateSerializer(type, null, Type.EmptyTypes, root, null, null);
37public XmlSerializer CreateSerializer(Type type, Type[]? extraTypes)
44public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides? overrides)
46return CreateSerializer(type, overrides, Type.EmptyTypes, null, null, null);
58public XmlSerializer CreateSerializer(Type type)
65public XmlSerializer CreateSerializer(Type type, string? defaultNamespace)
72public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace, string? location)
System\Xml\Xsl\IlGen\GenerateHelper.cs (25)
43public readonly Type SeqType;
51public readonly Type IListType;
61public XmlILStorageMethods(Type storageType)
64Type? aggType = null;
98Type sequenceType;
124Type listType = typeof(IList<>).MakeGenericType(storageType);
160public static readonly ConstructorInfo NonUserCode = typeof(DebuggerNonUserCodeAttribute).GetConstructor(Type.EmptyTypes)!;
162public static readonly ConstructorInfo StepThrough = typeof(DebuggerStepThroughAttribute).GetConstructor(Type.EmptyTypes)!;
163public static readonly ConstructorInfo Transparent = typeof(SecurityTransparentAttribute).GetConstructor(Type.EmptyTypes)!;
270public static readonly MethodInfo ChangeTypeXsltArg = typeof(XmlQueryRuntime).GetMethod("ChangeTypeXsltArgument", new[] { typeof(int), typeof(object), typeof(Type) })!;
321public static readonly MethodInfo ValueAsAny = typeof(XPathItem).GetMethod("ValueAs", new[] { typeof(Type), typeof(IXmlNamespaceResolver) })!;
438public static readonly MethodInfo GetTypeFromHandle = typeof(Type).GetMethod("GetTypeFromHandle")!;
440public static readonly Dictionary<Type, XmlILStorageMethods> StorageMethods = new Dictionary<Type, XmlILStorageMethods>(13)
646public void LoadType(Type clrTyp)
661public LocalBuilder DeclareLocal(string name, Type type)
887public void TreatAs(Type clrTypeSrc, Type clrTypeDst)
1061public void CallGetEarlyBoundObject(int idxObj, Type clrType)
1103public void CallGetGlobalValue(int idxValue, Type clrType)
1111public void CallSetGlobalValue(Type clrType)
1358public void CallCacheCount(Type itemStorageType)
1364public void CallCacheItem(Type itemStorageType)
1374public void CallValueAs(Type clrType)
1684public void Emit(OpCode opcode, Type typVal)
System\Xml\Xsl\IlGen\IteratorDescriptor.cs (9)
53private Type _itemStorageType;
72public static StorageDescriptor Stack(Type itemStorageType, bool isCached)
84public static StorageDescriptor Parameter(int paramIndex, Type itemStorageType, bool isCached)
98public static StorageDescriptor Local(LocalBuilder loc, Type itemStorageType, bool isCached)
115public static StorageDescriptor Current(LocalBuilder locIter, MethodInfo currentMethod, Type itemStorageType)
131public static StorageDescriptor Global(MethodInfo methGlobal, Type itemStorageType, bool isCached)
170public StorageDescriptor ToStorageType(Type itemStorageType)
229public Type ItemStorageType
675public void EnsureItemStorageType(XmlQueryType xmlType, Type storageTypeDest)
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (23)
908Type itemStorageType = GetItemStorageType(ndCond);
977private void ConditionalBranch(QilNode ndBranch, Type itemStorageType, LocalBuilder? locResult)
1164Type itemStorageType = GetItemStorageType(ndSeq);
1274private QilBinary CreateSetIterator(QilBinary ndSet, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent)
1385Type typAgg = methAgg.DeclaringType!;
2262Type itemStorageType = GetItemStorageType(ndSort);
3611Type? clrTypeRetSrc;
3612Type clrTypeRetDst;
3641Type clrTypeActualArg, clrTypeFormalArg;
3658Type itemType = GetItemStorageType(ndActualArg);
3922private void CreateSimpleIterator(QilNode ndCtxt, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent)
3945private void CreateFilteredIterator(QilNode ndCtxt, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent,
3981private void CreateContainerIterator(QilUnary ndDod, string iterName, Type iterType, MethodInfo methCreate, MethodInfo methNext, MethodInfo methCurrent,
4018private void GenerateSimpleIterator(Type itemStorageType, LocalBuilder locIter, MethodInfo methNext, MethodInfo methCurrent)
4050MethodInfo methNext, MethodInfo methCurrent, Type itemStorageType)
4732private void NestedVisit(QilNode nd, Type itemStorageType, bool isCached)
4803private void NestedVisitEnsureStack(QilNode nd, Type itemStorageType, bool isCached)
4837private void NestedVisitEnsureCache(QilNode nd, Type itemStorageType)
4843Type cacheType;
4961private static Type GetStorageType(QilNode nd)
4969private static Type GetStorageType(XmlQueryType typ)
4977private static Type GetItemStorageType(QilNode nd)
4985private static Type GetItemStorageType(XmlQueryType typ)
System\Xml\Xsl\XmlIlGenerator.cs (12)
132MethodInfo methExec = _module.DefineMethod("Execute", typeof(void), Type.EmptyTypes, Array.Empty<string>(), XmlILMethodAttributes.NonUser);
138MethodInfo methRoot = _module.DefineMethod("Root", typeof(void), Type.EmptyTypes, Array.Empty<string>(), methAttrs);
196Type[] paramTypes;
198Type typReturn;
203paramTypes = new Type[ndFunc.Arguments.Count];
253Type typReturn;
261methInfo = _module!.DefineMethod(ndRef.DebugName!.ToString(), typReturn, Type.EmptyTypes, Array.Empty<string>(), methAttrs);
300new Type[] { typeof(XPathNavigator), typeof(XPathNavigator) },
356Type[]? ebTypes;
363fldTypes = _module.DefineField(XmlQueryStaticData.TypesFieldName, typeof(Type[]));
379LocalBuilder locTypes = _helper.DeclareLocal("$$$types", typeof(Type[]));
381_helper.Emit(OpCodes.Newarr, typeof(Type));
System.Private.Xml.Linq (6)
System.Reflection.Context (280)
System\Reflection\Context\Custom\AttributeUtils.cs (14)
11public static object[] GetCustomAttributes(CustomReflectionContext context, CustomType type, Type attributeFilterType, bool inherit)
51public static object[] GetCustomAttributes(CustomReflectionContext context, CustomMethodInfo method, Type attributeFilterType, bool inherit)
91public static object[] GetCustomAttributes(CustomReflectionContext context, CustomConstructorInfo constructor, Type attributeFilterType)
99public static object[] GetCustomAttributes(CustomReflectionContext context, CustomPropertyInfo property, Type attributeFilterType)
107public static object[] GetCustomAttributes(CustomReflectionContext context, CustomEventInfo evnt, Type attributeFilterType)
115public static object[] GetCustomAttributes(CustomReflectionContext context, CustomFieldInfo field, Type attributeFilterType)
123public static object[] GetCustomAttributes(CustomReflectionContext context, CustomParameterInfo parameter, Type attributeFilterType)
131public static bool IsDefined(ICustomAttributeProvider provider, Type attributeType, bool inherit)
137private static IEnumerable<object> GetFilteredAttributes(CustomReflectionContext context, MemberInfo member, Type attributeFilterType)
144private static IEnumerable<object> GetFilteredAttributes(CustomReflectionContext context, ParameterInfo parameter, Type attributeFilterType)
151private static void CombineCustomAttributes(List<object> declaredAttributes, IEnumerable<object> inheritedAttributes, Type attributeFilterType, bool inherited, bool allowMultiple)
158Type attributeType = newAttribute.GetType();
177private static void GetAttributeUsage(Type attributeFilterType, out bool inherited, out bool allowMultiple)
197internal static IEnumerable<object> FilterCustomAttributes(IEnumerable<object> attributes, Type attributeFilterType)
System\Reflection\Context\Custom\CustomType.cs (10)
16public CustomType(Type template, CustomReflectionContext context)
31public override object[] GetCustomAttributes(Type attributeType, bool inherit)
36public override bool IsDefined(Type attributeType, bool inherit)
43Type objectType = ReflectionContext.GetTypeForObject(o!);
85protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
137binder ??= Type.DefaultBinder;
184protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
272Type? declaringType = match.DeclaringType;
279binder ??= Type.DefaultBinder;
System\Reflection\Context\Delegation\DelegatingModule.cs (15)
64public override Type[] FindTypes(TypeFilter? filter, object? filterCriteria)
74public override object[] GetCustomAttributes(Type attributeType, bool inherit)
94protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
119public override Type? GetType(string className, bool throwOnError, bool ignoreCase)
124public override Type[] GetTypes()
129public override bool IsDefined(Type attributeType, bool inherit)
139public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
144public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
149public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
164public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
System\Reflection\Context\Delegation\DelegatingType.cs (32)
16public DelegatingType(Type type)
37public override Type? BaseType
57public override Type? DeclaringType
140public override Type? ReflectedType
155public override Type UnderlyingSystemType
160public Type UnderlyingType
195public override Type GetEnumUnderlyingType()
200public override object[] GetCustomAttributes(Type attributeType, bool inherit)
220public override Type[] GetGenericArguments()
225public override Type[] GetGenericParameterConstraints()
230public override Type GetGenericTypeDefinition()
235public override InterfaceMapping GetInterfaceMap(Type interfaceType)
247return Type.GetTypeCode(_typeInfo);
250public override bool IsAssignableFrom([NotNullWhen(true)] Type? c)
260public override bool IsDefined(Type attributeType, bool inherit)
270public override bool IsEquivalentTo([NotNullWhen(true)] Type? other)
288public override bool IsSubclassOf(Type c)
303protected override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
313public override Type? GetElementType()
338public override Type? GetInterface(string name, bool ignoreCase)
343public override Type[] GetInterfaces()
353protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
366public override Type? GetNestedType(string name, BindingFlags bindingAttr)
371public override Type[] GetNestedTypes(BindingFlags bindingAttr)
381protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
446public override Type MakeArrayType()
451public override Type MakeArrayType(int rank)
456public override Type MakePointerType()
462public override Type MakeGenericType(params Type[] typeArguments)
467public override Type MakeByRefType()
System\Reflection\Context\Projection\ProjectingModule.cs (14)
29public override object[] GetCustomAttributes(Type attributeType, bool inherit)
41public override bool IsDefined(Type attributeType, bool inherit)
58protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
69public override Type? GetType(string className, bool throwOnError, bool ignoreCase)
74public override Type[] GetTypes()
79public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
87public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
95public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
103public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
System\Reflection\Context\Projection\ProjectingType.cs (31)
16public ProjectingType(Type type, Projector projector)
34public override Type? BaseType
44public override Type? DeclaringType
54public override Type? ReflectedType
64public override Type GetEnumUnderlyingType()
69public override object[] GetCustomAttributes(Type attributeType, bool inherit)
86public override Type[] GetGenericArguments()
91public override Type[] GetGenericParameterConstraints()
96public override Type GetGenericTypeDefinition()
101public override InterfaceMapping GetInterfaceMap(Type interfaceType)
138public override bool IsAssignableFrom([NotNullWhen(true)] Type? c)
147public override bool IsDefined(Type attributeType, bool inherit)
154public override bool IsEquivalentTo([NotNullWhen(true)] Type? other)
165Type? objectType = _projector.ProjectType(o?.GetType());
173public override bool IsSubclassOf(Type c)
182protected override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
194public override Type? GetElementType()
219public override Type? GetInterface(string name, bool ignoreCase)
224public override Type[] GetInterfaces()
236Type[] nestedTypes = GetNestedTypes(bindingAttr);
260protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
272public override Type? GetNestedType(string name, BindingFlags bindingAttr)
277public override Type[] GetNestedTypes(BindingFlags bindingAttr)
287protected override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
295public override Type MakeArrayType()
300public override Type MakeArrayType(int rank)
305public override Type MakePointerType()
311public override Type MakeGenericType(params Type[] typeArguments)
318public override Type MakeByRefType()
System.Reflection.DispatchProxy (52)
System\Reflection\DispatchProxyGenerator.cs (49)
52private static readonly MethodInfo s_getTypeFromHandleMethod = typeof(Type).GetMethod("GetTypeFromHandle", new Type[] { typeof(RuntimeTypeHandle) })!;
59typeof(MethodInfo).GetMethod("MakeGenericMethod", new Type[] { typeof(Type[]) })!;
64[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type baseType,
65[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType,
82[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type generatedType,
90public Type GeneratedType { get; }
109private readonly Dictionary<Type, Dictionary<Type, GeneratedTypeInfo>> _baseTypeAndInterfaceToGeneratedProxyType = new Dictionary<Type, Dictionary<Type, GeneratedTypeInfo>>();
145[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type baseType,
146[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType,
151if (!_baseTypeAndInterfaceToGeneratedProxyType.TryGetValue(baseType, out Dictionary<Type, GeneratedTypeInfo>? interfaceToProxy))
153interfaceToProxy = new Dictionary<Type, GeneratedTypeInfo>();
171[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type baseType,
172[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type interfaceType,
197if (baseType.GetConstructor(Type.EmptyTypes) == null)
205foreach (Type t in interfaceType.GetInterfaces())
221[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type proxyBaseType)
244internal void EnsureTypeIsVisible(Type type)
262private readonly Type _proxyBaseType;
269[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type proxyBaseType)
285Type[] args = new Type[_fields.Count];
295ConstructorInfo baseCtor = _proxyBaseType.GetConstructor(Type.EmptyTypes)!;
318internal void AddInterfaceImpl([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type iface)
419Type[] paramTypes = new Type[parameters.Length];
420Type[][] paramReqMods = new Type[paramTypes.Length][];
438Type[] ts = mi.GetGenericArguments();
496Type[] genericTypes = mi.GetGenericArguments();
497GenericArray<Type> typeArr = new GenericArray<Type>(il, genericTypes.Length);
503typeArr.EndSet(typeof(Type));
553private static int GetTypeCode(Type type) => (int)Type.GetTypeCode(type);
621private static void Convert(ILGenerator il, Type source, Type target, bool isAddress)
630Type argType = source.GetElementType()!;
674private static void Ldind(ILGenerator il, Type type)
687private static void Stind(ILGenerator il, Type type)
703private readonly Type[] _paramTypes;
704internal ParametersArray(ILGenerator il, Type[] paramTypes)
720internal void EndSet(int i, Type stackType)
723Type argType = _paramTypes[i].GetElementType()!;
761internal void EndSet(Type stackType)
System.Reflection.Emit (375)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\SymbolType.cs (26)
24internal Type _baseType = null!;
43internal static Type? FormCompoundType(string? format, Type baseType, int curIndex)
215internal SymbolType(Type baseType, TypeKind typeKind)
264public override Type MakePointerType()
269public override Type MakeByRefType()
275public override Type MakeArrayType()
281public override Type MakeArrayType(int rank)
322Type baseType;
333Type baseType;
347Type baseType;
368public override Type BaseType => typeof(Array);
372CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
385CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
410public override Type GetInterface(string name, bool ignoreCase)
416public override Type[] GetInterfaces()
435Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
447public override Type[] GetNestedTypes(BindingFlags bindingAttr)
453public override Type GetNestedType(string name, BindingFlags bindingAttr)
477public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
491Type baseType;
528public override Type? GetElementType()
538public override Type UnderlyingSystemType => this;
545public override object[] GetCustomAttributes(Type attributeType, bool inherit)
550public override bool IsDefined(Type attributeType, bool inherit)
System\Reflection\Emit\EnumBuilderImpl.cs (19)
14internal EnumBuilderImpl(string name, Type underlyingType, TypeAttributes visibility, ModuleBuilderImpl module)
60public override Type? BaseType => _typeBuilder.BaseType;
70public override Type? DeclaringType => _typeBuilder.DeclaringType;
72public override Type? ReflectedType => _typeBuilder.ReflectedType;
74public override Type UnderlyingSystemType => this;
76public override Type GetEnumUnderlyingType() => _underlyingField.FieldType;
90public override Type? GetElementType() => _typeBuilder.GetElementType();
97public override Type[] GetInterfaces() => EmptyTypes;
99public override bool IsDefined(Type attributeType, bool inherit) => throw new NotImplementedException();
101public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotImplementedException();
110CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
123CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
130public override Type? GetInterface(string name, bool ignoreCase) => throw new NotSupportedException();
135Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
137public override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException();
139public override Type? GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException();
142public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
146public override bool IsAssignableFrom([NotNullWhen(true)] Type? c) => throw new NotSupportedException();
System\Reflection\Emit\GenericTypeParameterBuilderImpl.cs (25)
18private Type? _parent;
21internal List<Type>? _interfaces;
40protected override void SetBaseTypeConstraintCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? baseTypeConstraint)
46_interfaces ??= new List<Type>();
60protected override void SetInterfaceConstraintsCore(params Type[]? interfaceConstraints)
64_interfaces ??= new List<Type>(interfaceConstraints.Length);
69public override Type[] GetGenericParameterConstraints() =>
81public override Type UnderlyingSystemType => this;
88public override Type? BaseType => _parent;
98public override Type? GetElementType() => null;
100public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException();
101public override bool IsDefined(Type attributeType, bool inherit) => throw new NotSupportedException();
103protected override ConstructorInfo GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
107protected override MethodInfo GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
116public override Type GetInterface(string name, bool ignoreCase) => throw new NotSupportedException();
118public override Type[] GetInterfaces() => throw new NotSupportedException();
124protected override PropertyInfo GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
128public override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException();
130public override Type GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException();
133public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => throw new NotSupportedException();
144public override Type MakePointerType() =>
147public override Type MakeByRefType() =>
151public override Type MakeArrayType() =>
155public override Type MakeArrayType(int rank) =>
System\Reflection\Emit\ILGeneratorImpl.cs (17)
86public override void BeginCatchBlock(Type? exceptionType)
243public override LocalBuilder DeclareLocal(Type localType, bool pinned)
613public override void Emit(OpCode opcode, Type cls)
621public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
639new KeyValuePair<MethodInfo, Type[]>(methodInfo, optionalParameterTypes));
643private static int GetStackChange(OpCode opcode, MethodInfo methodInfo, Type voidType, Type[]? optionalParameterTypes)
684Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes)
713public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes)
721private static int GetStackChange(Type? returnType, Type voidType, Type[]? parameterTypes)
869public Type? ExceptionType;
878Type? catchType = null)
System\Reflection\Emit\MethodBuilderImpl.cs (29)
16private Type _returnType;
17internal Type[]? _parameterTypes;
27internal Type[]? _returnTypeRequiredModifiers;
28internal Type[]? _returnTypeOptionalCustomModifiers;
29internal Type[][]? _parameterTypeRequiredCustomModifiers;
30internal Type[][]? _parameterTypeOptionalCustomModifiers;
39Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers,
40Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers,
67_parameterTypes = new Type[parameterTypes.Length];
86internal Type[]? ParameterTypes => _parameterTypes;
217protected override void SetSignatureCore(Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
218Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
229_parameterTypes = new Type[parameterTypes.Length];
244public override Type? DeclaringType => _declaringType._isHiddenGlobalType ? null : _declaringType;
254public override Type? ReflectedType => DeclaringType;
270public override Type ReturnType => _returnType;
277public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_DynamicModule);
279public override Type[] GetGenericArguments() => _typeParameters ?? Type.EmptyTypes;
318public override bool IsDefined(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_DynamicModule);
322public override MethodInfo MakeGenericMethod(params Type[] typeArguments) =>
System\Reflection\Emit\ModuleBuilderImpl.cs (56)
23private readonly Dictionary<Type, EntityHandle> _typeReferences = new();
38private Type?[]? _coreTypes;
41private static readonly Type[] s_coreTypes = { typeof(void), typeof(object), typeof(bool), typeof(char), typeof(sbyte),
57internal Type GetTypeFromCoreAssembly(CoreTypeId typeId)
69_coreTypes = new Type[s_coreTypes.Length];
78internal CoreTypeId? GetTypeIdFromCoreTypes(Type type)
90_coreTypes = new Type[s_coreTypes.Length];
207foreach (Type iface in typeBuilder._interfaces)
373Type[] gParams = method.GetGenericArguments();
618if (pair.Key is KeyValuePair<MethodInfo, Type[]> pair2)
691private EntityHandle GetTypeReferenceOrSpecificationHandle(Type type)
718private TypeSpecificationHandle AddTypeSpecification(Type type) =>
722private MethodSpecificationHandle AddMethodSpecification(EntityHandle methodHandle, Type[] genericArgs) =>
736Type declaringType = field.DeclaringType!;
743Type fieldType = ((FieldInfo)GetOriginalMemberIfConstructedType(field)).FieldType;
778private EntityHandle GetMethodReference(MethodInfo methodInfo, Type[] optionalParameterTypes)
793private BlobBuilder GetMethodSignature(MethodInfo method, Type[]? optionalParameterTypes) =>
817Type declaringType = memberInfo.DeclaringType!;
828private static Type[] ParameterTypes(ParameterInfo[] parameterInfos)
832return Type.EmptyTypes;
835Type[] parameterTypes = new Type[parameterInfos.Length];
878foreach (Type constraint in gParam.GetGenericParameterConstraints())
888Type type = defaultValue.GetType();
996internal EntityHandle GetTypeHandle(Type type)
1027if (member is Type type)
1055internal TypeBuilder DefineNestedType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent,
1056Type[]? interfaces, PackingSize packingSize, int typesize, TypeBuilderImpl? enclosingType)
1068public override bool IsDefined(Type attributeType, bool inherit) => throw new NotImplementedException();
1102private bool IsConstructedFromTypeBuilder(Type type)
1112Type elementType = type.GetElementType()!;
1119internal bool ContainsTypeBuilder(Type[] genericArguments)
1121foreach (Type type in genericArguments)
1137internal EntityHandle TryGetTypeHandle(Type type)
1193internal EntityHandle TryGetMethodHandle(MethodInfo method, Type[] optionalParameterTypes)
1231public override int GetTypeMetadataToken(Type type) => GetTokenForHandle(TryGetTypeHandle(type));
1244protected override EnumBuilder DefineEnumCore(string name, TypeAttributes visibility, Type underlyingType)
1252Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes,
1253Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
1286CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
1301[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize)
1320protected override MethodInfo GetArrayMethodCore(Type arrayClass, string methodName,
1321CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes)
1344CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
1363internal int GetSignatureToken(CallingConventions callingConventions, Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes) =>
1368internal int GetSignatureToken(CallingConvention callingConvention, Type? returnType, Type[]? parameterTypes) =>
System\Reflection\Emit\PropertyBuilderImpl.cs (18)
14private readonly Type _propertyType;
15private readonly Type[]? _parameterTypes;
21internal readonly Type[]? _returnTypeRequiredCustomModifiers;
22internal readonly Type[]? _returnTypeOptionalCustomModifiers;
23internal readonly Type[][]? _parameterTypeRequiredCustomModifiers;
24internal readonly Type[][]? _parameterTypeOptionalCustomModifiers;
29internal PropertyBuilderImpl(string name, PropertyAttributes attributes, CallingConventions callingConvention, Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes, Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers, TypeBuilderImpl containingType)
45internal Type[]? ParameterTypes => _parameterTypes;
95public override Type PropertyType => _propertyType;
105public override Type? DeclaringType => _containingType;
107public override Type? ReflectedType => _containingType;
149public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_DynamicModule);
151public override bool IsDefined(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_DynamicModule);
System\Reflection\Emit\SignatureHelper.cs (25)
27internal static BlobBuilder GetFieldSignature(Type fieldType, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, ModuleBuilderImpl module)
54internal static BlobBuilder GetTypeSpecificationSignature(Type type, ModuleBuilderImpl module)
62internal static BlobBuilder GetMethodSpecificationSignature(Type[] genericArguments, ModuleBuilderImpl module)
67foreach (Type argument in genericArguments)
75internal static BlobBuilder GetMethodSignature(ModuleBuilderImpl module, Type[]? parameters, Type? returnType, SignatureCallingConvention convention,
76int genParamCount = 0, bool isInstance = false, Type[]? optionalParameterTypes = null, Type[]? returnTypeRequiredModifiers = null,
77Type[]? returnTypeOptionalModifiers = null, Type[][]? parameterRequiredModifiers = null, Type[][]? parameterOptionalModifiers = null)
108Type[]? requiredModifiers, Type[]? optionalModifiers, ModuleBuilderImpl module)
121private static void WriteCustomModifiers(CustomModifiersEncoder encoder, Type[] customModifiers, bool isOptional, ModuleBuilderImpl module)
123foreach (Type modifier in customModifiers)
129private static void WriteParametersSignature(ModuleBuilderImpl module, Type[]? parameters,
130ParametersEncoder parameterEncoder, Type[][]? requiredModifiers = null, Type[][]? optionalModifiers = null)
168private static void WriteSignatureForType(SignatureTypeEncoder signature, Type type, ModuleBuilderImpl module)
172Type elementType = type.GetElementType()!;
196Type[] genericArguments = type.GetGenericArguments();
200foreach (Type gType in genericArguments)
230private static void WriteSimpleSignature(SignatureTypeEncoder signature, Type type, ModuleBuilderImpl module)
System\Reflection\Emit\TypeBuilderImpl.cs (93)
20private Type? _typeParent;
26private Type? _enumUnderlyingType;
38internal List<Type>? _interfaces;
42internal Dictionary<Type, List<(MethodInfo ifaceMethod, MethodInfo targetMethod)>>? _methodOverrides;
54[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, ModuleBuilderImpl module,
55Type[]? interfaces, PackingSize packingSize, int typeSize, TypeBuilderImpl? enclosingType)
75_interfaces = new List<Type>(interfaces.Length);
78Type @interface = interfaces[i];
90protected override void AddInterfaceImplementationCore([DynamicallyAccessedMembers((DynamicallyAccessedMemberTypes.All))] Type interfaceType)
94_interfaces ??= new List<Type>();
172Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
243protected override EventBuilder DefineEventCore(string name, EventAttributes attributes, Type eventtype)
253protected override FieldBuilder DefineFieldCore(string fieldName, Type type, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers, FieldAttributes attributes)
303Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
304Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
322Type baseType = methodInfoDeclaration.DeclaringType!;
342private bool IsInterfaceImplemented(Type interfaceType)
346foreach (Type iface in _interfaces)
357foreach (Type @interface in _typeParent.GetInterfaces())
373[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packSize, int typeSize)
380CallingConventions callingConvention, Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
381Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers, CallingConvention nativeCallConv, CharSet nativeCharSet)
410Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
411Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers)
559protected override void SetParentCore([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent)
591public override Type? DeclaringType => _declaringType;
592public override Type? ReflectedType => _declaringType;
597public override Type[] GenericTypeParameters => _typeParameters ?? EmptyTypes;
598public override Type[] GetGenericArguments() => _typeParameters ?? EmptyTypes;
599public override Type GetGenericTypeDefinition()
608public override bool IsDefined(Type attributeType, bool inherit) => throw new NotImplementedException();
610public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotImplementedException();
612public override Type GetElementType() => throw new NotSupportedException(SR.NotSupported_DynamicModule);
618public override Type UnderlyingSystemType => this;
620public override Type GetEnumUnderlyingType()
638public override Type? BaseType => _typeParent;
668CallingConventions callConvention, Type[] types, ParameterModifier[]? _)
698private static bool MatchesTheFilter(MethodBuilderImpl method, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
724Type[] parameterTypes = method.ParameterTypes ?? EmptyTypes;
732Type? argType = argumentTypes[i];
733Type? paramType = parameterTypes[i];
841CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
961public override Type? GetInterface(string name, bool ignoreCase)
966Type[] interfaces = GetInterfaces();
968Type? match = null;
972Type interfaceType = interfaces[i];
990public override Type[] GetInterfaces()
994List<Type> interfaces = _interfaces ?? [];
1066Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
1102private List<PropertyInfo> GetPropertyCandidates(string name, BindingFlags bindingAttr, Type[]? types)
1128private Type[] GetNestedTypes(string name, BindingFlags bindingAttr)
1133Type[] candidates = GetNestedTypes(bindingAttr);
1134List<Type> nestedTypes = new List<Type>();
1136foreach (Type type in candidates)
1148public override Type[] GetNestedTypes(BindingFlags bindingAttr)
1152List<Type> nestedTypes = new List<Type>();
1166public override Type? GetNestedType(string name, BindingFlags bindingAttr)
1170Type[] types = GetNestedTypes(bindingAttr);
1172Type? match = null;
1173foreach (Type type in types)
1199Type[] nestedTypes = [];
1273public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
1321private static Type[] GetParameterTypes(ParameterInfo[] parameterInfos)
1323Type[] parameterTypes = new Type[parameterInfos.Length];
1331private void ValidateInterfaceType(Type interfaceType)
1359Type[] nestedTypes = GetNestedTypes(bindingAttr);
1385public override bool IsAssignableFrom([NotNullWhen(true)] Type? c)
1405Type[] interfaces = tb.GetInterfaces();
1424internal static bool AreTypesEqual(Type t1, Type? t2)
1442public override bool IsSubclassOf(Type c)
1444Type? p = this;
System.Reflection.Metadata (8)
System.Reflection.MetadataLoadContext (491)
System\Reflection\DefaultBinder.cs (30)
14private readonly Type? _objectType;
22private bool IsImplementedByMetadataLoadContext(Type type) => type is RoType roType && roType.Loader == _loader;
47public sealed override MethodBase? SelectMethod(BindingFlags bindingAttr, MethodBase[] match, Type[] types, ParameterModifier[]? modifiers)
52Type[] realTypes = new Type[types.Length];
77Type pCls = par[j].ParameterType;
83Type? type = types[j];
147public sealed override PropertyInfo? SelectProperty(BindingFlags bindingAttr, PropertyInfo[] match, Type? returnType,
148Type[]? indexes, ParameterModifier[]? modifiers)
153foreach (Type index in indexes)
180Type pCls = par[j].ParameterType;
268public override object ChangeType(object value, Type type, CultureInfo? cultureInfo) => throw new InvalidOperationException(SR.Arg_InvalidOperation_Reflection);
274public static MethodBase? ExactBinding(MethodBase[] match, Type[] types)
294Type pCls = par[j].ParameterType;
319public static PropertyInfo? ExactPropertyBinding(PropertyInfo[] match, Type? returnType, Type[]? types)
334Type pCls = par[j].ParameterType;
353private static int FindMostSpecific(ParameterInfo[] p1, int[] paramOrder1, Type? paramArrayType1,
354ParameterInfo[] p2, int[] paramOrder2, Type? paramArrayType2,
355Type[] types, object[]? args)
368if (args != null && args[i] == Type.Missing)
371Type c1, c2;
430private static int FindMostSpecificType(Type c1, Type c2, Type t)
504private static int FindMostSpecificMethod(MethodBase m1, int[] paramOrder1, Type? paramArrayType1,
505MethodBase m2, int[] paramOrder2, Type? paramArrayType2,
506Type[] types, object[]? args)
582private static int GetHierarchyDepth(Type t)
586Type? currentType = t;
System\Reflection\Runtime\BindingFlagSupport\NestedTypePolicies.cs (10)
19internal sealed class NestedTypePolicies : MemberPolicies<Type>
21public sealed override IEnumerable<Type> GetDeclaredMembers(TypeInfo typeInfo)
26public sealed override IEnumerable<Type> CoreGetDeclaredMembers(RuntimeTypeInfo type, NameFilter? filter, RuntimeTypeInfo reflectedType)
34public sealed override void GetMemberAttributes(Type member, out MethodAttributes visibility, out bool isStatic, out bool isVirtual, out bool isNewSlot)
45public sealed override bool ImplicitlyOverrides(Type? baseMember, Type? derivedMember) => false;
47public sealed override bool IsSuppressedByMoreDerivedMember(Type member, Type[] priorMembers, int startIndex, int endIndex)
59public sealed override bool OkToIgnoreAmbiguity(Type m1, Type m2)
System\Reflection\TypeLoading\General\Assignability.cs (43)
11public static bool IsAssignableFrom(Type toTypeInfo, Type fromTypeInfo, CoreTypes coreTypes)
47Type nullableUnderlyingType = toTypeInfo.GenericTypeArguments[0];
55private static bool CanCastTo(this Type fromTypeInfo, Type toTypeInfo, CoreTypes coreTypes)
86Type toElementTypeInfo = toTypeInfo.GetElementType()!;
87Type fromElementTypeInfo = fromTypeInfo.GetElementType()!;
96Type toElementTypeInfo = toTypeInfo.GetElementType()!;
97Type fromElementTypeInfo = fromTypeInfo.GetElementType()!;
112Type toElementTypeInfo = toTypeInfo.GetElementType()!;
113Type fromElementTypeInfo = fromTypeInfo.GetElementType()!;
135foreach (Type constraintType in fromTypeInfo.GetGenericParameterConstraints())
152foreach (Type ifc in fromTypeInfo.GetInterfaces())
165Type walk = fromTypeInfo;
168Type? baseType = walk.BaseType;
182private static bool MatchesWithVariance(this Type fromTypeInfo, Type toTypeInfo, CoreTypes coreTypes)
193Type genericTypeDefinition = fromTypeInfo.GetGenericTypeDefinition();
197Type[] fromTypeArguments = fromTypeInfo.GenericTypeArguments;
198Type[] toTypeArguments = toTypeInfo.GenericTypeArguments;
199Type[] genericTypeParameters = genericTypeDefinition.GetGenericTypeParameters();
202Type fromTypeArgumentInfo = fromTypeArguments[i];
203Type toTypeArgumentInfo = toTypeArguments[i];
240private static bool IsElementTypeCompatibleWith(this Type fromTypeInfo, Type toTypeInfo, CoreTypes coreTypes)
245Type reducedFromType = fromTypeInfo.ReducedType(coreTypes);
246Type reducedToType = toTypeInfo.ReducedType(coreTypes);
253private static Type ReducedType(this Type t, CoreTypes coreTypes)
278private static bool IsGcReferenceTypeAndCastableTo(this Type fromTypeInfo, Type toTypeInfo, CoreTypes coreTypes)
292private static bool ProvablyAGcReferenceType(this Type t, CoreTypes coreTypes)
304private static bool ProvablyAGcReferenceTypeHelper(this Type t, CoreTypes coreTypes)
318foreach (Type constraintType in t.GetGenericParameterConstraints())
333private static bool CanCastArrayToInterface(this Type fromTypeInfo, Type toTypeInfo, CoreTypes coreTypes)
340Type[] toTypeGenericTypeArguments = toTypeInfo.GenericTypeArguments;
343Type toElementTypeInfo = toTypeGenericTypeArguments[0];
345Type toTypeGenericTypeDefinition = toTypeInfo.GetGenericTypeDefinition();
346Type? fromElementTypeInfo = fromTypeInfo.GetElementType();
347foreach (Type ifc in fromTypeInfo.GetInterfaces())
351Type ifcGenericTypeDefinition = ifc.GetGenericTypeDefinition();
363foreach (Type ifc in fromTypeInfo.GetInterfaces())
System\Reflection\TypeLoading\General\Helpers.cs (10)
41public static Type[]? CloneArrayToUnmodifiedTypes(this Type[]? original)
47return Type.EmptyTypes;
49Type[] copy = new Type[original.Length];
250Type[]? genericMethodArguments = typeContext.GenericMethodArguments;
311Func<Assembly?, string, bool, Type?> typeResolver =
321Type? type = roAssembly.GetTypeCore(ns, simpleName, ignoreCase: ignoreCase2, out Exception? e);
329return (RoType?)Type.GetType(name, assemblyResolver: assemblyResolver, typeResolver: typeResolver, throwOnError: throwOnError, ignoreCase: ignoreCase);
341public static bool IsVisibleOutsideAssembly(this Type type)
System\Reflection\TypeLoading\Modules\Ecma\EcmaModule.cs (3)
115protected sealed override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => GetModuleType().InternalGetMethodImpl(name, bindingAttr, binder, callConvention, types, modifiers);
118public sealed override Type[] GetTypes()
124return TypeDefTable.ToArray<Type>(skip: 1); // 0x02000001 is the <Module> type which is always skipped by this api.
System\Reflection\TypeLoading\Modules\RoModule.cs (15)
67public sealed override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
68public sealed override bool IsDefined(Type attributeType, bool inherit) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
73protected abstract override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers);
82public abstract override Type[] GetTypes();
86public sealed override FieldInfo ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) => throw new NotSupportedException(SR.NotSupported_ResolvingTokens);
87public sealed override MemberInfo ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) => throw new NotSupportedException(SR.NotSupported_ResolvingTokens);
88public sealed override MethodBase ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) => throw new NotSupportedException(SR.NotSupported_ResolvingTokens);
91public sealed override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments) => throw new NotSupportedException(SR.NotSupported_ResolvingTokens);
93public sealed override Type? GetType(string className, bool throwOnError, bool ignoreCase)
101Type type = Assembly.GetType(className, throwOnError: throwOnError, ignoreCase: ignoreCase)!;
System\Reflection\TypeLoading\RuntimeTypeInfo.BindingFlags.cs (10)
14protected sealed override ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
54protected sealed override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
59protected sealed override MethodInfo? GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
64private MethodInfo? GetMethodImplCommon(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
103public sealed override Type[] GetNestedTypes(BindingFlags bindingAttr) => Query<Type>(bindingAttr).ToArray();
104public sealed override Type? GetNestedType(string name, BindingFlags bindingAttr) => Query<Type>(name, bindingAttr).Disambiguate();
108protected sealed override PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
System\Reflection\TypeLoading\Types\RoConstructedGenericType.cs (12)
58public sealed override Type GetFunctionPointerReturnType() => throw new InvalidOperationException(SR.InvalidOperation_NotFunctionPointer);
59public sealed override Type[] GetFunctionPointerParameterTypes() => throw new InvalidOperationException(SR.InvalidOperation_NotFunctionPointer);
114protected sealed override TypeCode GetTypeCodeImpl() => Type.GetTypeCode(_genericTypeDefinition);
120public sealed override Type GetGenericTypeDefinition() => _genericTypeDefinition;
124public sealed override Type[] GetGenericArguments() => _genericTypeArguments.CloneArrayToUnmodifiedTypes();
126public sealed override Type MakeGenericType(params Type[] typeArguments) => throw new InvalidOperationException(SR.Format(SR.Arg_NotGenericTypeDefinition, this));
136public sealed override Type[] GetGenericParameterConstraints() => throw new InvalidOperationException(SR.Arg_NotGenericParameter);
140internal sealed override IEnumerable<MethodInfo> GetMethodsCore(NameFilter? filter, Type reflectedType) => _genericTypeDefinition.SpecializeMethods(filter, reflectedType, this);
141internal sealed override IEnumerable<EventInfo> GetEventsCore(NameFilter? filter, Type reflectedType) => _genericTypeDefinition.SpecializeEvents(filter, reflectedType, this);
142internal sealed override IEnumerable<FieldInfo> GetFieldsCore(NameFilter? filter, Type reflectedType) => _genericTypeDefinition.SpecializeFields(filter, reflectedType, this);
143internal sealed override IEnumerable<PropertyInfo> GetPropertiesCore(NameFilter? filter, Type reflectedType) => _genericTypeDefinition.SpecializeProperties(filter, reflectedType, this);
System\Reflection\TypeLoading\Types\RoDefinitionType.cs (17)
44Type? declaringType = DeclaringType;
81public sealed override Type GetGenericTypeDefinition() => IsGenericTypeDefinition ? this : throw new InvalidOperationException(SR.InvalidOperation_NotGenericType);
90public sealed override Type MakeGenericType(params Type[] typeArguments)
106Type typeArgument = typeArguments[i];
186Type t = IsEnum ? GetEnumUnderlyingType() : this;
229public sealed override Type[] GetGenericParameterConstraints() => throw new InvalidOperationException(SR.Arg_NotGenericParameter);
231public sealed override Type GetFunctionPointerReturnType() => throw new InvalidOperationException(SR.InvalidOperation_NotFunctionPointer);
232public sealed override Type[] GetFunctionPointerParameterTypes() => throw new InvalidOperationException(SR.InvalidOperation_NotFunctionPointer);
234internal sealed override IEnumerable<MethodInfo> GetMethodsCore(NameFilter? filter, Type reflectedType) => SpecializeMethods(filter, reflectedType, this);
235internal sealed override IEnumerable<EventInfo> GetEventsCore(NameFilter? filter, Type reflectedType) => SpecializeEvents(filter, reflectedType, this);
236internal sealed override IEnumerable<FieldInfo> GetFieldsCore(NameFilter? filter, Type reflectedType) => SpecializeFields(filter, reflectedType, this);
237internal sealed override IEnumerable<PropertyInfo> GetPropertiesCore(NameFilter? filter, Type reflectedType) => SpecializeProperties(filter, reflectedType, this);
241internal abstract IEnumerable<MethodInfo> SpecializeMethods(NameFilter? filter, Type reflectedType, RoInstantiationProviderType declaringType);
242internal abstract IEnumerable<EventInfo> SpecializeEvents(NameFilter? filter, Type reflectedType, RoInstantiationProviderType declaringType);
243internal abstract IEnumerable<FieldInfo> SpecializeFields(NameFilter? filter, Type reflectedType, RoInstantiationProviderType declaringType);
244internal abstract IEnumerable<PropertyInfo> SpecializeProperties(NameFilter? filter, Type reflectedType, RoInstantiationProviderType declaringType);
System\Reflection\TypeLoading\Types\RoType.cs (40)
20public sealed override Type AsType() => this;
21public override Type UnderlyingSystemType => this;
58public override Type[] GetFunctionPointerCallingConventions()
69public abstract override Type GetFunctionPointerReturnType();
70public abstract override Type[] GetFunctionPointerParameterTypes();
73public override Type[] GetOptionalCustomModifiers() => EmptyTypes;
74public override Type[] GetRequiredCustomModifiers() => EmptyTypes;
79public sealed override Type[] GenericTypeParameters => GetGenericTypeParametersNoCopy().CloneArray<Type>();
83public sealed override Type? GetElementType() => GetRoElementType();
90public abstract override Type GetGenericTypeDefinition();
91public sealed override Type[] GenericTypeArguments => GetGenericTypeArgumentsNoCopy().CloneArray<Type>();
97public abstract override Type[] GetGenericParameterConstraints();
103public override Type[] GetGenericArguments() => GetGenericArgumentsNoCopy().CloneArray();
139public sealed override Type? DeclaringType => GetRoDeclaringType();
148public sealed override Type? ReflectedType => DeclaringType;
159public sealed override Type? BaseType => GetRoBaseType();
195public sealed override Type[] GetInterfaces() => GetInterfacesNoCopy().CloneArray<Type>();
197public sealed override IEnumerable<Type> ImplementedInterfaces
201foreach (Type ifc in GetInterfacesNoCopy())
248public sealed override InterfaceMapping GetInterfaceMap(Type interfaceType) => throw new NotSupportedException(SR.NotSupported_InterfaceMapping);
251public sealed override bool IsAssignableFrom(TypeInfo? typeInfo) => IsAssignableFrom((Type?)typeInfo);
252public sealed override bool IsAssignableFrom(Type? c)
314public sealed override Type MakeArrayType() => this.GetUniqueArrayType();
315public sealed override Type MakeArrayType(int rank)
323public sealed override Type MakeByRefType() => this.GetUniqueByRefType();
324public sealed override Type MakePointerType() => this.GetUniquePointerType();
326public abstract override Type MakeGenericType(params Type[] typeArguments);
329public sealed override Type GetEnumUnderlyingType() => _lazyUnderlyingEnumType ??= ComputeEnumUnderlyingType();
344Array ret = Type.GetTypeCode(GetEnumUnderlyingType()) switch
374public sealed override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
375public sealed override bool IsDefined(Type attributeType, bool inherit) => throw new InvalidOperationException(SR.Arg_ReflectionOnlyCA);
381internal abstract IEnumerable<MethodInfo> GetMethodsCore(NameFilter? filter, Type reflectedType);
382internal abstract IEnumerable<EventInfo> GetEventsCore(NameFilter? filter, Type reflectedType);
383internal abstract IEnumerable<FieldInfo> GetFieldsCore(NameFilter? filter, Type reflectedType);
384internal abstract IEnumerable<PropertyInfo> GetPropertiesCore(NameFilter? filter, Type reflectedType);
388internal MethodInfo? InternalGetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
System.Reflection.TypeExtensions (45)
System\Reflection\TypeExtensions.cs (45)
11[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] this Type type,
12Type[] types)
20[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] this Type type)
28[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] this Type type,
43| DynamicallyAccessedMemberTypes.PublicNestedTypes)] this Type type)
51[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)] this Type type,
60[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] this Type type,
70[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents)] this Type type)
78[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] this Type type,
87[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] this Type type,
96[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] this Type type,
106[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] this Type type)
114[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] this Type type,
122public static Type[] GetGenericArguments(this Type type)
129public static Type[] GetInterfaces(
130[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.Interfaces)] this Type type)
144| DynamicallyAccessedMemberTypes.PublicNestedTypes)] this Type type,
153[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] this Type type,
169| DynamicallyAccessedMemberTypes.PublicNestedTypes)] this Type type)
177[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] this Type type,
186[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] this Type type,
195[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] this Type type,
205[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] this Type type,
207Type[] types)
215[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] this Type type)
223[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] this Type type,
231public static Type? GetNestedType(
232[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)] this Type type,
241public static Type[] GetNestedTypes(
242[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes)] this Type type,
251[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] this Type type)
259[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] this Type type,
268[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] this Type type,
277[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] this Type type,
287[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] this Type type,
289Type? returnType)
297[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)] this Type type,
299Type? returnType,
300Type[] types)
307public static bool IsAssignableFrom(this Type type, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] Type? c)
314public static bool IsInstanceOfType(this Type type, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] object? o)
325public static Type[] GetExportedTypes(this Assembly assembly)
340public static Type[] GetTypes(this Assembly assembly)
System.Resources.Extensions (53)
System\Resources\Extensions\BinaryFormat\Deserializer\ClassRecordFieldInfoDeserializer.cs (1)
30Type type,
System\Resources\Extensions\BinaryFormat\Deserializer\ClassRecordSerializationInfoDeserializer.cs (1)
31Type type,
System.Resources.Writer (2)
System.Runtime (1)
System.Runtime.CompilerServices.VisualC (2)
System.Runtime.InteropServices (38)
System.Runtime.Serialization.Formatters (56)
System.Runtime.Serialization.Primitives (16)
System.Runtime.Serialization.Schema (36)
System\Runtime\Serialization\Schema\CodeExporter.cs (19)
318private CodeTypeReference GetCodeTypeReference(Type type)
325private CodeTypeReference? GetCodeTypeReference(Type type, IList? parameters)
341else if (param is Tuple<Type, object[]?> typeParameters)
541Type? type = _dataContractSet.GetReferencedType(dataContract.XmlName, dataContract, out DataContract? referencedContract, out object[]? parameters, SupportsGenericTypeReference);
578type = (Type?)typeReference.UserData[s_codeUserDataActualTypeKey];
655Type? type = _dataContractSet.GetReferencedType(GenericDictionaryName, GenericDictionaryContract, out DataContract? _, out object[]? _) ?? typeof(Dictionary<,>);
685Type? type = _dataContractSet.GetReferencedType(GenericListName, GenericListContract, out DataContract? _, out object[]? _);
700Type? type = GetReferencedTypeOnImport(dataContract);
711private Type? GetReferencedTypeOnImport(DataContract dataContract)
713Type? type = null;
826Type? actualType = (Type?)baseContractCodeDomInfo.TypeReference?.UserData[s_codeUserDataActualTypeKey];
1051private static void ThrowIfReferencedBaseTypeSealed(Type baseType, DataContract dataContract)
1071Type baseType = enumDataContract.BaseContract!.UnderlyingType;
1158Type? actualType = (Type?)baseContractCodeDomInfo.TypeReference?.UserData[s_codeUserDataActualTypeKey];
1434internal static string GetClrTypeFullName(Type type)
1612Dictionary<Type, object> previousCollectionTypes = new Dictionary<Type, object>();
System.Security.AccessControl (11)
System.Security.Cryptography (66)
src\libraries\Common\src\System\Net\Http\X509ResourceClient.cs (22)
92Type? socketsHttpHandlerType = Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http", throwOnError: false);
93Type? httpMessageHandlerType = Type.GetType("System.Net.Http.HttpMessageHandler, System.Net.Http", throwOnError: false);
94Type? httpClientType = Type.GetType("System.Net.Http.HttpClient, System.Net.Http", throwOnError: false);
95Type? httpRequestMessageType = Type.GetType("System.Net.Http.HttpRequestMessage, System.Net.Http", throwOnError: false);
96Type? httpResponseMessageType = Type.GetType("System.Net.Http.HttpResponseMessage, System.Net.Http", throwOnError: false);
97Type? httpResponseHeadersType = Type.GetType("System.Net.Http.Headers.HttpResponseHeaders, System.Net.Http", throwOnError: false);
98Type? httpContentType = Type.GetType("System.Net.Http.HttpContent, System.Net.Http", throwOnError: false);
99Type? taskOfHttpResponseMessageType = Type.GetType("System.Threading.Tasks.Task`1[[System.Net.Http.HttpResponseMessage, System.Net.Http]], System.Runtime", throwOnError: false);
109ConstructorInfo? socketsHttpHandlerCtor = socketsHttpHandlerType.GetConstructor(Type.EmptyTypes);
112ConstructorInfo? httpClientCtor = httpClientType.GetConstructor(new Type[] { httpMessageHandlerType });
114ConstructorInfo? httpRequestMessageCtor = httpRequestMessageType.GetConstructor(Type.EmptyTypes);
115MethodInfo? sendMethod = httpClientType.GetMethod("Send", new Type[] { httpRequestMessageType, typeof(CancellationToken) });
116MethodInfo? sendAsyncMethod = httpClientType.GetMethod("SendAsync", new Type[] { httpRequestMessageType, typeof(CancellationToken) });
122MethodInfo? readAsStreamMethod = httpContentType.GetMethod("ReadAsStream", Type.EmptyTypes);
System\Security\Cryptography\CryptoConfig.cs (30)
36private static readonly ConcurrentDictionary<string, Type> appNameHT = new ConcurrentDictionary<string, Type>(StringComparer.OrdinalIgnoreCase);
115Type HMACMD5Type = typeof(System.Security.Cryptography.HMACMD5);
116Type HMACSHA1Type = typeof(System.Security.Cryptography.HMACSHA1);
117Type HMACSHA256Type = typeof(System.Security.Cryptography.HMACSHA256);
118Type HMACSHA384Type = typeof(System.Security.Cryptography.HMACSHA384);
119Type HMACSHA512Type = typeof(System.Security.Cryptography.HMACSHA512);
121Type RijndaelManagedType = typeof(System.Security.Cryptography.RijndaelManaged);
124Type AesManagedType = typeof(System.Security.Cryptography.AesManaged);
125Type SHA256DefaultType = typeof(System.Security.Cryptography.SHA256Managed);
126Type SHA384DefaultType = typeof(System.Security.Cryptography.SHA384Managed);
127Type SHA512DefaultType = typeof(System.Security.Cryptography.SHA512Managed);
128Type SHA1CryptoServiceProviderType = typeof(SHA1CryptoServiceProvider);
129Type MD5CryptoServiceProviderType = typeof(MD5CryptoServiceProvider);
130Type RSACryptoServiceProviderType = typeof(RSACryptoServiceProvider);
131Type DSACryptoServiceProviderType = typeof(DSACryptoServiceProvider);
132Type DESCryptoServiceProviderType = typeof(DESCryptoServiceProvider);
133Type TripleDESCryptoServiceProviderType = typeof(TripleDESCryptoServiceProvider);
134Type RC2CryptoServiceProviderType = typeof(RC2CryptoServiceProvider);
135Type AesCryptoServiceProviderType = typeof(AesCryptoServiceProvider);
138Type RNGCryptoServiceProviderType = typeof(RNGCryptoServiceProvider);
141Type ECDsaCngType = typeof(ECDsaCng);
303public static void AddAlgorithm(Type algorithm, params string[] names)
378appNameHT.TryGetValue(name, out Type? retvalType);
385retvalType = retvalObj as Type;
391retvalType = Type.GetType(retvalString, false, false);
422retvalType = Type.GetType(name, false, false);
462ConstructorInfo? rci = Type.DefaultBinder.BindToMethod(
478object retval = rci.Invoke(ConstructorDefault, Type.DefaultBinder, args, null);
483Type.DefaultBinder.ReorderArgumentArray(ref args, state);
System.Security.Cryptography.Xml (49)
System.Security.Permissions (5)
System.Security.Principal.Windows (8)
System.ServiceModel.Federation (2)
System.ServiceModel.NetNamedPipe.Tests (1)
System.ServiceModel.Primitives.Tests (21)
Channels\CustomChannelTest.cs (10)
33Func<Type, BindingContext, IChannelFactory> buildFactoryAction = (Type type, BindingContext context) =>
123Func<Type, BindingContext, IChannelFactory> buildFactoryAction = (Type type, BindingContext context) =>
217Func<Type, BindingContext, IChannelFactory> buildFactoryAction = (Type type, BindingContext context) =>
268Func<Type, BindingContext, IChannelFactory> buildFactoryAction = (Type type, BindingContext context) =>
325Func<Type, BindingContext, IChannelFactory> buildFactoryAction = (Type type, BindingContext context) =>
System.ServiceModel.Syndication (16)
System.Speech (1)
System.Text.Json (557)
System\Text\Json\Serialization\Converters\CastingConverter.cs (6)
18internal override Type? KeyType => _sourceConverter.KeyType;
19internal override Type? ElementType => _sourceConverter.ElementType;
44public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
50internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out T? value)
60public override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
63internal override T ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
System\Text\Json\Serialization\Converters\Collection\ReadOnlyMemoryConverter.cs (1)
16Type typeToConvert,
System\Text\Json\Serialization\Converters\Object\ObjectConverter.cs (6)
20public sealed override object ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
26internal sealed override object ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
56Type runtimeType = value.GetType();
81public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
100public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
111internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value)
System\Text\Json\Serialization\JsonConverter.cs (9)
31public abstract Type? Type { get; }
38public abstract bool CanConvert(Type typeToConvert);
161internal virtual Type? ElementType => null;
163internal virtual Type? KeyType => null;
202internal abstract object? ReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
203internal abstract bool OnTryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value);
204internal abstract bool TryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value);
205internal abstract object? ReadAsPropertyNameAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
206internal abstract object? ReadAsPropertyNameCoreAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
System\Text\Json\Serialization\JsonConverterFactory.cs (10)
25/// Create a converter for the provided <see cref="System.Type"/>.
27/// <param name="typeToConvert">The <see cref="System.Type"/> being converted.</param>
33public abstract JsonConverter? CreateConverter(Type typeToConvert, JsonSerializerOptions options);
35internal JsonConverter GetConverterInternal(Type typeToConvert, JsonSerializerOptions options)
53internal sealed override object? ReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
62Type typeToConvert,
74Type typeToConvert,
84internal sealed override object? ReadAsPropertyNameAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
91internal sealed override object? ReadAsPropertyNameCoreAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
142public sealed override Type? Type => null;
System\Text\Json\Serialization\JsonConverterOfT.cs (15)
14/// <typeparam name="T">The <see cref="System.Type"/> to convert.</typeparam>
48public override bool CanConvert(Type typeToConvert)
129internal virtual bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out T? value)
142/// <param name="typeToConvert">The <see cref="System.Type"/> being converted.</param>
146public abstract T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
148internal bool TryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out T? value, out bool isPopulatedValue)
282internal sealed override bool OnTryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value)
289internal sealed override bool TryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value)
296internal sealed override object? ReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
302internal sealed override object? ReadAsPropertyNameAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
308internal sealed override object? ReadAsPropertyNameCoreAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
497public sealed override Type Type { get; } = typeof(T);
587/// <param name="typeToConvert">The <see cref="System.Type"/> being converted.</param>
591public virtual T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
603internal virtual T ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
System\Text\Json\Serialization\JsonSerializer.Write.String.cs (7)
54/// encoding since the implementation internally uses UTF-8. See also <see cref="SerializeToUtf8Bytes(object?, Type, JsonSerializerOptions?)"/>
55/// and <see cref="SerializeAsync(IO.Stream, object?, Type, JsonSerializerOptions?, Threading.CancellationToken)"/>.
61Type inputType,
133/// The <see cref="JsonSerializerContext.GetTypeInfo(Type)"/> method of the provided
140/// encoding since the implementation internally uses UTF-8. See also <see cref="SerializeToUtf8Bytes(object?, Type, JsonSerializerContext)"/>
141/// and <see cref="SerializeAsync(IO.Stream, object?, Type, JsonSerializerContext, Threading.CancellationToken)"/>.
143public static string Serialize(object? value, Type inputType, JsonSerializerContext context)
System\Text\Json\Serialization\JsonSerializerOptions.Caching.cs (16)
55public JsonTypeInfo GetTypeInfo(Type type)
83public bool TryGetTypeInfo(Type type, [NotNullWhen(true)] out JsonTypeInfo? typeInfo)
104Type type,
138internal bool TryGetTypeInfoCached(Type type, [NotNullWhen(true)] out JsonTypeInfo? typeInfo)
153internal JsonTypeInfo GetTypeInfoForRootType(Type type, bool fallBackToNearestAncestorType = false)
169Type runtimeType = rootValue.GetType();
215private readonly ConcurrentDictionary<Type, CacheEntry> _cache = new();
235public JsonTypeInfo? GetOrAddTypeInfo(Type type, bool fallBackToNearestAncestorType = false)
243public bool TryGetTypeInfo(Type type, [NotNullWhen(true)] out JsonTypeInfo? typeInfo)
255private CacheEntry GetOrAddCacheEntry(Type type)
264private static CacheEntry CreateCacheEntry(Type type, CachingContext context)
278private JsonTypeInfo? FallBackToNearestAncestor(Type type, CacheEntry entry)
291private CacheEntry? DetermineNearestAncestor(Type type, CacheEntry entry)
307Type? candidateType = null;
309for (Type? current = type.BaseType; current != null; current = current.BaseType)
327foreach (Type interfaceType in type.GetInterfaces())
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Converters.cs (12)
15private static Dictionary<Type, JsonConverter>? s_defaultSimpleConverters;
41private static Dictionary<Type, JsonConverter> GetDefaultSimpleConverters()
44var converters = new Dictionary<Type, JsonConverter>(NumberOfSimpleConverters);
94private static JsonConverter GetBuiltInConverter(Type typeToConvert)
120internal static bool TryGetDefaultSimpleConverter(Type typeToConvert, [NotNullWhen(true)] out JsonConverter? converter)
133private static JsonConverter? GetCustomConverterForMember(Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options)
144internal static JsonConverter GetConverterForType(Type typeToConvert, JsonSerializerOptions options, bool resolveJsonConverterAttribute = true)
175private static JsonConverter GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, MemberInfo? memberInfo, JsonSerializerOptions options)
179Type declaringType = memberInfo?.DeclaringType ?? typeToConvert;
180Type? converterType = converterAttribute.ConverterType;
192ConstructorInfo? ctor = converterType.GetConstructor(Type.EmptyTypes);
204Type? underlyingType = Nullable.GetUnderlyingType(typeToConvert);
System\Text\Json\Serialization\Metadata\JsonTypeInfo.cs (15)
42internal JsonTypeInfo(Type type, JsonConverter converter, JsonSerializerOptions options)
62public Type? ElementType { get; }
72public Type? KeyType { get; }
443public Type Type { get; }
938public static JsonTypeInfo CreateJsonTypeInfo(Type type, JsonSerializerOptions options)
961internal static JsonTypeInfo CreateJsonTypeInfo(Type type, JsonConverter converter, JsonSerializerOptions options)
973Type jsonTypeInfoType = typeof(JsonTypeInfo<>).MakeGenericType(type);
994public JsonPropertyInfo CreateJsonPropertyInfo(Type propertyType, string name)
1020internal JsonPropertyInfo CreatePropertyUsingReflection(Type propertyType, Type? declaringType)
1035Type propertyInfoType = typeof(JsonPropertyInfo<>).MakeGenericType(propertyType);
1037parameterTypes: [typeof(Type), typeof(JsonTypeInfo), typeof(JsonSerializerOptions)],
1048private protected abstract JsonPropertyInfo CreateJsonPropertyInfo(JsonTypeInfo declaringTypeInfo, Type? declaringType, JsonSerializerOptions options);
1071private protected readonly struct ParameterLookupKey(Type type, string name) : IEquatable<ParameterLookupKey>
1073public Type Type { get; } = type;
System\Text\Json\Serialization\Metadata\ReflectionEmitMemberAccessor.cs (31)
21public override Func<object>? CreateParameterlessConstructor(Type type, ConstructorInfo? constructorInfo)
39Type.EmptyTypes,
76Type? type = constructor.DeclaringType;
96Type paramType = parameters[i].ParameterType;
115private static DynamicMethod? CreateParameterizedConstructor(ConstructorInfo constructor, Type parameterType1, Type parameterType2, Type parameterType3, Type parameterType4)
117Type? type = constructor.DeclaringType;
160[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type collectionType)
186private static DynamicMethod CreateImmutableEnumerableCreateRangeDelegate(Type collectionType, Type elementType, Type enumerableType)
210private static DynamicMethod CreateImmutableDictionaryCreateRangeDelegate(Type collectionType, Type keyType, Type valueType, Type enumerableType)
233private static DynamicMethod CreatePropertyGetter(PropertyInfo propertyInfo, Type runtimePropertyType)
238Type? declaringType = propertyInfo.DeclaringType;
241Type declaredPropertyType = propertyInfo.PropertyType;
279private static DynamicMethod CreatePropertySetter(PropertyInfo propertyInfo, Type runtimePropertyType)
284Type? declaringType = propertyInfo.DeclaringType;
287Type declaredPropertyType = propertyInfo.PropertyType;
317private static DynamicMethod CreateFieldGetter(FieldInfo fieldInfo, Type runtimeFieldType)
319Type? declaringType = fieldInfo.DeclaringType;
322Type declaredFieldType = fieldInfo.FieldType;
351private static DynamicMethod CreateFieldSetter(FieldInfo fieldInfo, Type runtimeFieldType)
353Type? declaringType = fieldInfo.DeclaringType;
356Type declaredFieldType = fieldInfo.FieldType;
379private static DynamicMethod CreateGetterMethod(string memberName, Type memberType) =>
387private static DynamicMethod CreateSetterMethod(string memberName, Type memberType) =>
System\Text\Json\ThrowHelper.Serialization.cs (75)
20public static void ThrowArgumentException_DeserializeWrongType(Type type, object value)
32public static void ThrowNotSupportedException_SerializationNotSupported(Type propertyType)
38public static void ThrowNotSupportedException_TypeRequiresAsyncSerialization(Type propertyType)
44public static void ThrowNotSupportedException_DictionaryKeyTypeNotSupported(Type keyType, JsonConverter converter)
50public static void ThrowJsonException_DeserializeUnableToConvertValue(Type propertyType)
56public static void ThrowInvalidCastException_DeserializeUnableToAssignValue(Type typeOfValue, Type declaredType)
62public static void ThrowInvalidOperationException_DeserializeUnableToAssignNull(Type declaredType)
68public static void ThrowJsonException_PropertyGetterDisallowNull(string propertyName, Type declaringType)
74public static void ThrowJsonException_PropertySetterDisallowNull(string propertyName, Type declaringType)
80public static void ThrowJsonException_ConstructorParameterDisallowNull(string parameterName, Type declaringType)
152public static void ThrowArgumentException_CannotSerializeInvalidType(string paramName, Type typeToConvert, Type? declaringType, string? propertyName)
165public static void ThrowInvalidOperationException_CannotSerializeInvalidType(Type typeToConvert, Type? declaringType, MemberInfo? memberInfo)
178public static void ThrowInvalidOperationException_SerializationConverterNotCompatible(Type converterType, Type type)
184public static void ThrowInvalidOperationException_ResolverTypeNotCompatible(Type requestedType, Type actualType)
208public static void ThrowInvalidOperationException_SerializationConverterOnAttributeInvalid(Type classType, MemberInfo? memberInfo)
220public static void ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo? memberInfo, Type typeToConvert)
267public static void ThrowInvalidOperationException_SerializerPropertyNameConflict(Type type, string propertyName)
333public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
339public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactorty(Type converterType)
346Type parentType,
361public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
373public static void ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(string memberName, Type declaringType)
379public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type propertyDeclaringType)
392public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, JsonConverter jsonConverter)
418public static void ThrowInvalidOperationException_JsonTypeInfoOnDeserializingCallbacksNotSupported(Type type)
424public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
481Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
524public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo memberInfo)
526string location = memberInfo is Type type ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}";
531public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attribute)
537public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType)
543public static void ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(Type classType, JsonPropertyInfo jsonPropertyInfo)
575Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
603Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
623Type type = typeInfo.Type;
650public static void ThrowNotSupportedException_CannotPopulateCollection(Type type, ref Utf8JsonReader reader, scoped ref ReadStack state)
694public static void ThrowJsonException_UnmappedJsonProperty(Type type, string unmappedPropertyName)
748public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
754public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type propertyType, in Utf8JsonReader reader)
765public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type propertyType)
776public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
782public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string referenceId, Type currentType, Type typeToConvert)
813public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
818public static NotSupportedException GetNotSupportedException_AmbiguousMetadataForType(Type type, Type match1, Type match2)
824public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
830public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
835public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, Type type)
841public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, Type type)
853public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
859public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
865public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
871public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type derivedType1, Type derivedType2)
877public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
883public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
889public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
895public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typeDiscriminator)
907public static void ThrowInvalidOperationException_PropertyConflictsWithMetadataPropertyName(Type type, string propertyName)
913public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type baseType)
919public static void ThrowInvalidOperationException_UnsupportedEnumIdentifier(Type enumType, string? enumName)
System.Text.Json.SourceGeneration (6)
System.Text.RegularExpressions (88)
System\Text\RegularExpressions\RegexAssemblyCompiler.cs (13)
66Type runnerType = regexRunnerTypeBuilder.CreateType()!;
72Type regexRunnerFactoryType = regexRunnerFactoryTypeBuilder.CreateType()!;
76ConstructorBuilder defaultCtorBuilder = regexTypeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
85_ilg = regexTypeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(TimeSpan) }).GetILGenerator();
92private void GenerateCreateInstance([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type type)
95_ilg!.Emit(OpCodes.Newobj, type.GetConstructor(Type.EmptyTypes)!);
102[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type regexRunnerFactoryType,
113_ilg!.Emit(OpCodes.Call, typeof(Regex).GetConstructor(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, Type.EmptyTypes, Array.Empty<ParameterModifier>())!);
121_ilg!.Emit(OpCodes.Newobj, regexRunnerFactoryType.GetConstructor(Type.EmptyTypes)!);
196_ilg!.Emit(OpCodes.Newobj, typeof(Hashtable).GetConstructor(Type.EmptyTypes)!);
245[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type inheritFromClass)
257private static ILGenerator DefineMethod(TypeBuilder typeBuilder, string methname, Type[]? parameterTypes, Type? returnType, out MethodBuilder builder)
System\Text\RegularExpressions\RegexCompiler.cs (71)
68private static MethodInfo SpanIndexOfCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
69private static MethodInfo SpanIndexOfSpanMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
71private static MethodInfo SpanIndexOfAnyCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
72private static MethodInfo SpanIndexOfAnyCharCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
73private static MethodInfo SpanIndexOfAnySpanMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
74private static MethodInfo SpanIndexOfAnySearchValuesMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
76private static MethodInfo SpanIndexOfAnyExceptCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
77private static MethodInfo SpanIndexOfAnyExceptCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
78private static MethodInfo SpanIndexOfAnyExceptCharCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
79private static MethodInfo SpanIndexOfAnyExceptSpanMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
80private static MethodInfo SpanIndexOfAnyExceptSearchValuesMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
81private static MethodInfo SpanIndexOfAnyInRangeMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
82private static MethodInfo SpanIndexOfAnyExceptInRangeMethod => field ??= typeof(MemoryExtensions).GetMethod("IndexOfAnyExceptInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
83private static MethodInfo SpanLastIndexOfCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
84private static MethodInfo SpanLastIndexOfAnyCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
85private static MethodInfo SpanLastIndexOfAnyCharCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
86private static MethodInfo SpanLastIndexOfAnySpanMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
87private static MethodInfo SpanLastIndexOfAnySearchValuesMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
88private static MethodInfo SpanLastIndexOfSpanMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
89private static MethodInfo SpanLastIndexOfAnyExceptCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
90private static MethodInfo SpanLastIndexOfAnyExceptCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
91private static MethodInfo SpanLastIndexOfAnyExceptCharCharCharMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
92private static MethodInfo SpanLastIndexOfAnyExceptSpanMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
93private static MethodInfo SpanLastIndexOfAnyExceptSearchValuesMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
94private static MethodInfo SpanLastIndexOfAnyInRangeMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
95private static MethodInfo SpanLastIndexOfAnyExceptInRangeMethod => field ??= typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExceptInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
98private static MethodInfo SpanStartsWithSpanMethod => field ??= typeof(MemoryExtensions).GetMethod("StartsWith", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
104private static MethodInfo MemoryMarshalGetArrayDataReferenceSearchValuesMethod => field ??= typeof(MemoryMarshal).GetMethod("GetArrayDataReference", [Type.MakeGenericMethodParameter(0).MakeArrayType()])!.MakeGenericMethod(typeof(SearchValues<char>))!;
System.Text.RegularExpressions.Generator (1)
System.Threading.AccessControl (9)
System.Transactions.Local (1)
System.Windows.Controls.Ribbon (54)
Microsoft\Windows\Controls\Ribbon\RibbonContextMenu.cs (5)
45Type ownerType = typeof(RibbonContextMenu);
407public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
437public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
465public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
476public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
System.Windows.Extensions (1)
System.Windows.Forms (522)
System\Resources\AssemblyNamesTypeResolutionService.cs (6)
14private ConcurrentDictionary<string, Type>? _cachedTypes;
72public Type? GetType(string name) => GetType(name, true);
74public Type? GetType(string name, bool throwOnError) => GetType(name, throwOnError, false);
76public Type? GetType(string name, bool throwOnError, bool ignoreCase)
80if (_cachedTypes.TryGetValue(name, out Type? result) && result is not null)
88result = Type.GetType(name, false, ignoreCase);
System\Resources\ResXDataNode.cs (15)
47private Func<Type?, string>? _typeNameConverter;
76public ResXDataNode(string name, object? value, Func<Type?, string>? typeNameConverter)
83Type valueType = (value is null) ? typeof(object) : value.GetType();
105public ResXDataNode(string name, ResXFileRef fileRef, Func<Type?, string>? typeNameConverter)
119Type? nodeType = null;
238Type valueType = value?.GetType() ?? typeof(object);
291Func<Type?, string>? typeNameConverter)
347Type type = ResolveTypeName(typeName);
380Type ResolveTypeName(string typeName)
382if (ResolveType(typeName, typeResolver) is not Type type)
528Type? objectType = null;
559Type? type = _nodeInfo.MimeType == ResXResourceWriter.BinSerializedObjectMimeType
664private static Type? ResolveType(string typeName, ITypeResolutionService? typeResolver)
666Type? resolvedType = null;
686return resolvedType ?? Type.GetType(typeName, throwOnError: false);
System\Windows\Forms\Controls\DataGridView\DataGridViewCellFormattingEventArgs.cs (1)
12Type? desiredType,
System\Windows\Forms\Controls\DataGridView\DataGridViewCellParsingEventArgs.cs (1)
12Type? desiredType,
System\Windows\Forms\Internal\Formatter.cs (20)
14private static readonly Type s_stringType = typeof(string);
15private static readonly Type s_booleanType = typeof(bool);
16private static readonly Type s_checkStateType = typeof(CheckState);
31Type targetType,
55Type oldTargetType = targetType;
88Type targetType,
137Type sourceType = value.GetType();
239Type targetType,
240Type sourceType,
249Type oldTargetType = targetType;
277Type targetType,
278Type sourceType,
379private static object ChangeType(object value, Type type, IFormatProvider? formatInfo)
419private static string GetCantConvertMessage(object? value, Type targetType)
443public static object? InvokeStringParseMethod(object? value, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type targetType, IFormatProvider? formatInfo)
501public static object? NullData(Type type, object? dataSourceNullValue)
530public static Type NullableUnwrap(Type type)
537Type? underlyingType = Nullable.GetUnderlyingType(type);
551public static object? GetDefaultDataSourceNullValue(Type? type)
System\Windows\Forms\OLE\DataObject.Composition.Binder.cs (17)
22/// the <see cref="Type"/> parameter specified by the user is resolved automatically.
31private readonly Func<TypeName, Type>? _resolver;
37private static readonly Type[] s_intrinsicTypes =
108private static Dictionary<TypeName, Type>? s_knownTypes;
110private readonly Dictionary<TypeName, Type> _userTypes = new(TypeNameComparer.Default);
116/// <param name="type"><see cref="Type"/> that the user expects to read from the binary formatted stream.</param>
128public Binder(Type type, Func<TypeName, Type>? resolver, bool legacyMode)
159foreach (Type type in s_intrinsicTypes)
227public override Type? BindToType(string assemblyName, string typeName)
232if (GetCachedType(assemblyName, typeName, typeName: null) is Type type)
252private Type UseResolver(TypeName typeName)
261Type resolved = _resolver(typeName)
270private Type? GetCachedType(string assemblyName, string fullTypeName, TypeName? typeName)
276return s_knownTypes.TryGetValue(typeName, out Type? type)
283public Type GetType(TypeName typeName)
293return GetCachedType(fullName, typeName.FullName, typeName) is Type type ? type : UseResolver(typeName);
System\Windows\Forms\OLE\DataObject.Composition.NativeToWinFormsAdapter.cs (12)
97Func<TypeName, Type>? resolver,
130Func<TypeName, Type>? resolver,
241/// <see langword="true"/> if the managed object of <see cref="Type"/> <typeparamref name="T"/> was successfully
255Func<TypeName, Type>? resolver,
292Func<TypeName, Type>? resolver,
355Func<TypeName, Type>? resolver,
480Type type = typeof(T);
488Func<TypeName, Type>? resolver,
554public object? GetData(Type format) => GetData(format.FullName!);
555public bool GetDataPresent(Type format) => GetDataPresent(format.FullName!);
625public void SetData(Type format, object? data) { }
632Func<TypeName, Type> resolver,
System\Windows\Forms\OLE\DataObject.cs (7)
243public virtual object? GetData(Type format) => format is null ? null : GetData(format.FullName!);
249public virtual bool GetDataPresent(Type format) => format is not null && GetDataPresent(format.FullName!);
260public virtual void SetData(Type format, object? data) => _innerData.SetData(format, data);
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\ITypedDataObject.cs (9)
10/// Provides a format-independent mechanism for reading data of a specified <see cref="Type"/>.
16/// data of the specified <see cref="Type"/> is exchanged. Otherwise the APIs that specify a <see cref="Type"/> parameter
18/// interface, implement this interface as well. Otherwise the APIs that specify a <see cref="Type"/> parameter
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)"/>
54/// A user-provided function that defines a closure of <see cref="Type"/>s that can be retrieved from
82Func<TypeName, Type> resolver,
System.Windows.Forms.Analyzers.CSharp.Tests (1)
System.Windows.Forms.Design (449)
System\ComponentModel\Design\DesignerHost.cs (23)
27private static readonly Type[] s_defaultServices = [typeof(IDesignerHost), typeof(IContainer), typeof(IComponentChangeService), typeof(IDesignerLoaderHost2)];
80foreach (Type t in s_defaultServices)
89foreach (Type t in s_defaultServices)
134Type type = TypeDescriptor.GetProvider(component).GetReflectionType(typeof(object));
397Type reflectType = TypeDescriptor.GetReflectionType(component);
456foreach (Type t in s_defaultServices)
465foreach (Type t in s_defaultServices)
497protected override object? GetService(Type service)
928IComponent IDesignerHost.CreateComponent(Type componentType) =>
931IComponent IDesignerHost.CreateComponent(Type componentType, string name)
1039Type? IDesignerHost.GetType(string typeName)
1048return Type.GetType(typeName);
1207MethodInfo? IReflect.GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) =>
1226PropertyInfo? IReflect.GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers) =>
1263Type IReflect.UnderlyingSystemType => typeof(IDesignerHost).UnderlyingSystemType;
1265void IServiceContainer.AddService(Type serviceType, object serviceInstance)
1271void IServiceContainer.AddService(Type serviceType, object serviceInstance, bool promote)
1277void IServiceContainer.AddService(Type serviceType, ServiceCreatorCallback callback)
1283void IServiceContainer.AddService(Type serviceType, ServiceCreatorCallback callback, bool promote)
1289void IServiceContainer.RemoveService(Type serviceType)
1295void IServiceContainer.RemoveService(Type serviceType, bool promote)
1301object? IServiceProvider.GetService(Type serviceType) => GetService(serviceType);
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (34)
33protected virtual object DeserializeInstance(IDesignerSerializationManager manager, Type type, object?[]? parameters, string? name, bool addToContainer)
62Type? t = manager.GetType(typeref.BaseType);
112Type type = instance.GetType();
141protected static Type GetReflectionTypeFromTypeHelper(IDesignerSerializationManager manager, Type type)
178private static bool TryGetTargetFrameworkProviderForType(IServiceProvider provider, Type type, [NotNullWhen(true)] out TypeDescriptionProvider? targetProvider)
191protected static Type GetReflectionTypeHelper(IDesignerSerializationManager manager, object instance)
296protected static AttributeCollection GetAttributesFromTypeHelper(IDesignerSerializationManager manager, Type type)
543if (lhs is Type type)
568Type fieldType = f.FieldType;
705Type? type = manager.GetType(GetTypeNameFromCodeTypeReference(manager, objectCreateEx.CreateType));
730Type[] paramTypes = new Type[delegateParams.Length];
803if (target is Type t)
865if (targetObject is Type t)
884Type? castType = manager.GetType(GetTypeNameFromCodeTypeReference(manager, castExpr.TargetType));
934Type? targetType = manager.GetType(GetTypeNameFromCodeTypeReference(manager, castEx.TargetType));
953Type? arrayType = manager.GetType(GetTypeNameFromCodeTypeReference(manager, arrayCreateEx.CreateType));
1495Type? targetAsType = target as Type;
1571if (rhs is Type rhsType && rhsType.UnderlyingSystemType is not null)
1768Type desiredSerializerType = typeof(CodeDomSerializer);
1774Type? realSerializerType = vsManager is not null
1794Type? realSerializerType = vsManager is not null
1815Type? serializerType = vsManager is not null
1830Type? t = value?.GetType();
1841protected CodeDomSerializer? GetSerializer(IDesignerSerializationManager manager, Type valueType)
1997Type expressionType = descriptor.MemberInfo!.DeclaringType!;
2035Type targetType = value.GetType();
2066Type targetType = GetReflectionTypeHelper(manager, value);
2692Type? type = GetType(manager, fieldReferenceEx.FieldName, names);
2742Type? type = GetType(manager, variableReferenceEx.VariableName, names);
2790internal static Type? GetType(IDesignerSerializationManager manager, string name, Dictionary<string, string>? names)
2792Type? type = null;
System\Drawing\Design\ToolboxItem.cs (11)
44public ToolboxItem(Type? toolType) : this()
258Type? createType = GetType(host, AssemblyName, TypeName, true);
437public Type? GetType(IDesignerHost? host) => GetType(host, AssemblyName, TypeName, false);
446protected virtual Type? GetType(IDesignerHost? host, AssemblyName? assemblyName, string typeName, bool reference)
448Type? type = null;
466type ??= Type.GetType(typeName);
537type ??= Type.GetType(typeName, false);
546public virtual void Initialize(Type? type)
556Type? parentType = type;
639private static AssemblyName? GetNonRetargetedAssemblyName(Type type, AssemblyName policiedAssemblyName)
743protected void ValidatePropertyType(string propertyName, object? value, Type expectedType, bool allowNull)
System\Windows\Forms\Design\ControlDesigner.DesignerControlCollectionCodeDomSerializer.cs (1)
20Type targetType,
System\Windows\Forms\Design\DesignBindingPicker.cs (12)
132private static readonly Type s_runtimeType = typeof(object).GetType().GetType();
730if (dataSource is Type)
1017Type? type = GetType(descriptor.TypeName, true, true);
1046else if (_selectedItem.DataSource is Type && _selectedItem.DataSource is Type type_ &&
1065Type? dataSourceType = GetType(dataSourceDescriptor.TypeName, false, false);
1156Type? dsType = GetType(dataSourceDescriptor.TypeName, true, true);
1365Type? type = (dataSource as Type);
1396private Type? GetType(string name, bool throwOnError, bool ignoreCase)
1404return Type.GetType(name, throwOnError, ignoreCase);
1418Type? dsType = GetType(dataSourceDescriptor.TypeName, true, true);
System\Windows\Forms\Design\DocumentDesigner.DocumentInheritanceService.cs (1)
37Type memberType;
System.Windows.Forms.Design.Tests (202)
System.Windows.Forms.Interop.Tests (1)
System.Windows.Forms.Primitives (13)
System.Windows.Forms.Primitives.TestUtilities (10)
System.Windows.Forms.Tests (516)
System.Windows.Forms.TestUtilities (2)
System.Windows.Forms.UI.IntegrationTests (1)
System.Xaml (380)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\ReflectionHelper.cs (25)
82internal static Type GetQualifiedType(string typeName)
91return Type.GetType(nameFrags[0]);
121internal static bool IsNullableType(Type type)
126internal static bool IsInternalType(Type type)
128Type origType = type;
148internal static bool IsPublicType(Type type)
165internal static Type GetFrameworkType(string assemblyName, Type type)
189internal static Type GetSystemType(Type type)
215internal static string GetTypeConverterAttributeData(Type type, out Type converterType)
221internal static string GetTypeConverterAttributeData(MemberInfo mi, out Type converterType)
229private static string GetCustomAttributeData(MemberInfo mi, Type attrType, out Type typeValue)
252private static string GetCustomAttributeData(IList<CustomAttributeData> list, Type attrType, out Type typeValue, bool allowTypeAlso, bool allowZeroArgs)
273internal static string GetCustomAttributeData(Type t,
274Type attrType,
277out Type typeValue)
281Type currentType = t;
316Type attrType,
317out Type typeValue,
340if (attrValue is null && allowTypeAlso && tca.ArgumentType == typeof(Type))
343typeValue = tca.Value as Type;
System\Xaml\Runtime\ClrObjectRuntime.cs (12)
74Type type = xamlType.UnderlyingType;
103protected virtual object InvokeFactoryMethod(Type type, string methodName, object[] args)
109protected MethodInfo GetFactoryMethod(Type type, string methodName, object[] args, BindingFlags flags)
114factory = type.GetMethod(methodName, flags, null, Type.EmptyTypes, null);
134return Type.DefaultBinder.BindToMethod(
185public override bool CanConvertTo(ITypeDescriptorContext context, TypeConverter converter, Type type)
372Type keyType = dictionaryType.KeyType.UnderlyingType;
373Type itemType = dictionaryType.ItemType.UnderlyingType;
374Type genericKVP = typeof(KeyValuePair<,>).MakeGenericType(keyType, itemType);
375Type genericIEnumerator = typeof(IEnumerator<>).MakeGenericType(genericKVP);
380var method = openMethod.MakeGenericMethod(new Type[] { keyType, itemType });
659protected virtual Delegate CreateDelegate(Type delegateType, object target, string methodName)
System\Xaml\Runtime\DynamicMethodRuntime.cs (41)
40delegate Delegate DelegateCreator(Type delegateType, object target, string methodName);
44Type _localType;
59Dictionary<Type, object> _converterInstances;
60Dictionary<Type, DelegateCreator> _delegateCreators;
99private Dictionary<Type, object> ConverterInstances
105_converterInstances = new Dictionary<Type, object>();
111private Dictionary<Type, DelegateCreator> DelegateCreators
117_delegateCreators = new Dictionary<Type, DelegateCreator>();
139Type clrType = ts.ConverterType;
165Type delegateType;
174protected override Delegate CreateDelegate(Type delegateType, object target, string methodName)
177Type targetType = target.GetType();
191private object CreateInstanceWithCtor(Type type, object[] args)
196ctor = type.GetConstructor(BF_AllInstanceMembers, null, Type.EmptyTypes, null);
214protected override object InvokeFactoryMethod(Type type, string methodName, object[] args)
260private DelegateCreator CreateDelegateCreator(Type targetType)
269helperFlags, null, new Type[] { typeof(Type), typeof(string) }, null);
280typeof(Delegate), typeof(Type), typeof(object), typeof(string));
297typeof(Delegate), typeof(Type), typeof(object), typeof(string));
305new Type[] { typeof(Type), typeof(object), typeof(string) }, null);
353Type[] paramTypes = new Type[parameters.Length];
357Type paramType = parameters[i].ParameterType;
365Type elementType = paramType.GetElementType();
410Type targetType = getter.IsStatic ? getter.GetParameters()[0].ParameterType : GetTargetType(getter);
429Type targetType = setter.IsStatic ? parameters[0].ParameterType : GetTargetType(setter);
430Type valueType = setter.IsStatic ? parameters[1].ParameterType : parameters[0].ParameterType;
443private DynamicMethod CreateDynamicMethod(string name, Type returnType, params Type[] argTypes)
455private Type GetTargetType(MethodInfo instanceMethod)
457Type declaringType = instanceMethod.DeclaringType;
488private static void Emit_CastTo(ILGenerator ilGenerator, Type toType)
500private static void Emit_BoxIfValueType(ILGenerator ilGenerator, Type type)
548private void Emit_LateBoundInvoke(ILGenerator ilGenerator, Type targetType, string methodName,
578s_InvokeMemberMethod = typeof(Type).GetMethod(KnownStrings.InvokeMember,
579new Type[] { typeof(string), typeof(BindingFlags), typeof(Binder), typeof(object), typeof(object[]) });
584private void Emit_TypeOf(ILGenerator ilGenerator, Type type)
589s_GetTypeFromHandleMethod = typeof(Type).GetMethod(
591null, new Type[] { typeof(RuntimeTypeHandle) }, null);
System\Xaml\Schema\CollectionReflector.cs (33)
15private static Type[] s_typeOfObjectArray;
16private static Type[] s_typeOfTwoObjectArray;
30internal static XamlCollectionKind LookupCollectionKind(Type type, out MethodInfo addMethod)
80internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collectionKind)
105private static bool TryGetICollectionAdder(Type type, out MethodInfo addMethod)
108Type genericICollection = GetGenericInterface(type, typeof(ICollection<>), out hasMoreThanOneICollection);
123private static bool TryGetCollectionAdder(Type type, bool mayBeICollection, out MethodInfo addMethod)
169private static bool TryGetIDictionaryAdder(Type type, out MethodInfo addMethod)
172Type genericIDictionary = GetGenericInterface(type, typeof(IDictionary<,>), out hasMoreThanOneIDictionary);
187private static bool TryGetDictionaryAdder(Type type, bool mayBeIDictionary, out MethodInfo addMethod)
231internal static MethodInfo GetAddMethod(Type type, Type contentType)
233return GetMethod(type, KnownStrings.Add, new Type[] { contentType });
236internal static MethodInfo GetEnumeratorMethod(Type type)
248internal static MethodInfo GetIsReadOnlyMethod(Type collectionType, Type itemType)
250Type genericICollection = typeof(ICollection<>).MakeGenericType(itemType);
259private static MethodInfo LookupEnumeratorMethod(Type type)
261MethodInfo result = GetMethod(type, KnownStrings.GetEnumerator, Type.EmptyTypes);
269private static Type GetGenericInterface(Type type, Type interfaceType, out bool hasMultiple)
271Type result = null;
277foreach (Type currentInterface in type.GetInterfaces())
293private static MethodInfo GetAddMethod(Type type, int paramCount, out bool hasMoreThanOne)
324private static BindingFlags GetBindingFlags(Type type)
336private static MethodInfo GetMethod(Type type, string name, Type[] argTypes)
346private static MethodInfo GetPublicMethod(Type type, string name, int argCount)
360private static Type[] TypeOfObjectArray
366s_typeOfObjectArray = new Type[] { typeof(object) };
372private static Type[] TypeOfTwoObjectArray
378s_typeOfTwoObjectArray = new Type[] { typeof(object), typeof(object) };
System\Xaml\Schema\Reflector.cs (33)
43public bool IsAttributePresent(Type attributeType)
62public string GetAttributeString(Type attributeType, out bool checkedInherited)
128public IReadOnlyDictionary<char,char> GetBracketCharacterAttributes(Type attributeType)
162public T? GetAttributeValue<T>(Type attributeType) where T : struct
200public Type GetAttributeType(Type attributeType)
212return Type.GetType(typeName);
241public Type[] GetAttributeTypes(Type attributeType, int count)
253Type converterType = Type.GetType(tca.LoaderTypeName);
254Type contentType = Type.GetType(tca.ContentTypeName);
255return new Type[] { converterType, contentType };
273public List<T> GetAllAttributeContents<T>(Type attributeType)
377private static bool TypesAreEqual(Type userType, Type builtInType)
389private ReadOnlyDictionary<char, char> TokenizeBracketCharacters(Type attributeType)
410private Type ExtractType(CustomAttributeData cad)
412Type result = null;
419ThrowInvalidMetadata(cad, 1, typeof(Type));
424private Type[] ExtractTypes(CustomAttributeData cad, int count)
428ThrowInvalidMetadata(cad, count, typeof(Type));
430Type[] result = new Type[count];
436ThrowInvalidMetadata(cad, count, typeof(Type));
442private Type ExtractType(CustomAttributeTypedArgument arg)
444if (arg.ArgumentType == typeof(Type))
446return (Type)arg.Value;
451return Type.GetType(typeName);
479private CustomAttributeData GetAttribute(Type attributeType)
492private void GetAttributes(Type attributeType, IList<CustomAttributeData> cads)
504protected void ThrowInvalidMetadata(CustomAttributeData cad, int expectedCount, Type expectedType)
System\Xaml\XamlSchemaContext.cs (15)
465private ConcurrentDictionary<Type, XamlType> _masterTypeList;
466private ConcurrentDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object> _masterValueConverterList;
488private ConcurrentDictionary<Type, XamlType> MasterTypeList
493Interlocked.CompareExchange(ref _masterTypeList, CreateDictionary<Type, XamlType>(ReferenceEqualityComparer.Instance), null);
499private ConcurrentDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object> MasterValueConverterList
504Interlocked.CompareExchange(ref _masterValueConverterList, CreateDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object>(), null);
520public virtual XamlType GetXamlType(Type type)
527internal XamlType GetXamlType(Type type, string alias)
592Type converterType, XamlType targetType)
595var key = new ReferenceEqualityTuple<Type, XamlType, Type>(converterType, targetType, typeof(TConverterBase));
890Type clrType = type.UnderlyingType;
System\Xaml\XamlType.cs (37)
32private NullableReference<Type> _underlyingType;
57public XamlType(Type underlyingType, XamlSchemaContext schemaContext)
62public XamlType(Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
67internal XamlType(string alias, Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker, TypeReflector reflector)
152public Type UnderlyingType
167internal NullableReference<Type> UnderlyingTypeInternal
415Type baseUnderlyingType = xamlType.UnderlyingType;
419Type curUnderlyingType = curType.UnderlyingType;
591Type underlyingType = UnderlyingType;
622internal ConstructorInfo GetConstructor(Type[] paramTypes)
634MethodBase result = Type.DefaultBinder.SelectMethod(ConstructorBindingFlags, ctorArray, paramTypes, null);
642Type attributeType = null;
705Type underlyingType = UnderlyingType;
735Type underlyingType = UnderlyingType;
745ConstructorInfo defaultCtor = underlyingType.GetConstructor(ConstructorBindingFlags, null, Type.EmptyTypes, null);
773List<Type> wrapperTypes = _reflector.GetAllAttributeContents<Type>(typeof(ContentWrapperAttribute));
777foreach (Type wrapperType in wrapperTypes)
810Type[] loaderTypes = _reflector.GetAttributeTypes(typeof(XamlDeferLoadAttribute), 2);
825Type underlyingType = UnderlyingType;
932Type result = null;
965Type returnType = _reflector.GetAttributeType(typeof(MarkupExtensionReturnTypeAttribute));
1104protected virtual Type LookupUnderlyingType()
1111Type underlyingType = UnderlyingType;
1151Type converterType = _reflector.GetAttributeType(typeof(TypeConverterAttribute));
1167Type underlyingType = UnderlyingType;
1181Type[] typeArgs = underlyingType.GetGenericArguments();
1195Type converterType = _reflector.GetAttributeType(typeof(ValueSerializerAttribute));
1211Type underlyingType = UnderlyingType;
1221Type[] typeArgs = underlyingType.GetGenericArguments();
1483private static ReadOnlyCollection<XamlType> GetTypeArguments(Type type, XamlSchemaContext schemaContext)
1485Type genericType = type;
1494Type[] types = genericType.GetGenericArguments();
1503private static string GetTypeName(Type type)
1571XamlType typeOfType = SchemaContext.GetXamlType(typeof(Type));
1585Type type = param.ParameterType;
1681private bool TryGetAttributeString(Type attributeType, out string result)
System.Xaml.Tests (53)
System\Windows\Markup\ValueSerializerTests.cs (15)
117yield return new object[] { typeof(Type) };
126public void GetSerializerFor_WellKnownType_ReturnsExpected(Type type)
197public void GetSerializerFor_NoSuchTypeConverterAttribute_ReturnsNull(Type type)
228Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!));
229Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!, null));
283public void GetSerializerFor_DescriptorHasNoConverter_ReturnsNull(Type type)
441public ValueSerializer? GetValueSerializerFor(Type type) => SerializerResult;
451public object GetService(Type serviceType) => throw new NotImplementedException();
461public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
467public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
478public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
486public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
491public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
499public override bool CanConvertTo(ITypeDescriptorContext? context, Type? destinationType)
504public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
UIAutomationClient (12)
UnitTests.Common (7)
VBCSCompiler.UnitTests (1)
VisualBasicRuntimeTest (2)
WindowsFormsIntegration (2)
WinFormsControlsTest (2)
XmlFileLogger (4)
XmlFormattersWebSite (2)
xunit.assert (77)
xunit.console (5)
Xunit.NetCore.Extensions (12)