3 types derived from Type
System.Private.CoreLib (3)
22583 references to Type
ApiExplorerWebSite (2)
AssemblyStripper (54)
.packages\microsoft.dotnet.cilstrip.sources\9.0.0-beta.24312.1\contentFiles\cs\netstandard2.0\Mono.Cecil\ReflectionHelper.cs (33)
72 public static string GetTypeSignature (Type t)
97 Type [] genArgs = GetGenericArguments (t);
128 public static bool IsGenericType (Type t)
133 static bool IsGenericParameter (Type t)
138 static bool IsGenericTypeDefinition (Type t)
143 static bool IsGenericTypeSpec (Type t)
148 static Type GetGenericTypeDefinition (Type t)
150 return (Type) t.GetType ().GetMethod ("GetGenericTypeDefinition").Invoke (t, null);
153 static Type [] GetGenericArguments (Type t)
155 return (Type []) t.GetType ().GetMethod ("GetGenericArguments").Invoke (t, null);
158 GenericInstanceType GetGenericType (Type t, TypeReference element, ImportContext context)
161 foreach (Type genArg in GetGenericArguments (t))
167 static bool GenericParameterOfMethod (Type t)
172 static GenericParameter GetGenericParameter (Type t, ImportContext context)
187 TypeReference GetTypeSpec (Type t, ImportContext context)
195 t = (Type) t.GetType ().GetMethod ("GetGenericTypeDefinition").Invoke (t, null);
202 t = (Type) s.Pop ();
218 TypeReference AdjustReference (Type type, TypeReference reference)
224 Type [] parameters = GetGenericArguments (type);
232 public TypeReference ImportSystemType (Type t, ImportContext context)
252 foreach (Type genParam in GetGenericArguments (t))
261 static string GetMethodBaseSignature (SR.MethodBase meth, Type declaringType, Type retType)
271 Type [] genArgs = GetGenericArguments (meth as SR.MethodInfo);
305 static Type [] GetGenericArguments (SR.MethodInfo mi)
307 return (Type []) mi.GetType ().GetMethod ("GetGenericArguments").Invoke (mi, null);
321 foreach (Type genArg in GetGenericArguments (mi))
327 MethodReference ImportMethodBase (SR.MethodBase mb, Type retType, ImportContext context)
332 Type originalDecType = mb.DeclaringType;
333 Type declaringTypeDef = originalDecType;
362 foreach (Type genParam in GetGenericArguments (mb as SR.MethodInfo))
BasicWebSite (3)
Binding.UDS.IntegrationTests (3)
Client.ExpectedExceptions.IntegrationTests (2)
Contract.Data.IntegrationTests (4)
Contract.Fault.IntegrationTests (1)
ControllersFromServicesWebSite (1)
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)
41public List<Type> ReferencedTypes { get; private set; }
43public List<Type> ReferencedCollectionTypes { get; private set; }
102this.ReferencedTypes = new List<Type>();
104this.ReferencedCollectionTypes = new List<Type>();
845private static Dictionary<string, Type> AddSpecifiedTypesToDictionary(IList<string> typeArgs, string cmd)
847Dictionary<string, Type> specifiedTypes = new Dictionary<string, Type>(typeArgs.Count);
859private void AddReferencedTypesFromAssembly(Assembly assembly, Dictionary<string, Type> foundCollectionTypes, Dictionary<string, Type> excludedTypes)
861foreach (Type type in TypeLoader.LoadTypes(assembly, this.Verbosity.Value))
879private void AddStdLibraries(Dictionary<string, Type> foundCollectionTypes, Dictionary<string, Type> excludedTypes)
881List<Type> coreTypes = new List<Type>
888foreach (var type in coreTypes)
898private static bool IsTypeSpecified(Type type, Dictionary<string, Type> specifiedTypes, string cmd)
904if (specifiedTypes.TryGetValue(type.FullName, out Type foundType))
932private void AddReferencedCollectionTypes(IList<string> collectionTypesArgs, Dictionary<string, Type> foundCollectionTypes)
939Type foundType = null;
958foundType = 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.Arcade.Common (1)
Microsoft.Arcade.Test.Common (2)
Microsoft.AspNetCore (1)
Microsoft.AspNetCore.Analyzer.Testing (1)
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 (122)
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 (8)
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);
1110readonly IList<(string Template, Type Handler)> _routeTemplates = new List<(string, Type)>();
1111readonly Type _handler = typeof(object);
1113public 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.ConcurrencyLimiter.Microbenchmarks (7)
Microsoft.AspNetCore.Connections.Abstractions (6)
Microsoft.AspNetCore.DataProtection (37)
Microsoft.AspNetCore.DataProtection.Abstractions (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.EntityFrameworkCore.Tests (6)
Microsoft.AspNetCore.Diagnostics.Tests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (91)
Microsoft.AspNetCore.Grpc.JsonTranscoding.IntegrationTests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (11)
Microsoft.AspNetCore.Grpc.Microbenchmarks (7)
Microsoft.AspNetCore.Grpc.Swagger (21)
Microsoft.AspNetCore.Grpc.Swagger.Tests (3)
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 (62)
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 (6)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Connections.Client (2)
Microsoft.AspNetCore.Http.Extensions (269)
RequestDelegateFactory.cs (28)
57private static readonly MethodInfo GetRequiredServiceMethod = typeof(ServiceProviderServiceExtensions).GetMethod(nameof(ServiceProviderServiceExtensions.GetRequiredService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider) })!;
58private static readonly MethodInfo GetServiceMethod = typeof(ServiceProviderServiceExtensions).GetMethod(nameof(ServiceProviderServiceExtensions.GetService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider) })!;
59private static readonly MethodInfo GetRequiredKeyedServiceMethod = typeof(ServiceProviderKeyedServiceExtensions).GetMethod(nameof(ServiceProviderKeyedServiceExtensions.GetRequiredKeyedService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider), typeof(object) })!;
60private static readonly MethodInfo GetKeyedServiceMethod = typeof(ServiceProviderKeyedServiceExtensions).GetMethod(nameof(ServiceProviderKeyedServiceExtensions.GetKeyedService), BindingFlags.Public | BindingFlags.Static, new Type[] { typeof(IServiceProvider), typeof(object) })!;
67private static readonly MethodInfo ArrayEmptyOfObjectMethod = typeof(Array).GetMethod(nameof(Array.Empty), BindingFlags.Public | BindingFlags.Static)!.MakeGenericMethod(new Type[] { typeof(object) });
348var returnType = methodInfo.ReturnType;
504private static Expression MapHandlerReturnTypeToValueTask(Expression methodCall, Type returnType)
537var typeArg = coercedAwaitableInfo.AwaitableInfo.ResultType;
543var typeArg = coercedAwaitableInfo.AwaitableInfo.ResultType;
604var constructorType = factoryContext.ArgumentTypes?.Length switch
645factoryContext.ArgumentTypes = new Type[parameters.Length];
917private static Expression CreateParamCheckingResponseWritingMethodCall(Type returnType, RequestDelegateFactoryContext factoryContext)
1005private static void PopulateBuiltInResponseTypeMetadata(Type returnType, EndpointBuilder builder)
1033private static Expression AddResponseWritingToMethodCall(Expression methodCall, Type returnType, RequestDelegateFactoryContext factoryContext)
1087var typeArg = returnType.GetGenericArguments()[0];
1135var typeArg = returnType.GetGenericArguments()[0];
1342[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type bodyType,
1397private static object? CreateValueType(Type t) => RuntimeHelpers.GetUninitializedObject(t);
1526private static Expression GetValueFromProperty(MemberExpression sourceExpression, PropertyInfo itemProperty, string key, Type? returnType = null)
1535var parameterType = parameter.ParameterType;
1646var targetParseType = parameter.ParameterType.IsArray ? parameter.ParameterType.GetElementType()! : parameter.ParameterType;
1648var underlyingNullableType = Nullable.GetUnderlyingType(targetParseType);
1651var nonNullableParameterType = underlyingNullableType ?? targetParseType;
1931private static Type? GetExpressionType(Type type) =>
1987private static void AddInferredAcceptsMetadata(RequestDelegateFactoryContext factoryContext, Type type, string[] contentTypes)
2585private static NotSupportedException GetUnsupportedReturnTypeException(Type returnType)
2865public 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)
18public Type AwaiterType { get; }
23public Type ResultType { get; }
27Type awaiterType,
32Type resultType,
47Type type,
53var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
61var awaiterType = getAwaiterMethod.ReturnType;
64var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
92var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\ParameterBindingMethodCache.cs (29)
40private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
41private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
42private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
61public bool HasTryParseMethod(Type type)
63var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
74public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
79Func<ParameterExpression, Expression, Expression>? Finder(Type type)
143Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
144Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
212(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
234var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
296var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
307public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
309static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
353private static ConstructorInfo? GetConstructor(Type type)
404private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
407foreach (var i in type.GetInterfaces())
425private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
436private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
450foreach (var implementedInterface in type.GetInterfaces())
474private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
485foreach (var implementedInterface in type.GetInterfaces())
507new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
514new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
526private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
562private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
703public ParameterLookupKey(string name, Type type)
710public 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 (123)
src\Shared\ParameterBindingMethodCache.cs (29)
40private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
41private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
42private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
61public bool HasTryParseMethod(Type type)
63var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
74public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
79Func<ParameterExpression, Expression, Expression>? Finder(Type type)
143Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
144Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
212(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
234var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
296var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
307public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
309static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
353private static ConstructorInfo? GetConstructor(Type type)
404private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
407foreach (var i in type.GetInterfaces())
425private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
436private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
450foreach (var implementedInterface in type.GetInterfaces())
474private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
485foreach (var implementedInterface in type.GetInterfaces())
507new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
514new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
526private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
562private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
703public ParameterLookupKey(string name, Type type)
710public 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 (35)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (28)
DefaultApiDescriptionProviderTest.cs (17)
171Type constraintType,
217Type constraintType,
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,
2293private ControllerActionDescriptor CreateActionDescriptor(string methodName = null, Type controllerType = null)
2807public List<Type> SupportedTypes { get; } = new List<Type>();
2816protected override bool CanReadType(Type type)
2835public List<Type> SupportedTypes { get; } = new List<Type>();
2842protected override bool CanWriteType(Type type)
2875public Type Type { get; set; }
2900public Type RequestType => null;
2907public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
Microsoft.AspNetCore.Mvc.Core (414)
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)
18public Type AwaiterType { get; }
23public Type ResultType { get; }
27Type awaiterType,
32Type resultType,
47Type type,
53var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
61var awaiterType = getAwaiterMethod.ReturnType;
64var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
92var 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 (126)
Schemas\JsonSchemaMapper\JsonSchemaMapper.cs (11)
42public static JsonObject GetJsonSchema(this JsonSerializerOptions options, Type type, JsonSchemaMapperConfiguration? configuration = null)
213Type? parentType = null,
223Type? parentPolymorphicType = null,
228Type type = typeInfo.Type;
268if (Nullable.GetUnderlyingType(type) is Type nullableElementType)
493Type elementType = GetElementType(typeInfo);
536Type valueType = GetElementType(typeInfo);
629private readonly Dictionary<(Type, JsonConverter? CustomConverter, bool IsNullableReferenceType, JsonNumberHandling? CustomNumberHandling), string>? _generatedTypePaths;
678public readonly string? GetOrAddSchemaPointer(Type type, JsonConverter? converter, bool isNullableReferenceType, JsonNumberHandling? numberHandling)
707public readonly void HandleGenerationCallback(JsonObject schema, JsonTypeInfo typeInfo, Type? parentType, JsonPropertyInfo? propertyInfo, ParameterInfo? parameterInfo)
891private static readonly Dictionary<Type, SimpleTypeJsonSchema> s_simpleTypeInfo = new()
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
18public Type AwaiterType { get; }
23public Type ResultType { get; }
27Type awaiterType,
32Type resultType,
47Type type,
53var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
61var awaiterType = getAwaiterMethod.ReturnType;
64var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
92var getResultMethod = awaiterType.GetMethod("GetResult", Everything, Type.EmptyTypes);
src\Shared\ParameterBindingMethodCache.cs (29)
40private readonly ConcurrentDictionary<Type, Func<ParameterExpression, Expression, Expression>?> _stringMethodCallCache = new();
41private readonly ConcurrentDictionary<Type, (Func<ParameterInfo, Expression>?, int)> _bindAsyncMethodCallCache = new();
42private readonly ConcurrentDictionary<Type, (ConstructorInfo?, ConstructorParameter[])> _constructorCache = new();
61public bool HasTryParseMethod(Type type)
63var nonNullableParameterType = Nullable.GetUnderlyingType(type) ?? type;
74public Func<ParameterExpression, Expression, Expression>? FindTryParseMethod(Type type)
79Func<ParameterExpression, Expression, Expression>? Finder(Type type)
143Type t when t == typeof(DateTime) => DateTimeStyles.AdjustToUniversal | DateTimeStyles.AllowWhiteSpaces,
144Type t when t == typeof(DateTimeOffset) => DateTimeStyles.AssumeUniversal | DateTimeStyles.AllowWhiteSpaces,
212(Func<ParameterInfo, Expression>?, int) Finder(Type nonNullableParameterType)
234var valueTaskResultType = methodInfo.ReturnType.GetGenericArguments()[0];
296var nonNullableParameterType = Nullable.GetUnderlyingType(parameter.ParameterType) ?? parameter.ParameterType;
307public (ConstructorInfo?, ConstructorParameter[]) FindConstructor(Type type)
309static (ConstructorInfo? constructor, ConstructorParameter[] parameters) Finder(Type type)
353private static ConstructorInfo? GetConstructor(Type type)
404private static MethodInfo? GetIBindableFromHttpContextMethod(Type type)
407foreach (var i in type.GetInterfaces())
425private static bool TryGetExplicitIParsableTryParseMethod(Type type, out MethodInfo methodInfo)
436private MethodInfo? GetStaticMethodFromHierarchy(Type type, string name, Type[] parameterTypes, Func<MethodInfo, bool> validateReturnType)
450foreach (var implementedInterface in type.GetInterfaces())
474private static MethodInfo? GetAnyMethodFromHierarchy(Type type, string name)
485foreach (var implementedInterface in type.GetInterfaces())
507new[] { typeof(Type), typeof(string), typeof(object).MakeByRefType() });
514new[] { typeof(string), Type.MakeGenericMethodParameter(0).MakeByRefType() });
526private static bool TryGetDateTimeTryParseMethod(Type type, [NotNullWhen(true)] out MethodInfo? methodInfo)
562private static bool TryGetNumberStylesTryGetMethod(Type type, [NotNullWhen(true)] out MethodInfo? method, [NotNullWhen(true)] out NumberStyles? numberStyles)
703public ParameterLookupKey(string name, Type type)
710public 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 (5)
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 (144)
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
18public Type AwaiterType { get; }
23public Type ResultType { get; }
27Type awaiterType,
32Type resultType,
47Type type,
53var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
61var awaiterType = getAwaiterMethod.ReturnType;
64var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
92var 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 (20)
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)
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)
180new TheoryData<Type, string>
190public void GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSet(Type type, string expected)
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 (51)
HubConnection.cs (14)
341public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task<object?>> handler, object state)
374public virtual IDisposable On(string methodName, Type[] parameterTypes, Func<object?[], object, Task> handler, object state)
420public virtual async Task<ChannelReader<object?>> StreamAsChannelCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default)
442public virtual async Task<object?> InvokeCoreAsync(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken = default)
687private async Task<ChannelReader<object?>> StreamAsChannelCoreAsyncCore(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken)
840if (ReflectionHelper.TryGetStreamType(reader.GetType(), out var channelGenericType))
861private void InvokeStreamMethod(MethodInfo methodInfo, Type[] genericTypes, ConnectionState connectionState, string streamId, object reader, CancellationTokenSource tokenSource)
962private async Task<object?> InvokeCoreAsyncCore(string methodName, Type returnType, object?[] args, CancellationToken cancellationToken)
1919public Type[] ParameterTypes { get; }
1924public InvocationHandler(Type[] parameterTypes, Func<object?[], object, Task> callback, object state)
2208Type IInvocationBinder.GetReturnType(string invocationId)
2218Type IInvocationBinder.GetStreamItemType(string invocationId)
2230IReadOnlyList<Type> IInvocationBinder.GetParameterTypes(string methodName)
2235return 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)
14private static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], TResult> handler)
33public static IDisposable On<TResult>(this HubConnection hubConnection, string methodName, Type[] parameterTypes, Func<object?[], Task<TResult>> handler)
55return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
71return hubConnection.On(methodName, Type.EmptyTypes, args => handler());
Internal\InvocationRequest.cs (6)
19public Type ResultType { get; }
24protected InvocationRequest(CancellationToken cancellationToken, Type resultType, string invocationId, ILogger logger, HubConnection hubConnection)
37public static InvocationRequest Invoke(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection, out Task<object?> result)
44public static InvocationRequest Stream(CancellationToken cancellationToken, Type resultType, string invocationId,
72public Streaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection)
132public NonStreaming(CancellationToken cancellationToken, Type resultType, string invocationId, ILoggerFactory loggerFactory, HubConnection hubConnection)
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 (130)
src\Shared\ObjectMethodExecutor\AwaitableInfo.cs (9)
18public Type AwaiterType { get; }
23public Type ResultType { get; }
27Type awaiterType,
32Type resultType,
47Type type,
53var getAwaiterMethod = type.GetMethod("GetAwaiter", Everything, Type.EmptyTypes);
61var awaiterType = getAwaiterMethod.ReturnType;
64var isCompletedProperty = awaiterType.GetProperty("IsCompleted", Everything, binder: null, returnType: typeof(bool), types: Type.EmptyTypes, modifiers: null);
92var 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 (20)
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 (8)
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 (163)
Evaluation\Expander.cs (24)
2254internal static ItemTransformFunction GetItemTransformFunction(IElementLocation elementLocation, string functionName, Type itemType)
3161public Type ReceiverType { get; set; }
3229private Type _receiverType;
3274Type receiverType,
3379var receiverType = GetTypeForStaticMethod(typeName, functionBuilder.Name);
3431var receiverType = propertyValue?.GetType() ?? typeof(string);
3597functionResult = _receiverType.InvokeMember(_methodMethodName, _bindingFlags, Type.DefaultBinder, objectInstance, args, CultureInfo.InvariantCulture);
4470private bool ElementsOfType(object[] args, Type type)
4911private static Type GetTypeForStaticMethod(string typeName, string simpleMethodName)
4913Type receiverType;
4914Tuple<string, Type> cachedTypeInformation;
4942receiverType = Type.GetType(assemblyQualifiedTypeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
4950AvailableStaticMethods.TryAdd(typeName, simpleMethodName, new Tuple<string, Type>(assemblyQualifiedTypeName, receiverType));
4957receiverType = Type.GetType(typeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
4991AvailableStaticMethods.TryAdd(typeName, new Tuple<string, Type>(typeName, receiverType));
5001private static Type GetTypeFromAssemblyUsingNamespace(string typeName)
5019Type foundType = GetTypeFromAssembly(typeName, candidateAssemblyName);
5042private static Type GetTypeFromAssembly(string typeName, string candidateAssemblyName)
5044Type objectType = null;
5257Type enumType = parameters[n].ParameterType;
5369private static bool IsStaticMethodAvailable(Type receiverType, string methodName)
5406Type[] types = new Type[_arguments.Length];
5536? 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 (88)
Engine\Expander.cs (22)
586Type valueType = valueToConvert.GetType();
951private Type objectType;
986public Function(Type objectType, string expression, string expressionRootName, string name, string[] arguments, BindingFlags bindingFlags, string remainder)
1012public Type ObjectType
1026Type objectType = null;
1209functionResult = objectType.InvokeMember(this.name, bindingFlags, Type.DefaultBinder, objectInstance, args, CultureInfo.InvariantCulture);
1346private static Type GetTypeForStaticMethod(string typeName)
1351Type objectType;
1352Tuple<string, Type> functionType;
1373objectType = Type.GetType(typeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
1377FunctionConstants.AvailableStaticMethods[typeName] = new Tuple<string, Type>(typeName, objectType);
1384objectType = Type.GetType(typeName, false /* do not throw TypeLoadException if not found */, true /* ignore case */);
1419FunctionConstants.AvailableStaticMethods[typeName] = new Tuple<string, Type>(typeName, objectType);
1429private static Type GetTypeFromAssemblyUsingNamespace(string typeName)
1441Type foundType = GetTypeFromAssembly(typeName, candidateAssemblyName);
1462private static Type GetTypeFromAssembly(string typeName, string candidateAssemblyName)
1464Type objectType = null;
1485private static Function ConstructFunction(string expressionFunction, string expressionRootName, Type objectType, int argumentStartIndex, int methodStartIndex)
1711Type enumType = parameters[n].ParameterType;
1743private bool IsStaticMethodAvailable(Type objectType, string methodName)
1783Type[] types = new Type[arguments.Length];
Resources\Constants.cs (37)
114private static ConcurrentDictionary<string, Tuple<string, Type>> availableStaticMethods;
122internal static IDictionary<string, Tuple<string, Type>> AvailableStaticMethods
153availableStaticMethods = new ConcurrentDictionary<string, Tuple<string, Type>>(StringComparer.OrdinalIgnoreCase);
156Tuple<string, Type> environmentType = new Tuple<string, Type>(null, typeof(System.Environment));
157Tuple<string, Type> directoryType = new Tuple<string, Type>(null, typeof(System.IO.Directory));
158Tuple<string, Type> fileType = new Tuple<string, Type>(null, typeof(System.IO.File));
194availableStaticMethods.TryAdd("System.Globalization.CultureInfo::GetCultureInfo", new Tuple<string, Type>(null, typeof(System.Globalization.CultureInfo))); // user request
195availableStaticMethods.TryAdd("System.Globalization.CultureInfo::CurrentUICulture", new Tuple<string, Type>(null, typeof(System.Globalization.CultureInfo))); // user request
198availableStaticMethods.TryAdd("MSBuild", new Tuple<string, Type>(null, typeof(Microsoft.Build.BuildEngine.IntrinsicFunctions)));
199availableStaticMethods.TryAdd("System.Byte", new Tuple<string, Type>(null, typeof(System.Byte)));
200availableStaticMethods.TryAdd("System.Char", new Tuple<string, Type>(null, typeof(System.Char)));
201availableStaticMethods.TryAdd("System.Convert", new Tuple<string, Type>(null, typeof(System.Convert)));
202availableStaticMethods.TryAdd("System.DateTime", new Tuple<string, Type>(null, typeof(System.DateTime)));
203availableStaticMethods.TryAdd("System.Decimal", new Tuple<string, Type>(null, typeof(System.Decimal)));
204availableStaticMethods.TryAdd("System.Double", new Tuple<string, Type>(null, typeof(System.Double)));
205availableStaticMethods.TryAdd("System.Enum", new Tuple<string, Type>(null, typeof(System.Enum)));
206availableStaticMethods.TryAdd("System.Guid", new Tuple<string, Type>(null, typeof(System.Guid)));
207availableStaticMethods.TryAdd("System.Int16", new Tuple<string, Type>(null, typeof(System.Int16)));
208availableStaticMethods.TryAdd("System.Int32", new Tuple<string, Type>(null, typeof(System.Int32)));
209availableStaticMethods.TryAdd("System.Int64", new Tuple<string, Type>(null, typeof(System.Int64)));
210availableStaticMethods.TryAdd("System.IO.Path", new Tuple<string, Type>(null, typeof(System.IO.Path)));
211availableStaticMethods.TryAdd("System.Math", new Tuple<string, Type>(null, typeof(System.Math)));
212availableStaticMethods.TryAdd("System.UInt16", new Tuple<string, Type>(null, typeof(System.UInt16)));
213availableStaticMethods.TryAdd("System.UInt32", new Tuple<string, Type>(null, typeof(System.UInt32)));
214availableStaticMethods.TryAdd("System.UInt64", new Tuple<string, Type>(null, typeof(System.UInt64)));
215availableStaticMethods.TryAdd("System.SByte", new Tuple<string, Type>(null, typeof(System.SByte)));
216availableStaticMethods.TryAdd("System.Single", new Tuple<string, Type>(null, typeof(System.Single)));
217availableStaticMethods.TryAdd("System.String", new Tuple<string, Type>(null, typeof(System.String)));
218availableStaticMethods.TryAdd("System.StringComparer", new Tuple<string, Type>(null, typeof(System.StringComparer)));
219availableStaticMethods.TryAdd("System.TimeSpan", new Tuple<string, Type>(null, typeof(System.TimeSpan)));
220availableStaticMethods.TryAdd("System.Text.RegularExpressions.Regex", new Tuple<string, Type>(null, typeof(System.Text.RegularExpressions.Regex)));
221availableStaticMethods.TryAdd("System.UriBuilder", new Tuple<string, Type>(null, typeof(System.UriBuilder)));
222availableStaticMethods.TryAdd("System.Version", new Tuple<string, Type>(null, typeof(System.Version)));
223availableStaticMethods.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));
Microsoft.Build.Engine.OM.UnitTests (9)
Microsoft.Build.Engine.UnitTests (25)
Microsoft.Build.Framework (28)
Microsoft.Build.Framework.UnitTests (1)
Microsoft.Build.Tasks.Core (36)
Microsoft.Build.Tasks.UnitTests (4)
Microsoft.Build.Utilities.Core (2)
Microsoft.Build.Utilities.UnitTests (2)
Microsoft.Cci.Extensions (2)
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.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 (6)
Microsoft.Extensions.Caching.Hybrid.Tests (2)
Microsoft.Extensions.Caching.StackExchangeRedis (1)
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,
290[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
393Type? interfaceGenericType = type.IsInterface && type.IsConstructedGenericType ? type.GetGenericTypeDefinition() : null;
399Type genericType = typeof(List<>).MakeGenericType(type.GenericTypeArguments);
412Type? dictionaryInterface = FindOpenGenericInterface(typeof(IDictionary<,>), type);
420Type? collectionInterface = FindOpenGenericInterface(typeof(ICollection<>), type);
447Type type,
559Type dictionaryType,
563Type keyType = dictionaryType.GenericTypeArguments[0];
564Type valueType = dictionaryType.GenericTypeArguments[1];
593Type kvpType = typeof(KeyValuePair<,>).MakeGenericType(keyType, valueType);
630Type dictionaryType,
636Type keyType = dictionaryType.GenericTypeArguments[0];
637Type valueType = dictionaryType.GenericTypeArguments[1];
700Type collectionType,
704Type itemType = collectionType.GenericTypeArguments[0];
737private static Array BindArray(Type type, IEnumerable? source, IConfiguration config, BinderOptions options)
739Type elementType;
796private static object? BindSet(Type type, IEnumerable? source, IConfiguration config, BinderOptions options)
798Type elementType = type.GetGenericArguments()[0];
813Type genericType = typeof(HashSet<>).MakeGenericType(elementType);
866Type type,
919Type type,
930private static bool TypeIsADictionaryInterface(Type type)
934Type genericTypeDefinition = type.GetGenericTypeDefinition();
939private static bool IsImmutableArrayCompatibleInterface(Type type)
943Type genericTypeDefinition = type.GetGenericTypeDefinition();
949private static bool TypeIsASetInterface(Type type)
953Type genericTypeDefinition = type.GetGenericTypeDefinition();
961private static Type? FindOpenGenericInterface(
962Type expected,
964Type actual)
972Type[] interfaces = actual.GetInterfaces();
973foreach (Type interfaceType in interfaces)
984private static List<PropertyInfo> GetAllProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
988Type baseType = type;
1013private 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 (170)
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.
158public Type? ImplementationType
171/// Gets the <see cref="Type"/> that implements the service.
174public Type? KeyedImplementationType
292internal Type GetImplementationType()
306Type[]? typeArguments = ImplementationFactory.GetType().GenericTypeArguments;
325Type[]? typeArguments = KeyedImplementationFactory.GetType().GenericTypeArguments;
377Type service,
378[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
396Type service,
398[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
489public static ServiceDescriptor Transient(Type service, Func<IServiceProvider, object> implementationFactory)
506public static ServiceDescriptor KeyedTransient(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
554Type service,
555[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
570Type service,
572[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
660public static ServiceDescriptor Scoped(Type service, Func<IServiceProvider, object> implementationFactory)
677public static ServiceDescriptor KeyedScoped(Type service, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory)
726Type service,
727[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
745Type service,
747[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType)
841Type serviceType,
860Type serviceType,
914Type serviceType,
933Type serviceType,
966Type serviceType,
967[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
984Type serviceType,
986[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type implementationType,
1001public static ServiceDescriptor Describe(Type serviceType, Func<IServiceProvider, object> implementationFactory, ServiceLifetime lifetime)
1016public static ServiceDescriptor DescribeKeyed(Type serviceType, object? serviceKey, Func<IServiceProvider, object?, object> implementationFactory, ServiceLifetime lifetime)
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.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 (37)
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.Polly.Tests (3)
Microsoft.Extensions.Identity.Core (39)
Microsoft.Extensions.Identity.Stores (13)
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.Microbenchmark (7)
Microsoft.Extensions.Options (19)
Microsoft.Extensions.Options.SourceGeneration (1)
Microsoft.Interop.ComInterfaceGenerator (1)
Microsoft.Interop.LibraryImportGenerator (4)
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.NET.WebAssembly.Webcil (2)
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.Win32.Registry (3)
MockHostTypes (1)
MonoTargetsTasks (4)
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 (405)
MS\Internal\MarkupCompiler\MarkupCompiler.cs (28)
1045Type eventTarget;
1783private CodeExpression GetPropertyValueExpression(ITypeDescriptorContext ctx, Type typeToConvertTo, Object value, string attributeValue)
1893private Type GetEventHandlerType(MemberInfo memberInfo)
1895Type eventHandlerType = null;
1928Type eventTarget = cc != null ? cc.ElementType : miEvent.DeclaringType;
1936Type eventHandlerType = GetEventHandlerType(miEvent);
1973private CodeStatement AddCLREvent(Type eventTarget, CodeContext cc, CodeExpression ce, MarkupEventInfo mei)
2036Type eventHandlerType = GetEventHandlerType(mei.mi);
2181Type resourceDictionary = KnownTypes.Types[(int)KnownElements.ResourceDictionary];
2182Type iNameScope = KnownTypes.Types[(int)KnownElements.INameScope];
2186Type t = ((CodeContext)contexts[i]).ElementType;
2256Type currTypeArg = parserContext.XamlTypeMapper.GetTypeArgsType(_typeArgsList[i].Trim(),
2298private static CodeTypeReference GenerateConstructedTypeReference(Type t, string [] typeArgsList, string genericName)
2343private static CodeTypeReference GenerateConstructedTypeReference(Type t, string [] typeArgsList, Type refType, string refTypeFullName, string eventName)
2350Type[] refTypeParams = null;
2352Type[] typeParams = t.GetGenericArguments();
2369foreach (Type typeParam in typeParams)
2450private CodeTypeDeclaration GenerateClass(string className, ref string modifier, Type baseClass, string baseClassFullName)
2494private CodeContext GenerateSubClass(ref string className, ref string modifier, Type baseClass, string baseClassFullName)
2569CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression(typeof(Type), DELEGATETYPE);
2762CodeParameterDeclarationExpression param1 = new CodeParameterDeclarationExpression(typeof(Type), TYPE);
2861param1 = new CodeParameterDeclarationExpression(typeof(Type), DELEGATETYPE);
2966internal string StartElement(ref string className, string subClassFullName, ref string modifier, Type elementType, string baseClassFullName)
3337internal CodeContext(Type elementType, string [] typeArgsList, string localElementFullName)
3344internal Type ElementType
3386private Type _elementType = null;
3396Type elementType,
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\BamlMapTable.cs (28)
102internal static Type GetKnownTypeFromId(short id)
131Type probeType = KnownTypes.Types[probe];
166internal static short GetKnownTypeIdFromType(Type type)
288internal Type GetKnownConverterTypeFromType(Type type)
309if (type == typeof(System.Type))
334private static Type GetKnownConverterTypeFromPropName(
335Type propOwnerType,
961internal short GetAttributeOrTypeId(BinaryWriter binaryWriter, Type declaringType, string memberName, out short typeId)
1215Type elementType,
1299Type owningType, // Actual type of the object the owns or declares this attribute
1301Type attributeType, // Type of the attribute or property itself; not its owner type
1312Type owningType, // Actual type of the object the owns or declares this attribute
1314Type attributeType, // Type of the attribute or property itself; not its owner type
1326Type serializerType = XamlTypeMapper.GetXamlSerializerForType(owningType);
1377Type ownerType, // Type of object that owns or declares this attribute
1378Type attributeType, // Type of the attribute or property itself; not its owner type
1382out Type converterOrSerializerType)
1493Type defaultTargetType)
1496Type targetType = null;
1542Type declaringType, // Type of object that owns or declares this attribute
1543Type attributeType) // Type of the attribute or property itself; not its owner type
1561private Type GetCustomConverter(
1563Type ownerType, // Type of object that owns or declares this attribute
1565Type attributeType) // Type of the attribute or property itself; not its owner type
1568Type converterType = GetKnownConverterTypeFromPropName(ownerType, fieldName);
1602private Type GetCustomSerializer(
1603Type type,
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\MarkupExtensionParser.cs (25)
43ref Type baseType,
44ref Type serializerType);
71Type declaringType, // Type where propIdName is declared
96Type declaringType,
156private KnownElements GetKnownExtensionFromType(Type extensionType, out string propName)
196Type extensionType,
233Type extensionType,
307Type targetType)
451Type declaringType, // Type where attribute is declared
462Type targetType;
463Type serializerType;
485Type declaringType, // Type where propIdName is declared
498Type targetType;
499Type serializerType;
559out Type targetType,
560out Type serializerType)
646Type propertyType;
919Type extensionType)
1205private ParameterInfo[] FindLongestConstructor(Type extensionType, out int maxConstructorArguments)
1383Type declaringType;
1499Type parentType,
1517Type declaringType;
1552Type typeValue = _parserContext.XamlTypeMapper.GetTypeFromBaseString(value,
1652Type elementBaseType,
1659out Type declaringType, // type of the object that the field is on
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlParseException.cs (1)
424Type objectType
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (117)
181ref Type baseType,
182ref Type serializerType)
236private static bool IsACollection(Type type)
255Type contentPropertyType = XamlTypeMapper.GetPropertyType(context.ContentPropertyInfo);
278Type t = ((Type)context.ContextData);
475ref Type baseType,
476ref Type serializerType)
625Type elementType,
626Type serializerType,
635ReflectionHelper.GetMscorlibType(typeof(IDictionary)).IsAssignableFrom(ParentContext.ContextData as Type));
673Type elementType = (Type) CurrentContext.ContextDataType;
681Type propertyDeclaringType;
698Type converterType,
800Type typeValue = XamlTypeMapper.GetTypeFromBaseString(value,
850Type valueElementType, // Actual type of the valueTypeFullname.
870Type declaringType, // Type that corresponds to declaringTypeFullName (where the property is declared)
878Type propType = XamlTypeMapper.GetPropertyType(propertyMember);
1081Type valueElementType)
1147ref Type baseType, // Type of the dynamicObject - PropertyInfo, MethodInfo or DependencyProperty
1149ref Type declaringType) // Actual type corresponding to typeFullName
1342bool GetTrimSurroundingWhitespace(Type type)
1438delegate bool ContentValidator(Type type);
1472public Type ContextDataType
1479return _contextData as Type;
1536internal Type ChildPropertyType
1647Type _childPropertyType;
1692Type elementBaseType,
1699out Type declaringType, // type of the object that the field is on
1769Type elementBaseType,
1777ref Type declaringType, // type of the object that the field is on
1885static string GetContentPropertyName(Type type)
1914Type baseType = type;
1915Type attrType = KnownTypes.Types[(int)KnownElements.ContentPropertyAttribute];
1916Type DOType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1917Type FEType = KnownTypes.Types[(int)KnownElements.FrameworkElement];
1918Type FCEType = KnownTypes.Types[(int)KnownElements.FrameworkContentElement];
2194Type elementType,
2292Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
2757Type parentType, // Type of parent, if known
2822Type declaringType = null;
2978Type parentType,
3014parentType.GetConstructor(Type.EmptyTypes) == null ||
3068Type valueElementType = null;
3069Type valueSerializerType = null;
3120Type pType = ParentContext.ContextData as Type;
3170Type parentType,
3180Type declaringType,
3242Type propType;
3293parentType.GetConstructor(Type.EmptyTypes) == null ||
3302if (propType == ReflectionHelper.GetMscorlibType(typeof(Type)))
3336Type parentType = XamlTypeMapper.GetType(parentTypeNamespace, parentTypeName);
3342private string GetRuntimeNamePropertyName(Type objectType)
3416Type baseType = objectType;
3417Type attrType = KnownTypes.Types[(int)KnownElements.RuntimeNamePropertyAttribute];
3418Type TimelineType = KnownTypes.Types[(int)KnownElements.Timeline];
3419Type FEType = KnownTypes.Types[(int)KnownElements.FrameworkElement];
3420Type FCEType = KnownTypes.Types[(int)KnownElements.FrameworkContentElement];
3421Type BSBType = KnownTypes.Types[(int)KnownElements.BeginStoryboard];
3487Type parentType,
3514private bool PropertyIsWriteable(object propertyMember, Type declaringType)
3576Type elementBaseType = null;
3580Type serializerType = null;
3677Type declaringType = null;
3700Type propertyType = XamlTypeMapper.GetPropertyType(dynamicObject);
3936Type propertyType, // Type of the property
3937Type serializerType, // Type of serializer for the property
3943Type declaringType, // Actual type that corresponds to typeFullName
4169Type propertyType, // Type of the property
4189Type propertyType, // Type of the property
4190Type serializerType,
4229Type propertyType, // Type of the property
4230Type serializerType, // Type of serializer for the property
4269Type propertyType, // Type of the property
4325Type serializerType,
4339Type currentObjectType = CurrentContext.ContextDataType;
4357FirstTagName = $"{((Type)GrandParentContext.ContextData).Name}.{GrandParentContext.ChildTagLocalName}";
4416ParentContext.ContextDataType.GetConstructor(Type.EmptyTypes) == null))
4498Type parentElementType = CurrentContext.ContextDataType;
4522private void LoadContentPropertyInfo(Type elementType)
4538Type propertyDeclaringType;
4560Type elementType,
4564out Type propertyDeclaringType)
4572Type propertyBaseType = null;
4630Type propertyDeclaringType = XamlTypeMapper.GetDeclaringType(contentPropertyInfo);
4651Type parentType = ParentContext.ContextDataType;
4674Type arrayType = ParentContext.ContextDataType;
4675Type objectType = CurrentContext.ContextDataType;
4706Type elementType = CurrentContext.ContextDataType;
4721Type contentPropertyType = XamlTypeMapper.GetPropertyType(CurrentContext.ContentPropertyInfo);
4780Type converterType = XamlTypeMapper.GetTypeConverterType(elementType);
4798Type converterType = XamlTypeMapper.GetTypeConverterType(elementType);
4819internal static bool CanCollectionTypeAcceptStrings( Type collectionType )
4839internal static bool CanCollectionTypeAcceptStringsHelper( Type propertyType )
4846Type collectionItemType = GetCollectionItemType(propertyType);
4882internal static Type GetCollectionItemType( Type collectionType )
4886Type iCollectionT = collectionType.GetInterface("System.Collections.Generic.ICollection`1");
4926internal static bool CanWrapStringAsItemType( Type collectionType, Type collectionItemType )
4928Type contentWrapper = null; //e.g. Run
4955contentWrapper = attributes[i].ConstructorArguments[0].Value as Type;
5701private bool IsWhitespaceSignificantAttributePresent(Type collectionType)
5714Type baseType = collectionType;
5715Type attrType = KnownTypes.Types[(int)KnownElements.WhitespaceSignificantCollectionAttribute];
5743Type propertyType)
5748internal Type PropertyType
5775private Type _propertyType;
6462Type typeRightTag = elementNode.ElementType;
6777private bool IsAssignableToIXmlSerializable(Type type)
6837Type _definitionScopeType;
6852private Type _typeIXmlSerializable;
6860Type _ownerType;
6863public XamlPropertyFullName(Type ownerType, string name)
6870public Type OwnerType { get { return _ownerType; } }
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlTypeMapper.cs (57)
116public Type GetType(
731Type propType,
786Type owner,
949Type owner,
973static private bool IsAllowedEventDelegateType(Type delegateType)
1224Type owner,
1254Type owner,
1284Type objectType = typeAndSerializer.ObjectType;
1305Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1439Type baseType = owner;
1464Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1856Type typeValue = null;
1913Type ownerType,
2031internal static Type GetPropertyType(object propertyMember)
2033Type propertyType;
2048out Type propertyType,
2127internal static Type GetDeclaringType(object propertyMember)
2129Type validType = null;
2252internal Type GetTargetTypeAndMember(string valueParam,
2267Type targetType = null;
2303internal Type GetDependencyPropertyOwnerAndName(string memberValue,
2305Type defaultTargetType,
2308Type targetType = GetTargetTypeAndMember(memberValue, context, false, out memberName);
2335internal MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly)
2375private MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly, bool tryInternal)
2497private static bool IsInternalAllowedOnType(Type type)
2548Type objectType = GetObjectType(namespaceMap, localName, knownTypesOnly);
2598private Type GetObjectType(
2606Type type = null;
2674internal int GetCustomBamlSerializerIdForType(Type objectType)
2715internal Type GetXamlSerializerForType(Type objectType)
2856internal Type GetTypeFromBaseString(
2862Type keyObject = null;
2931internal Type GetTypeArgsType(
2937Type t = null;
2993private TypeInformationCacheData GetCachedInformationForType(Type type)
3113internal object CreateInstance(Type t)
3449internal Type GetTypeConverterType(Type type)
3453Type converterType = null;
3524internal Type GetPropertyConverterType(Type propType, object dpOrPiOrMi)
3527Type converterType = null;
3538converterType = (Type)ret;
3735internal bool GetCachedTrimSurroundingWhitespace(Type t)
3753private bool GetTrimSurroundingWhitespace(Type type)
3935internal TypeInformationCacheData(Type baseType)
3972internal Type TypeConverterType
4018Type ownerType,
4064Type converter)
4072Type _baseType;
4080Type _typeConverterType;
4090Type ot,
4103public Type OwnerType;
4211public Type ObjectType = null;
4212public Type SerializerType = null;
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\ReflectionHelper.cs (32)
86internal static Type GetQualifiedType(string typeName)
95return Type.GetType(nameFrags[0]);
125internal static bool IsNullableType(Type type)
130internal static bool IsInternalType(Type type)
132Type origType = type;
152internal static bool IsPublicType(Type type)
169internal static Type GetFrameworkType(string assemblyName, Type type)
187internal static Type GetMscorlibType(Type type)
193internal static Type GetSystemType(Type type)
219internal static string GetTypeConverterAttributeData(Type type, out Type converterType)
225internal static string GetTypeConverterAttributeData(MemberInfo mi, out Type converterType)
233private static string GetCustomAttributeData(MemberInfo mi, Type attrType, out Type typeValue)
244internal static string GetCustomAttributeData(Type t, Type attrType, bool allowZeroArgs)
246Type typeValue = null;
256private static string GetCustomAttributeData(IList<CustomAttributeData> list, Type attrType, out Type typeValue, bool allowTypeAlso, bool allowZeroArgs)
277internal static string GetCustomAttributeData(Type t,
278Type attrType,
281out Type typeValue)
285Type currentType = t;
320Type attrType,
321out Type typeValue,
342if (attrValue == null && allowTypeAlso && tca.ArgumentType == GetMscorlibType(typeof(Type)))
347typeValue = tca.Value as Type;
490Type typeValue = null;
509internal static bool IsInternalAllowedOnType(Type type)
PresentationCore (420)
MS\Internal\IListConverters.cs (9)
38public override bool CanConvertFrom(ITypeDescriptorContext td, Type t)
46public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
74public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
91internal abstract object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
117internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
159internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
200internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
242internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
280internal override object ConvertToCore(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (18)
59public static TResult ReflectionStaticCall<TResult>(this Type type, string methodName)
64method = type.GetMethod(methodName, Type.EmptyTypes);
92public static TResult ReflectionStaticCall<TResult, TArg>(this Type type, string methodName, TArg arg)
97method = type.GetMethod(methodName, new Type[] { typeof(TArg) });
147method = obj.GetType().GetMethod(methodName, Type.EmptyTypes);
179method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1) });
233method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1), typeof(TArg2) });
308public static object ReflectionNew(this Type type)
310ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
333public static object ReflectionNew<TArg1>(this Type type, TArg1 arg1)
335ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1) });
360public static object ReflectionNew<TArg1, TArg2>(this Type type, TArg1 arg1, TArg2 arg2)
362ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1), typeof(TArg2) });
381/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
388Type type = obj.GetType();
406/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
422/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
426public static TResult ReflectionStaticGetProperty<TResult>(this Type type, string propertyName)
PresentationFramework (1707)
MS\Internal\Commands\CommandHelpers.cs (13)
21internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler)
26internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
32internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
38internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
44internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
50internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
56internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
62internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
68internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
76internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, Key key, ModifierKeys modifierKeys,
82internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
89internal static void RegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
97private static void PrivateRegisterCommandHandler(Type controlType, RoutedCommand command, ExecutedRoutedEventHandler executedRoutedEventHandler,
MS\Internal\Data\DataBindEngine.cs (6)
338internal ViewRecord GetViewRecord(object collection, CollectionViewSource key, Type collectionViewType, bool createView, Func<object, object> GetSourceItem)
367internal IValueConverter GetDefaultValueConverter(Type sourceType,
368Type targetType,
663private readonly Type _sourceType, _targetType;
666public ValueConverterTableKey(Type sourceType, Type targetType, bool targetToSource)
MS\Internal\Data\DefaultValueConverter.cs (51)
38protected DefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
60internal static IValueConverter Create(Type sourceType,
61Type targetType,
66Type innerType;
180internal static TypeConverter GetConverter(Type type)
199internal static object TryParse(object o, Type targetType, CultureInfo culture)
213new Type[] { StringType, typeof(System.Globalization.NumberStyles), typeof(System.IFormatProvider) },
222new Type[] { StringType, typeof(System.IFormatProvider) },
231new Type[] { StringType },
254protected object ConvertFrom(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture)
259protected object ConvertTo(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture)
265protected void EnsureConverter(Type type)
279private object ConvertHelper(object o, Type destinationType, DependencyObject targetElement, CultureInfo culture, bool isForward)
365protected Type _sourceType;
366protected Type _targetType;
373static Type StringType = typeof(String);
388public SourceDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
401public object Convert(object o, Type type, object parameter, CultureInfo culture)
406public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
424public TargetDefaultValueConverter(TypeConverter typeConverter, Type sourceType, Type targetType,
436public object Convert(object o, Type type, object parameter, CultureInfo culture)
441public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
453public SystemConvertConverter(Type sourceType, Type targetType)
459public object Convert(object o, Type type, object parameter, CultureInfo culture)
464public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
473public static bool CanConvert(Type sourceType, Type targetType)
517private static bool CanConvertChar(Type type)
527Type _sourceType, _targetType;
530static readonly Type[] SupportedTypes = {
539static readonly Type[] CharSupportedTypes = {
561public ObjectTargetConverter(Type sourceType, DataBindEngine engine) :
573public object Convert(object o, Type type, object parameter, CultureInfo culture)
579public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
608public ObjectSourceConverter(Type targetType, DataBindEngine engine) :
620public object Convert(object o, Type type, object parameter, CultureInfo culture)
637public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
663public object Convert(object o, Type type, object parameter, CultureInfo culture)
676public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
694internal InterfaceConverter(Type sourceType, Type targetType)
706public object Convert(object o, Type type, object parameter, CultureInfo culture)
711public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
716private object ConvertTo(object o, Type type)
721Type _sourceType;
722Type _targetType;
732virtual public object GetService(Type serviceType)
MS\Internal\Data\DynamicValueConverter.cs (11)
32internal DynamicValueConverter(bool targetToSourceNeeded, Type sourceType, Type targetType)
38internal object Convert(object value, Type targetType)
43public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
49Type sourceType = value.GetType();
68public object ConvertBack(object value, Type sourceType, object parameter, CultureInfo culture)
74Type targetType = value.GetType();
94private void EnsureConverter(Type sourceType, Type targetType)
125private Type _sourceType;
126private Type _targetType;
MS\Internal\Data\ViewManager.cs (4)
499internal ViewRecord GetViewRecord(object collection, CollectionViewSource cvs, Type collectionViewType, bool createView, Func<object, object> GetSourceItem)
689private ViewRecord GetExistingView(object collection, CollectionViewSource cvs, Type collectionViewType, Func<object, object> GetSourceItem)
835private void ValidateViewType(CollectionView cv, Type collectionViewType)
843Type cachedViewType = (cvp == null) ? cv.GetType() : cvp.ProxiedView.GetType();
MS\Internal\WindowsRuntime\Generated\WinRT\Projections.cs (39)
19private static readonly Dictionary<Type, Type> CustomTypeToHelperTypeMappings = new Dictionary<Type, Type>();
20private static readonly Dictionary<Type, Type> CustomAbiTypeToTypeMappings = new Dictionary<Type, Type>();
21private static readonly Dictionary<string, Type> CustomAbiTypeNameToTypeMappings = new Dictionary<string, Type>();
22private static readonly Dictionary<Type, string> CustomTypeToAbiTypeNameMappings = new Dictionary<Type, string>();
32private static void RegisterCustomAbiTypeMappingNoLock(Type publicType, Type abiType, string winrtTypeName, bool isRuntimeClass = false)
44public static Type FindCustomHelperTypeMapping(Type publicType)
51return CustomTypeToHelperTypeMappings.TryGetValue(publicType.GetGenericTypeDefinition(), out Type abiTypeDefinition)
55return CustomTypeToHelperTypeMappings.TryGetValue(publicType, out Type abiType) ? abiType : null;
63public static Type FindCustomPublicTypeForAbiType(Type abiType)
70return CustomAbiTypeToTypeMappings.TryGetValue(abiType.GetGenericTypeDefinition(), out Type publicTypeDefinition)
74return CustomAbiTypeToTypeMappings.TryGetValue(abiType, out Type publicType) ? publicType : null;
82public static Type FindCustomTypeForAbiTypeName(string abiTypeName)
87return CustomAbiTypeNameToTypeMappings.TryGetValue(abiTypeName, out Type type) ? type : null;
95public static string FindCustomAbiTypeNameForType(Type type)
108public static bool IsTypeWindowsRuntimeType(Type type)
110Type typeToTest = type;
118private static bool IsTypeWindowsRuntimeTypeNoArray(Type type)
124foreach (var arg in type.GetGenericArguments())
143public static bool TryGetCompatibleWindowsRuntimeTypeForVariantType(Type type, out Type compatibleType)
151var definition = type.GetGenericTypeDefinition();
160var newArguments = new Type[genericArguments.Length];
184internal static bool TryGetDefaultInterfaceTypeForRuntimeClassType(Type runtimeClass, out Type defaultInterface)
197internal static Type GetDefaultInterfaceTypeForRuntimeClassType(Type runtimeClass)
199if (!TryGetDefaultInterfaceTypeForRuntimeClassType(runtimeClass, out Type defaultInterface))
206internal static bool TryGetMarshalerTypeForProjectedRuntimeClass(IObjectReference objectReference, out Type type)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (18)
59public static TResult ReflectionStaticCall<TResult>(this Type type, string methodName)
64method = type.GetMethod(methodName, Type.EmptyTypes);
92public static TResult ReflectionStaticCall<TResult, TArg>(this Type type, string methodName, TArg arg)
97method = type.GetMethod(methodName, new Type[] { typeof(TArg) });
147method = obj.GetType().GetMethod(methodName, Type.EmptyTypes);
179method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1) });
233method = obj.GetType().GetMethod(methodName, new Type[] { typeof(TArg1), typeof(TArg2) });
308public static object ReflectionNew(this Type type)
310ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
333public static object ReflectionNew<TArg1>(this Type type, TArg1 arg1)
335ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1) });
360public static object ReflectionNew<TArg1, TArg2>(this Type type, TArg1 arg1, TArg2 arg2)
362ConstructorInfo constructor = type.GetConstructor(new Type[] { typeof(TArg1), typeof(TArg2) });
381/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
388Type type = obj.GetType();
406/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
422/// <exception cref="AmbiguousMatchException">More than one property is found with the specified name. See <see cref="Type.GetProperty(string)"/></exception>
426public static TResult ReflectionStaticGetProperty<TResult>(this Type type, string propertyName)
System\Windows\Controls\StickyNote.cs (5)
96Type owner = typeof(StickyNoteControl);
1914public object Convert(object o, Type type, object parameter, CultureInfo culture)
1930public object ConvertBack(object o, Type type, object parameter, CultureInfo culture)
1940public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
1958public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
System\Windows\Documents\TextRangeSerialization.cs (16)
543Type elementType = textReader.ParentType;
545Type elementTypeStandardized = TextSchema.GetStandardElementType(elementType, reduceElement);
652Type rootType;
663Type contextType = context.ParentType;
770private static void WriteInheritableProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, bool onlyAffected, DependencyObject complexProperties)
835private static void WriteNoninheritableProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, bool onlyAffected, DependencyObject complexProperties)
845Type propertyOwnerType = context.ParentType;
914private static void WriteNoninheritableProperty(XmlWriter xmlWriter, DependencyProperty property, object propertyValue, Type propertyOwnerType, bool onlyAffected, DependencyObject complexProperties, object localValue)
954private static void WriteLocallySetProperties(Type elementTypeStandardized, ITextPointer context, XmlWriter xmlWriter, DependencyObject complexProperties)
1064private static void WriteComplexProperties(XmlWriter xmlWriter, DependencyObject complexProperties, Type elementType)
1093private static string GetPropertyNameForElement(DependencyProperty property, Type elementType, bool forceComplexName)
1121Type elementTypeStandardized = TextSchema.GetStandardElementType(element.GetType(), reduceElement);
1168Type elementTypeStandardized = typeof(Image);
1513private static void ValidateMergingPositions(Type itemType, TextPointer start, TextPointer end)
1604private static void ApplyContextualProperty(Type targetType, TextPointer start, TextPointer end, DependencyProperty property, object value)
1941private static string FilterNaNStringValueForDoublePropertyType(string stringValue, Type propertyType)
System\Windows\Documents\TextSchema.cs (25)
121internal static bool IsValidChild(TextElement parent, Type childType)
126internal static bool ValidateChild(TextElement parent, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
152internal static bool IsValidChild(TextPointer position, Type childType)
157internal static bool ValidateChild(TextPointer position, Type childType, bool throwIfIllegalChild, bool throwIfIllegalHyperlinkDescendent)
184internal static bool IsValidSibling(Type siblingType, Type newType)
217internal static bool IsValidChild(ITextPointer position, Type childType)
233internal static bool IsValidChildOfContainer(Type parentType, Type childType)
258internal static bool IsFormattingType(Type elementType)
269internal static bool IsKnownType(Type elementType)
275internal static bool IsNonFormattingInline(Type elementType)
280internal static bool IsMergeableInline(Type elementType)
285internal static bool IsNonMergeableInline(Type elementType)
304internal static bool AllowsParagraphMerging(Type elementType)
324internal static bool IsParagraphOrBlockUIContainer(Type elementType)
332internal static bool IsBlock(Type type)
338internal static bool IsBreak(Type type)
362internal static Type GetStandardElementType(Type type, bool reduceElement)
455internal static DependencyProperty[] GetInheritableProperties(Type type)
476internal static DependencyProperty[] GetNoninheritableProperties(Type type)
759Type propertyType = property.PropertyType;
805private static bool IsValidChild(Type parentType, Type childType)
System\Windows\Input\Command\CommandConverter.cs (10)
49public override bool CanConvertFrom( ITypeDescriptorContext context, Type sourceType )
68public override bool CanConvertTo( ITypeDescriptorContext context, Type destinationType )
108Type ownerType = GetTypeFromContext(context, typeName);
128internal static ICommand ConvertFromHelper(Type ownerType, string localName )
173public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType )
200internal static bool IsKnownType( Type commandType )
214private Type GetTypeFromContext( ITypeDescriptorContext context, string typeName )
243private static RoutedUICommand GetKnownCommand( string localName, Type ownerType )
762internal static object GetKnownControlCommand(Type ownerType, string commandName)
809static void VerifyCommandDoesntExist( Type type, string name )
System\Windows\Markup\Baml2006\WpfGeneratedKnownProperties.cs (405)
1720Type type = typeof(System.Windows.Controls.AccessText);
1737Type type = typeof(System.Windows.Media.Animation.BeginStoryboard);
1753Type type = typeof(System.Windows.Media.Effects.BitmapEffectGroup);
1769Type type = typeof(System.Windows.Controls.Border);
1786Type type = typeof(System.Windows.Controls.Border);
1803Type type = typeof(System.Windows.Controls.Border);
1820Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1837Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1855Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1871Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
1889Type type = typeof(System.Windows.Controls.ColumnDefinition);
1906Type type = typeof(System.Windows.Controls.ColumnDefinition);
1923Type type = typeof(System.Windows.Controls.ColumnDefinition);
1940Type type = typeof(System.Windows.Controls.ContentControl);
1958Type type = typeof(System.Windows.Controls.ContentControl);
1974Type type = typeof(System.Windows.Controls.ContentControl);
1990Type type = typeof(System.Windows.Controls.ContentControl);
2008Type type = typeof(System.Windows.ContentElement);
2025Type type = typeof(System.Windows.Controls.ContentPresenter);
2043Type type = typeof(System.Windows.Controls.ContentPresenter);
2060Type type = typeof(System.Windows.Controls.ContentPresenter);
2076Type type = typeof(System.Windows.Controls.ContentPresenter);
2092Type type = typeof(System.Windows.Controls.ContentPresenter);
2109Type type = typeof(System.Windows.Controls.Control);
2126Type type = typeof(System.Windows.Controls.Control);
2143Type type = typeof(System.Windows.Controls.Control);
2160Type type = typeof(System.Windows.Controls.Control);
2177Type type = typeof(System.Windows.Controls.Control);
2194Type type = typeof(System.Windows.Controls.Control);
2211Type type = typeof(System.Windows.Controls.Control);
2228Type type = typeof(System.Windows.Controls.Control);
2245Type type = typeof(System.Windows.Controls.Control);
2262Type type = typeof(System.Windows.Controls.Control);
2279Type type = typeof(System.Windows.Controls.Control);
2296Type type = typeof(System.Windows.Controls.Control);
2313Type type = typeof(System.Windows.Controls.Control);
2330Type type = typeof(System.Windows.Controls.Control);
2346Type type = typeof(System.Windows.Controls.Control);
2363Type type = typeof(System.Windows.Controls.DockPanel);
2380Type type = typeof(System.Windows.Controls.DockPanel);
2397Type type = typeof(System.Windows.Controls.Primitives.DocumentViewerBase);
2413Type type = typeof(System.Windows.Media.DrawingGroup);
2429Type type = typeof(System.Windows.Controls.FlowDocumentReader);
2445Type type = typeof(System.Windows.Controls.FlowDocumentScrollViewer);
2461Type type = typeof(System.Windows.FrameworkContentElement);
2477Type type = typeof(System.Windows.FrameworkElement);
2494Type type = typeof(System.Windows.FrameworkElement);
2511Type type = typeof(System.Windows.FrameworkElement);
2528Type type = typeof(System.Windows.FrameworkElement);
2545Type type = typeof(System.Windows.FrameworkElement);
2562Type type = typeof(System.Windows.FrameworkElement);
2579Type type = typeof(System.Windows.FrameworkElement);
2596Type type = typeof(System.Windows.FrameworkElement);
2613Type type = typeof(System.Windows.FrameworkElement);
2630Type type = typeof(System.Windows.FrameworkElement);
2646Type type = typeof(System.Windows.FrameworkElement);
2663Type type = typeof(System.Windows.FrameworkElement);
2680Type type = typeof(System.Windows.Media.GeneralTransformGroup);
2696Type type = typeof(System.Windows.Media.GeometryGroup);
2712Type type = typeof(System.Windows.Media.GradientBrush);
2728Type type = typeof(System.Windows.Controls.Grid);
2745Type type = typeof(System.Windows.Controls.Grid);
2762Type type = typeof(System.Windows.Controls.Grid);
2779Type type = typeof(System.Windows.Controls.Grid);
2796Type type = typeof(System.Windows.Controls.GridViewColumn);
2814Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2832Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2850Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2866Type type = typeof(System.Windows.Controls.HeaderedContentControl);
2882Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2900Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2918Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2934Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
2950Type type = typeof(System.Windows.Documents.Hyperlink);
2967Type type = typeof(System.Windows.Controls.Image);
2984Type type = typeof(System.Windows.Controls.Image);
3001Type type = typeof(System.Windows.Controls.ItemsControl);
3017Type type = typeof(System.Windows.Controls.ItemsControl);
3033Type type = typeof(System.Windows.Controls.ItemsControl);
3049Type type = typeof(System.Windows.Controls.ItemsControl);
3065Type type = typeof(System.Windows.Controls.ItemsControl);
3081Type type = typeof(System.Windows.Controls.ItemsControl);
3097Type type = typeof(System.Windows.Media.Media3D.MaterialGroup);
3113Type type = typeof(System.Windows.Media.Media3D.Model3DGroup);
3129Type type = typeof(System.Windows.Controls.Page);
3147Type type = typeof(System.Windows.Controls.Panel);
3164Type type = typeof(System.Windows.Shapes.Path);
3181Type type = typeof(System.Windows.Media.PathFigure);
3197Type type = typeof(System.Windows.Media.PathGeometry);
3214Type type = typeof(System.Windows.Controls.Primitives.Popup);
3230Type type = typeof(System.Windows.Controls.Primitives.Popup);
3247Type type = typeof(System.Windows.Controls.Primitives.Popup);
3264Type type = typeof(System.Windows.Controls.Primitives.Popup);
3281Type type = typeof(System.Windows.Controls.RowDefinition);
3298Type type = typeof(System.Windows.Controls.RowDefinition);
3315Type type = typeof(System.Windows.Controls.RowDefinition);
3332Type type = typeof(System.Windows.Controls.ScrollViewer);
3349Type type = typeof(System.Windows.Controls.ScrollViewer);
3366Type type = typeof(System.Windows.Controls.ScrollViewer);
3383Type type = typeof(System.Windows.Shapes.Shape);
3400Type type = typeof(System.Windows.Shapes.Shape);
3417Type type = typeof(System.Windows.Shapes.Shape);
3434Type type = typeof(System.Windows.Controls.TextBlock);
3451Type type = typeof(System.Windows.Controls.TextBlock);
3468Type type = typeof(System.Windows.Controls.TextBlock);
3485Type type = typeof(System.Windows.Controls.TextBlock);
3502Type type = typeof(System.Windows.Controls.TextBlock);
3519Type type = typeof(System.Windows.Controls.TextBlock);
3536Type type = typeof(System.Windows.Controls.TextBlock);
3553Type type = typeof(System.Windows.Controls.TextBlock);
3570Type type = typeof(System.Windows.Controls.TextBlock);
3587Type type = typeof(System.Windows.Controls.TextBlock);
3604Type type = typeof(System.Windows.Controls.TextBlock);
3621Type type = typeof(System.Windows.Controls.TextBox);
3638Type type = typeof(System.Windows.Controls.TextBox);
3655Type type = typeof(System.Windows.Documents.TextElement);
3672Type type = typeof(System.Windows.Documents.TextElement);
3689Type type = typeof(System.Windows.Documents.TextElement);
3706Type type = typeof(System.Windows.Documents.TextElement);
3723Type type = typeof(System.Windows.Documents.TextElement);
3740Type type = typeof(System.Windows.Documents.TextElement);
3757Type type = typeof(System.Windows.Documents.TextElement);
3774Type type = typeof(System.Windows.Media.Animation.TimelineGroup);
3790Type type = typeof(System.Windows.Controls.Primitives.Track);
3807Type type = typeof(System.Windows.Controls.Primitives.Track);
3824Type type = typeof(System.Windows.Controls.Primitives.Track);
3841Type type = typeof(System.Windows.Controls.Primitives.Track);
3858Type type = typeof(System.Windows.Controls.Primitives.Track);
3875Type type = typeof(System.Windows.Controls.Primitives.Track);
3892Type type = typeof(System.Windows.Media.Media3D.Transform3DGroup);
3908Type type = typeof(System.Windows.Media.TransformGroup);
3924Type type = typeof(System.Windows.UIElement);
3941Type type = typeof(System.Windows.UIElement);
3958Type type = typeof(System.Windows.UIElement);
3975Type type = typeof(System.Windows.UIElement);
3992Type type = typeof(System.Windows.UIElement);
4009Type type = typeof(System.Windows.Controls.Viewport3D);
4026Type type = typeof(System.Windows.Controls.AdornedElementPlaceholder);
4043Type type = typeof(System.Windows.Documents.AdornerDecorator);
4060Type type = typeof(System.Windows.Documents.AnchoredBlock);
4077Type type = typeof(System.Windows.Markup.ArrayExtension);
4094Type type = typeof(System.Windows.Documents.BlockUIContainer);
4111Type type = typeof(System.Windows.Documents.Bold);
4128Type type = typeof(System.Windows.Media.Animation.BooleanAnimationUsingKeyFrames);
4145Type type = typeof(System.Windows.Controls.Border);
4162Type type = typeof(System.Windows.Controls.Primitives.BulletDecorator);
4179Type type = typeof(System.Windows.Controls.Button);
4197Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
4215Type type = typeof(System.Windows.Media.Animation.ByteAnimationUsingKeyFrames);
4232Type type = typeof(System.Windows.Controls.Canvas);
4249Type type = typeof(System.Windows.Media.Animation.CharAnimationUsingKeyFrames);
4266Type type = typeof(System.Windows.Controls.CheckBox);
4284Type type = typeof(System.Windows.Media.Animation.ColorAnimationUsingKeyFrames);
4301Type type = typeof(System.Windows.Controls.ComboBox);
4318Type type = typeof(System.Windows.Controls.ComboBoxItem);
4336Type type = typeof(System.Windows.Controls.ContextMenu);
4353Type type = typeof(System.Windows.Controls.ControlTemplate);
4370Type type = typeof(System.Windows.DataTemplate);
4387Type type = typeof(System.Windows.DataTrigger);
4404Type type = typeof(System.Windows.Media.Animation.DecimalAnimationUsingKeyFrames);
4421Type type = typeof(System.Windows.Controls.Decorator);
4438Type type = typeof(System.Windows.Controls.DockPanel);
4455Type type = typeof(System.Windows.Controls.DocumentViewer);
4471Type type = typeof(System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames);
4488Type type = typeof(System.Windows.EventTrigger);
4505Type type = typeof(System.Windows.Controls.Expander);
4523Type type = typeof(System.Windows.Documents.Figure);
4540Type type = typeof(System.Windows.Documents.FixedDocument);
4557Type type = typeof(System.Windows.Documents.FixedDocumentSequence);
4574Type type = typeof(System.Windows.Documents.FixedPage);
4591Type type = typeof(System.Windows.Documents.Floater);
4608Type type = typeof(System.Windows.Documents.FlowDocument);
4625Type type = typeof(System.Windows.Controls.FlowDocumentPageViewer);
4641Type type = typeof(System.Windows.FrameworkTemplate);
4658Type type = typeof(System.Windows.Controls.Grid);
4675Type type = typeof(System.Windows.Controls.GridView);
4692Type type = typeof(System.Windows.Controls.GridViewColumnHeader);
4710Type type = typeof(System.Windows.Controls.GroupBox);
4728Type type = typeof(System.Windows.Controls.GroupItem);
4746Type type = typeof(System.Windows.Controls.HeaderedContentControl);
4764Type type = typeof(System.Windows.Controls.HeaderedItemsControl);
4781Type type = typeof(System.Windows.HierarchicalDataTemplate);
4798Type type = typeof(System.Windows.Documents.Hyperlink);
4815Type type = typeof(System.Windows.Controls.InkCanvas);
4832Type type = typeof(System.Windows.Controls.InkPresenter);
4849Type type = typeof(System.Windows.Documents.InlineUIContainer);
4866Type type = typeof(System.Windows.Input.InputScopeName);
4884Type type = typeof(System.Windows.Media.Animation.Int16AnimationUsingKeyFrames);
4901Type type = typeof(System.Windows.Media.Animation.Int32AnimationUsingKeyFrames);
4918Type type = typeof(System.Windows.Media.Animation.Int64AnimationUsingKeyFrames);
4935Type type = typeof(System.Windows.Documents.Italic);
4952Type type = typeof(System.Windows.Controls.ItemsControl);
4969Type type = typeof(System.Windows.Controls.ItemsPanelTemplate);
4986Type type = typeof(System.Windows.Controls.Label);
5004Type type = typeof(System.Windows.Media.LinearGradientBrush);
5020Type type = typeof(System.Windows.Documents.List);
5037Type type = typeof(System.Windows.Controls.ListBox);
5054Type type = typeof(System.Windows.Controls.ListBoxItem);
5072Type type = typeof(System.Windows.Documents.ListItem);
5089Type type = typeof(System.Windows.Controls.ListView);
5106Type type = typeof(System.Windows.Controls.ListViewItem);
5124Type type = typeof(System.Windows.Media.Animation.MatrixAnimationUsingKeyFrames);
5141Type type = typeof(System.Windows.Controls.Menu);
5158Type type = typeof(System.Windows.Controls.Primitives.MenuBase);
5175Type type = typeof(System.Windows.Controls.MenuItem);
5192Type type = typeof(System.Windows.Media.Media3D.ModelVisual3D);
5209Type type = typeof(System.Windows.Data.MultiBinding);
5226Type type = typeof(System.Windows.MultiDataTrigger);
5243Type type = typeof(System.Windows.MultiTrigger);
5260Type type = typeof(System.Windows.Media.Animation.ObjectAnimationUsingKeyFrames);
5277Type type = typeof(System.Windows.Documents.PageContent);
5294Type type = typeof(System.Windows.Navigation.PageFunctionBase);
5312Type type = typeof(System.Windows.Controls.Panel);
5329Type type = typeof(System.Windows.Documents.Paragraph);
5346Type type = typeof(System.Windows.Media.Animation.ParallelTimeline);
5362Type type = typeof(System.Windows.Media.Animation.Point3DAnimationUsingKeyFrames);
5379Type type = typeof(System.Windows.Media.Animation.PointAnimationUsingKeyFrames);
5396Type type = typeof(System.Windows.Data.PriorityBinding);
5413Type type = typeof(System.Windows.Media.Animation.QuaternionAnimationUsingKeyFrames);
5430Type type = typeof(System.Windows.Media.RadialGradientBrush);
5446Type type = typeof(System.Windows.Controls.RadioButton);
5464Type type = typeof(System.Windows.Media.Animation.RectAnimationUsingKeyFrames);
5481Type type = typeof(System.Windows.Controls.Primitives.RepeatButton);
5499Type type = typeof(System.Windows.Controls.RichTextBox);
5516Type type = typeof(System.Windows.Controls.RichTextBox);
5533Type type = typeof(System.Windows.Media.Animation.Rotation3DAnimationUsingKeyFrames);
5550Type type = typeof(System.Windows.Documents.Run);
5567Type type = typeof(System.Windows.Controls.ScrollViewer);
5585Type type = typeof(System.Windows.Documents.Section);
5602Type type = typeof(System.Windows.Controls.Primitives.Selector);
5619Type type = typeof(System.Windows.Media.Animation.SingleAnimationUsingKeyFrames);
5636Type type = typeof(System.Windows.Media.Animation.SizeAnimationUsingKeyFrames);
5653Type type = typeof(System.Windows.Documents.Span);
5670Type type = typeof(System.Windows.Controls.StackPanel);
5687Type type = typeof(System.Windows.Controls.Primitives.StatusBar);
5704Type type = typeof(System.Windows.Controls.Primitives.StatusBarItem);
5722Type type = typeof(System.Windows.Media.Animation.Storyboard);
5738Type type = typeof(System.Windows.Media.Animation.StringAnimationUsingKeyFrames);
5755Type type = typeof(System.Windows.Style);
5772Type type = typeof(System.Windows.Controls.TabControl);
5789Type type = typeof(System.Windows.Controls.TabItem);
5807Type type = typeof(System.Windows.Controls.Primitives.TabPanel);
5824Type type = typeof(System.Windows.Documents.Table);
5841Type type = typeof(System.Windows.Documents.TableCell);
5858Type type = typeof(System.Windows.Documents.TableRow);
5875Type type = typeof(System.Windows.Documents.TableRowGroup);
5892Type type = typeof(System.Windows.Controls.TextBlock);
5909Type type = typeof(System.Windows.Media.Animation.ThicknessAnimationUsingKeyFrames);
5926Type type = typeof(System.Windows.Controls.Primitives.ToggleButton);
5944Type type = typeof(System.Windows.Controls.ToolBar);
5961Type type = typeof(System.Windows.Controls.Primitives.ToolBarOverflowPanel);
5978Type type = typeof(System.Windows.Controls.Primitives.ToolBarPanel);
5995Type type = typeof(System.Windows.Controls.ToolBarTray);
6012Type type = typeof(System.Windows.Controls.ToolTip);
6030Type type = typeof(System.Windows.Controls.TreeView);
6047Type type = typeof(System.Windows.Controls.TreeViewItem);
6064Type type = typeof(System.Windows.Trigger);
6081Type type = typeof(System.Windows.Documents.Underline);
6098Type type = typeof(System.Windows.Controls.Primitives.UniformGrid);
6115Type type = typeof(System.Windows.Controls.UserControl);
6133Type type = typeof(System.Windows.Media.Animation.Vector3DAnimationUsingKeyFrames);
6150Type type = typeof(System.Windows.Media.Animation.VectorAnimationUsingKeyFrames);
6167Type type = typeof(System.Windows.Controls.Viewbox);
6184Type type = typeof(System.Windows.Media.Media3D.Viewport3DVisual);
6201Type type = typeof(System.Windows.Controls.VirtualizingPanel);
6218Type type = typeof(System.Windows.Controls.VirtualizingStackPanel);
6235Type type = typeof(System.Windows.Window);
6253Type type = typeof(System.Windows.Controls.WrapPanel);
6270Type type = typeof(System.Windows.Data.XmlDataProvider);
6287Type type = typeof(System.Windows.Controls.ControlTemplate);
6304Type type = typeof(System.Windows.DataTemplate);
6321Type type = typeof(System.Windows.DataTemplate);
6340Type type = typeof(System.Windows.Controls.ControlTemplate);
6344typeof(System.Type), // type
6349bamlMember.TypeConverterType = typeof(System.Type);
6351bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Controls.ControlTemplate)target).TargetType = (System.Type)value; };
6360Type type = typeof(System.Windows.FrameworkElement);
6378Type type = typeof(System.Windows.FrameworkTemplate);
6397Type type = typeof(System.Windows.Controls.Grid);
6414Type type = typeof(System.Windows.Controls.Grid);
6431Type type = typeof(System.Windows.MultiTrigger);
6448Type type = typeof(System.Windows.NameScope);
6464Type type = typeof(System.Windows.Style);
6468typeof(System.Type), // type
6473bamlMember.TypeConverterType = typeof(System.Type);
6475bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Style)target).TargetType = (System.Type)value; };
6484Type type = typeof(System.Windows.Style);
6501Type type = typeof(System.Windows.Setter);
6519Type type = typeof(System.Windows.Setter);
6538Type type = typeof(System.Windows.Data.Binding);
6556Type type = typeof(System.Windows.ComponentResourceKey);
6575Type type = typeof(System.Windows.ComponentResourceKey);
6579typeof(System.Type), // type
6584bamlMember.TypeConverterType = typeof(System.Type);
6585bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.ComponentResourceKey)target).TypeInTargetAssembly = (System.Type)value; };
6594Type type = typeof(System.Windows.Data.Binding);
6611Type type = typeof(System.Windows.Data.Binding);
6630Type type = typeof(System.Windows.Data.Binding);
6647Type type = typeof(System.Windows.Data.Binding);
6665Type type = typeof(System.Windows.Media.Animation.Timeline);
6682Type type = typeof(System.Windows.Style);
6700Type type = typeof(System.Windows.Data.Binding);
6718Type type = typeof(System.Windows.Data.Binding);
6736Type type = typeof(System.Windows.ResourceDictionary);
6754Type type = typeof(System.Windows.Trigger);
6772Type type = typeof(System.Windows.Trigger);
6791Type type = typeof(System.Windows.Data.RelativeSource);
6795typeof(System.Type), // type
6800bamlMember.TypeConverterType = typeof(System.Type);
6801bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Data.RelativeSource)target).AncestorType = (System.Type)value; };
6810Type type = typeof(System.Windows.UIElement);
6827Type type = typeof(System.Windows.FrameworkContentElement);
6844Type type = typeof(System.Windows.FrameworkContentElement);
6862Type type = typeof(System.Windows.Style);
6880Type type = typeof(System.Windows.FrameworkTemplate);
6898Type type = typeof(System.Windows.Application);
6916Type type = typeof(System.Windows.Data.MultiBinding);
6933Type type = typeof(System.Windows.Data.MultiBinding);
6952Type type = typeof(System.Windows.Media.LinearGradientBrush);
6969Type type = typeof(System.Windows.Media.LinearGradientBrush);
6986Type type = typeof(System.Windows.Input.CommandBinding);
7004Type type = typeof(System.Windows.Condition);
7023Type type = typeof(System.Windows.Condition);
7041Type type = typeof(System.Windows.Condition);
7058Type type = typeof(System.Windows.Data.BindingBase);
7077Type type = typeof(System.Windows.Window);
7094Type type = typeof(System.Windows.Window);
7111Type type = typeof(System.Windows.Window);
7128Type type = typeof(System.Windows.Shapes.Shape);
7145Type type = typeof(System.Windows.Shapes.Shape);
7162Type type = typeof(System.Windows.Shapes.Shape);
7179Type type = typeof(System.Windows.Media.TileBrush);
7196Type type = typeof(System.Windows.Media.TileBrush);
7213Type type = typeof(System.Windows.Media.TileBrush);
7230Type type = typeof(System.Windows.Media.GeometryDrawing);
7246Type type = typeof(System.Windows.Controls.TextBox);
7263Type type = typeof(System.Windows.Controls.StackPanel);
7280Type type = typeof(System.Windows.Controls.Primitives.Track);
7297Type type = typeof(System.Windows.Controls.Primitives.Track);
7314Type type = typeof(System.Windows.Controls.Primitives.Track);
7331Type type = typeof(System.Windows.EventTrigger);
7349Type type = typeof(System.Windows.Input.InputBinding);
7366Type type = typeof(System.Windows.Input.KeyBinding);
7384Type type = typeof(System.Windows.Controls.TextBox);
7401Type type = typeof(System.Windows.Controls.TextBlock);
7418Type type = typeof(System.Windows.Navigation.JournalEntryUnifiedViewConverter);
7435Type type = typeof(System.Windows.Media.GradientBrush);
7452Type type = typeof(System.Windows.Controls.MenuItem);
7470Type type = typeof(System.Windows.DataTrigger);
7489Type type = typeof(System.Windows.DataTrigger);
7506Type type = typeof(System.Windows.Setter);
7525Type type = typeof(System.Windows.ResourceDictionary);
7543Type type = typeof(System.Windows.Media.Animation.BeginStoryboard);
7561Type type = typeof(System.Windows.ResourceDictionary);
7578Type type = typeof(System.Windows.Input.KeyboardNavigation);
7595Type type = typeof(System.Windows.Input.KeyboardNavigation);
7612Type type = typeof(System.Windows.Controls.Primitives.ScrollBar);
7629Type type = typeof(System.Windows.Trigger);
7648Type type = typeof(System.Windows.EventTrigger);
7666Type type = typeof(System.Windows.Controls.DefinitionBase);
7683Type type = typeof(System.Windows.Controls.ToolTipService);
7701Type type = typeof(System.Windows.Media.PathFigure);
7718Type type = typeof(System.Windows.Media.PathFigure);
7735Type type = typeof(System.Windows.Controls.Primitives.ButtonBase);
7752Type type = typeof(System.Windows.Documents.Block);
7769Type type = typeof(System.Windows.UIElement);
7786Type type = typeof(System.Windows.Media.Pen);
7803Type type = typeof(System.Windows.Controls.Primitives.BulletDecorator);
7820Type type = typeof(System.Windows.UIElement);
7837Type type = typeof(System.Windows.UIElement);
7854Type type = typeof(System.Windows.UIElement);
7871Type type = typeof(System.Windows.Media.SolidColorBrush);
7888Type type = typeof(System.Windows.Media.Brush);
7905Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
7922Type type = typeof(System.Windows.Media.PathSegment);
7939Type type = typeof(System.Windows.Controls.VirtualizingPanel);
7956Type type = typeof(System.Windows.Shapes.Shape);
7973Type type = typeof(System.Windows.Controls.Frame);
7990Type type = typeof(System.Windows.Controls.Frame);
8007Type type = typeof(System.Windows.Media.Animation.Storyboard);
8024Type type = typeof(System.Windows.Data.XmlDataProvider);
8042Type type = typeof(System.Windows.Controls.Primitives.Selector);
8059Type type = typeof(System.Windows.DataTemplate);
8079Type type = typeof(System.Windows.Shapes.Shape);
8096Type type = typeof(System.Windows.UIElement);
8113Type type = typeof(System.Windows.Controls.MenuItem);
8130Type type = typeof(System.Windows.Controls.Panel);
8147Type type = typeof(System.Windows.Data.Binding);
8165Type type = typeof(System.Windows.Window);
8182Type type = typeof(System.Windows.Data.ObjectDataProvider);
8186typeof(System.Type), // type
8191bamlMember.TypeConverterType = typeof(System.Type);
8192bamlMember.SetDelegate = delegate(object target, object value) { ((System.Windows.Data.ObjectDataProvider)target).ObjectType = (System.Type)value; };
8201Type type = typeof(System.Windows.Controls.ToolBar);
8219Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
8236Type type = typeof(System.Windows.Controls.Primitives.TextBoxBase);
8253Type type = typeof(System.Windows.FrameworkElement);
8270Type type = typeof(System.Windows.MultiDataTrigger);
8287Type type = typeof(System.Windows.Input.KeyBinding);
8304Type type = typeof(System.Windows.Data.Binding);
8323Type type = typeof(System.Windows.Controls.Canvas);
8340Type type = typeof(System.Windows.Controls.Canvas);
8357Type type = typeof(System.Windows.Controls.Canvas);
8374Type type = typeof(System.Windows.Controls.Canvas);
8391Type type = typeof(System.Windows.Media.Animation.Storyboard);
System\Windows\Markup\Baml2006\WpfGeneratedKnownTypes.cs (22)
1776new List<Type>() { typeof(System.Type) },
1780(System.Type)arguments[0]);
1856new List<Type>() { typeof(System.String) },
2699new List<Type>() { typeof(System.Object) },
2829new List<Type>() { typeof(System.Type), typeof(System.Object) },
2833(System.Type)arguments[0],
3169new List<Type>() { typeof(System.Object) },
4037new List<Type>() { typeof(System.Object) },
8298new List<Type>() { typeof(System.Windows.Data.RelativeSourceMode) },
8305new List<Type>() { typeof(System.Windows.Data.RelativeSourceMode), typeof(System.Type), typeof(System.Int32) },
8310(System.Type)arguments[1],
9428new List<Type>() { typeof(System.String) },
9447new List<Type>() { typeof(System.Object) },
9879new List<Type>() { typeof(System.Windows.DependencyProperty) },
10093new List<Type>() { typeof(System.String) },
10655new List<Type>() { typeof(System.Type) },
10659(System.Type)arguments[0]);
11834new List<Type>() { typeof(System.Object) },
System\Windows\Markup\BamlMapTable.cs (47)
102internal static Type GetKnownTypeFromId(short id)
131Type probeType = KnownTypes.Types[probe];
166internal static short GetKnownTypeIdFromType(Type type)
204internal static KnownElements GetKnownTypeConverterIdFromType(Type type)
211else if (type == typeof(System.Type))
234internal TypeConverter GetKnownConverterFromType(Type type)
254internal static TypeConverter GetKnownConverterFromType_NoCache(Type type)
288internal Type GetKnownConverterTypeFromType(Type type)
309if (type == typeof(System.Type))
334private static Type GetKnownConverterTypeFromPropName(
335Type propOwnerType,
409internal Type GetTypeFromId(short id)
411Type type = null;
519private short GetAssemblyIdForType(Type t)
539Type propType,
586Type t = GetTypeFromId(typeId);
650Type ownerType = record.OwnerType;
764internal Type GetTypeFromTypeInfo(BamlTypeInfoRecord typeInfo)
784Type type = assembly.GetType(typeInfo.TypeFullName);
797private Type GetAttributeOwnerType(BamlAttributeInfoRecord bamlAttributeInfoRecord)
819internal Type GetCLRPropertyTypeAndNameFromId(short attributeId, out string propName)
822Type propType = null;
855internal DependencyProperty GetDependencyPropertyValueFromId(short memberId, string memberName, out Type declaringType)
902Type declaringType = GetTypeFromId(ownerTypeId);
948Type ownerType = GetAttributeOwnerType(bamlAttributeInfoRecord);
961internal short GetAttributeOrTypeId(BinaryWriter binaryWriter, Type declaringType, string memberName, out short typeId)
1215Type elementType,
1299Type owningType, // Actual type of the object the owns or declares this attribute
1301Type attributeType, // Type of the attribute or property itself; not its owner type
1312Type owningType, // Actual type of the object the owns or declares this attribute
1314Type attributeType, // Type of the attribute or property itself; not its owner type
1326Type serializerType = XamlTypeMapper.GetXamlSerializerForType(owningType);
1377Type ownerType, // Type of object that owns or declares this attribute
1378Type attributeType, // Type of the attribute or property itself; not its owner type
1382out Type converterOrSerializerType)
1493Type defaultTargetType)
1496Type targetType = null;
1542Type declaringType, // Type of object that owns or declares this attribute
1543Type attributeType) // Type of the attribute or property itself; not its owner type
1561private Type GetCustomConverter(
1563Type ownerType, // Type of object that owns or declares this attribute
1565Type attributeType) // Type of the attribute or property itself; not its owner type
1568Type converterType = GetKnownConverterTypeFromPropName(ownerType, fieldName);
1602private Type GetCustomSerializer(
1603Type type,
1717private TypeConverter GetConverterFromCache(Type type)
System\Windows\Markup\BamlRecordReader.cs (37)
848out Type delayCreatedType,
852Type elementType = MapTable.GetTypeFromId(typeId);
890protected ReaderFlags GetFlagsFromType(Type elementType)
1009Type delayCreatedType = null;
1256Type elementType = MapTable.GetTypeFromId(bamlElementRecord.TypeId);
1399Type elementType = ParentContext.ExpectedType;
1428Type t = param as Type;
1477Type ownerType = ParserContext.TargetType;
2103Type declaringType = null;
2108out Type declaringType)
2147internal object GetCustomValue(BamlPropertyCustomRecord bamlPropertyRecord, Type propertyType, string propertyName)
2653Type valueType = MapTable.GetTypeFromId(bamlPropertyRecord.TypeId);
3036Type expectedType = holder.PropertyType;
3363Type keyType = MapTable.GetTypeFromId(bamlDefAttributeRecord.TypeId);
3680Type propertyType = null;
3754static private Type NullableType = typeof(Nullable<>);
3756static internal bool IsNullable(Type t)
3763internal object OptionallyMakeNullable(Type propertyType, object o, string propName)
3770((Type)propertyType.GetGenericArguments()[0]).Name,
3781static internal bool TryOptionallyMakeNullable( Type propertyType, string propName, ref object o )
3787Type genericType = (Type)propertyType.GetGenericArguments()[0];
3963Type propertyType,
4005Type propertyType)
4014if (propertyType == typeof(Type))
4037object GetObjectFromString(Type type, string s, short converterTypeId)
4291Type expectedType,
4301Type expectedType,
4775Type parentType = GetParentType();
4793Type parentType = GetParentType();
4808private Type GetParentType()
4864Type elementType;
5115Type currentParentType;
5221Type type,
5772Type currentParentType = currentParent.GetType();
5831public Type PropertyType
System\Windows\Markup\MarkupExtensionParser.cs (25)
43ref Type baseType,
44ref Type serializerType);
71Type declaringType, // Type where propIdName is declared
96Type declaringType,
156private KnownElements GetKnownExtensionFromType(Type extensionType, out string propName)
196Type extensionType,
233Type extensionType,
307Type targetType)
451Type declaringType, // Type where attribute is declared
462Type targetType;
463Type serializerType;
485Type declaringType, // Type where propIdName is declared
498Type targetType;
499Type serializerType;
559out Type targetType,
560out Type serializerType)
646Type propertyType;
919Type extensionType)
1205private ParameterInfo[] FindLongestConstructor(Type extensionType, out int maxConstructorArguments)
1383Type declaringType;
1499Type parentType,
1517Type declaringType;
1552Type typeValue = _parserContext.XamlTypeMapper.GetTypeFromBaseString(value,
1652Type elementBaseType,
1659out Type declaringType, // type of the object that the field is on
System\Windows\Markup\Primitives\ElementMarkupObject.cs (47)
58public override Type ObjectType
221Type ownerType = dpd.DependencyProperty.OwnerType;
248Type instanceType = instance.GetType();
297public ShouldSerializeKey(Type type, string propertyName)
332private Type _type;
411private static Type[] _shouldSerializeArgsObject = new Type[] { typeof(DependencyObject) };
412private static Type[] _shouldSerializeArgsManager = new Type[] { typeof(XamlDesignerSerializationManager) };
413private static Type[] _shouldSerializeArgsMode = new Type[] { typeof(XamlWriterMode) };
414private static Type[] _shouldSerializeArgsObjectManager = new Type[] { typeof(DependencyObject), typeof(XamlDesignerSerializationManager) };
507Type keyType = GetDictionaryKeyType(dictionary);
628static readonly List<Type> EmptyTypes = new List<Type>();
630public override IEnumerable<Type> TypeReferences
656protected abstract Type GetObjectType();
692private static Dictionary<Type, Type> _keyTypeMap;
694private static Type GetDictionaryKeyType(IDictionary value)
696Type type = value.GetType();
697Type result;
700_keyTypeMap = new Dictionary<Type, Type>();
703foreach (Type interfaceType in type.GetInterfaces())
707Type genericTypeDefinition = interfaceType.GetGenericTypeDefinition();
737protected override Type GetObjectType()
761public override Type PropertyType
896Type propertyType,
921Type type = value as Type;
927if( propertyType == typeof(Type) )
942ValueSerializer typeSerializer = context.GetValueSerializerFor(typeof(Type));
983public override Type PropertyType
1023public override IEnumerable<Type> TypeReferences
1042internal ElementPseudoPropertyBase(object value, Type type, ElementMarkupObject obj) : base(obj)
1048public override Type PropertyType
1063public override IEnumerable<Type> TypeReferences
1065get { return Array.Empty<Type>(); }
1069private Type _type;
1077internal ElementKey(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
1095internal ElementConstructorArgument(object value, Type type, ElementMarkupObject obj) : base(value, type, obj) { }
1113internal ElementItemsPseudoProperty(IEnumerable value, Type type, ElementMarkupObject obj) : base(value, type, obj)
1152internal ElementDictionaryItemsPseudoProperty(IDictionary value, Type type, ElementMarkupObject obj) : base(value, type, obj)
1205public ValueSerializer GetValueSerializerFor(Type type)
1260public object GetService(Type serviceType)
System\Windows\Markup\XamlTypeMapper.cs (83)
116public Type GetType(
457Type owner,
461Type baseType = null;
513Type propType,
731Type propType,
786Type owner,
811Type ownerType,
832Type currentParentType,
874Type propertyOwnerType = attributeInfo.OwnerType;
949Type owner,
1192protected virtual bool AllowInternalType(Type type)
1197private bool IsInternalTypeAllowedInFullTrust(Type type)
1224Type owner,
1254Type owner,
1284Type objectType = typeAndSerializer.ObjectType;
1305Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1439Type baseType = owner;
1464Type dependencyObjectType = KnownTypes.Types[(int)KnownElements.DependencyObject];
1599Type owner,
1641Type owner,
1644ref Type baseType,
1776ref Type ownerType)
1913Type ownerType,
2005Type ownerType)
2008Type currentType = ownerType;
2031internal static Type GetPropertyType(object propertyMember)
2033Type propertyType;
2048out Type propertyType,
2127internal static Type GetDeclaringType(object propertyMember)
2129Type validType = null;
2166internal static Type GetTypeFromName(string typeName, DependencyObject element)
2218Type t = assy.GetType(fullTypeName);
2238Type t = assy.GetType(fullTypeName);
2252internal Type GetTargetTypeAndMember(string valueParam,
2267Type targetType = null;
2303internal Type GetDependencyPropertyOwnerAndName(string memberValue,
2305Type defaultTargetType,
2308Type targetType = GetTargetTypeAndMember(memberValue, context, false, out memberName);
2335internal MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly)
2375private MemberInfo GetStaticMemberInfo(Type targetType, string memberName, bool fieldInfoOnly, bool tryInternal)
2548Type objectType = GetObjectType(namespaceMap, localName, knownTypesOnly);
2598private Type GetObjectType(
2606Type type = null;
2674internal int GetCustomBamlSerializerIdForType(Type objectType)
2715internal Type GetXamlSerializerForType(Type objectType)
2731internal static Type GetInternalTypeHelperTypeFromAssembly(ParserContext pc)
2739Type ithType = a.GetType($"{GeneratedNamespace}.{GeneratedInternalTypeHelperClassName}");
2759Type ithType = GetInternalTypeHelperTypeFromAssembly(pc);
2767internal static object CreateInternalInstance(ParserContext pc, Type type)
2811internal static Delegate CreateDelegate(ParserContext pc, Type delegateType, object target, string handler)
2856internal Type GetTypeFromBaseString(
2862Type keyObject = null;
2993private TypeInformationCacheData GetCachedInformationForType(Type type)
3014private Type GetCachedBaseType(Type t)
3070ref Type ownerType)
3093Type ownerType)
3113internal object CreateInstance(Type t)
3408private string GetCachedNamespace(Type t)
3449internal Type GetTypeConverterType(Type type)
3453Type converterType = null;
3480internal TypeConverter GetTypeConverter(Type type)
3500Type converterType = TypeConverterHelper.GetConverterType(type);
3524internal Type GetPropertyConverterType(Type propType, object dpOrPiOrMi)
3527Type converterType = null;
3568internal TypeConverter GetPropertyConverter(Type propType, object dpOrPiOrMi)
3591Type converterType = TypeConverterHelper.GetConverterType(memberInfo);
3646internal ConstructorData GetConstructors(Type type)
3735internal bool GetCachedTrimSurroundingWhitespace(Type t)
3753private bool GetTrimSurroundingWhitespace(Type type)
3935internal TypeInformationCacheData(Type baseType)
3956internal Type BaseType
3972internal Type TypeConverterType
4018Type ownerType,
4072Type _baseType;
4080Type _typeConverterType;
4090Type ot,
4103public Type OwnerType;
4211public Type ObjectType = null;
4212public Type SerializerType = null;
System\Windows\Navigation\JournalEntryListConverter.cs (4)
37public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
47public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
114public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
136public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
System\Windows\PropertyPath.cs (9)
60public Type type; // user-specified type
308internal object ResolvePropertyName(int level, object item, Type ownerType, object context)
550object ResolvePropertyName(string name, object item, Type ownerType, object context, bool throwOnError)
655private PropertyInfo GetPropertyHelper(Type ownerType, string propertyName)
780object GetTypedParamValue(string param, Type type, bool throwOnError)
835Type GetTypeFromName(string name, object context)
884ValueSerializer typeSerializer = ValueSerializer.GetSerializerFor(typeof(Type), serializerContext);
886return typeSerializer.ConvertFromString(name, serializerContext) as Type;
908Type 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)
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 (610)
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 (80)
26private Dictionary<Type, ReflectedTypeData>? _typeData;
32private static readonly Type[] s_typeConstructor = { typeof(Type) };
63private static readonly Type[] s_skipInterfaceAttributeList = InitializeSkipInterfaceAttributeList();
73private static Type[] InitializeSkipInterfaceAttributeList()
75return 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)
301[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
302Type callingType)
311internal AttributeCollection GetAttributes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
344internal string? GetClassName([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
353internal string? GetClassNameFromRegisteredType(Type type)
372internal TypeConverter GetConverter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
378internal TypeConverter GetConverterFromRegisteredType(Type type, object? instance)
389internal EventDescriptor? GetDefaultEvent([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
399internal PropertyDescriptor? GetDefaultProperty([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance)
409internal object? GetEditor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, object? instance, Type editorBaseType)
419private static Hashtable? GetEditorTable(Type editorBaseType)
465internal EventDescriptorCollection GetEvents([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
471internal EventDescriptorCollection GetEventsFromRegisteredType(Type type)
535internal object? GetExtendedEditor(object instance, Type editorBaseType)
564Type componentType = instance.GetType();
616Type? receiverType = eppa.ReceiverType;
830public override ICustomTypeDescriptor? GetTypeDescriptorFromRegisteredType(Type objectType, object? instance)
862internal Type[] GetPopulatedTypes(Module module)
864List<Type> typeList = new List<Type>();
868Dictionary<Type, ReflectedTypeData>? typeData = _typeData;
871foreach (KeyValuePair<Type, ReflectedTypeData> kvp in typeData)
888internal PropertyDescriptorCollection GetProperties([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
897internal PropertyDescriptorCollection GetPropertiesFromRegisteredType(Type type)
906internal static object GetPropertyOwner(Type type, object instance)
916public override Type GetReflectionType(
917[DynamicallyAccessedMembers(TypeDescriptor.ReflectTypesDynamicallyAccessedMembers)] Type objectType,
929private ReflectedTypeData? GetTypeData([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, bool createIfNeeded)
962_typeData ??= new Dictionary<Type, ReflectedTypeData>();
970private ReflectedTypeData GetTypeDataFromRegisteredType(Type type)
994Type componentType = typeof(T);
1012_typeData ??= new Dictionary<Type, ReflectedTypeData>();
1018private ReflectedTypeData GetOrRegisterType(Type type)
1037_typeData ??= new Dictionary<Type, ReflectedTypeData>();
1053public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
1065private static Type? GetTypeFromName(
1069Type? t = Type.GetType(typeName);
1086t = Type.GetType(typeName.Substring(0, commaIndex));
1099internal bool IsPopulated(Type type)
1116internal static Attribute[] ReflectGetAttributes(Type type)
1172private static EventDescriptor[] ReflectGetEvents(Type type)
1273Type providerType = provider.GetType();
1296Type? receiverType = GetTypeFromName(provideAttr.ReceiverTypeName);
1300MethodInfo? getMethod = providerType.GetMethod("Get" + provideAttr.PropertyName, new Type[] { receiverType });
1304MethodInfo? setMethod = providerType.GetMethod("Set" + provideAttr.PropertyName, new Type[] { receiverType, getMethod.ReturnType });
1349[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type) =>
1352private static PropertyDescriptor[] ReflectGetPropertiesFromRegisteredType(Type type)
1357private static PropertyDescriptor[] ReflectGetPropertiesImpl(Type type)
1441internal void Refresh(Type type)
1457private static object? GetIntrinsicTypeEditor(Hashtable table, Type callingType)
1468Type? baseType = callingType;
1479hashEntry = Type.GetType(typeString);
1504Type? keyType = de.Key as Type;
1513hashEntry = Type.GetType(typeString);
1555Type? type = hashEntry as Type;
1575private static TypeConverter GetIntrinsicTypeConverter(Type callingType)
1613Type? key = null;
1615Type? baseType = callingType.BaseType;
1641private 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)
52private static readonly Dictionary<Type, TypeDescriptionNode> s_providerTypeTable = new Dictionary<Type, TypeDescriptionNode>();
57private static readonly Dictionary<Type, object?> s_defaultProviderInitialized = new Dictionary<Type, object?>();
128public static Type InterfaceType
162internal static void ValidateRegisteredType(Type type)
182public static TypeDescriptionProvider AddAttributes(Type type, params Attribute[] attributes)
223public static void AddEditorTable(Type editorBaseType, Hashtable table)
238public static void AddProvider(TypeDescriptionProvider provider, Type type)
298public static void AddProviderTransparent(TypeDescriptionProvider provider, Type type)
327private static void CheckDefaultProvider(Type type)
347private static void AddDefaultProvider(Type type)
369Type? providerType = Type.GetType(pa.TypeName);
381Type? baseType = type.BaseType;
447[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
449Type type,
460[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
474[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
475Type[]? argTypes,
507[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
509Type type,
521[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
602public static object GetAssociation(Type type, object primary)
672public static AttributeCollection GetAttributes([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
804[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
859public static TypeConverter GetConverter([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
866internal static TypeConverter GetConverterTrimUnsafe([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type) =>
872public static TypeConverter GetConverterFromRegisteredType(Type type)
879private static object? ConvertFromInvariantString([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, string stringValue)
889[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
927[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
965[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
979private static DefaultTypeDescriptor GetDescriptorFromRegisteredType(Type type,
1052public static object? GetEditor(object component, Type editorBaseType)
1063public static object? GetEditor(object component, Type editorBaseType, bool noCustomTypeDesc)
1075[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
1076Type editorBaseType)
1087[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
1101public static EventDescriptorCollection GetEventsFromRegisteredType(Type componentType)
1113[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
1306private static Type? GetNodeForBaseType(Type searchType)
1324[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType)
1338public static PropertyDescriptorCollection GetPropertiesFromRegisteredType(Type componentType)
1350[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type componentType,
1521public static TypeDescriptionProvider GetProvider(Type type)
1589internal static TypeDescriptionProvider GetProviderRecursive(Type type)
1599public static Type GetReflectionType([DynamicallyAccessedMembers(ReflectTypesDynamicallyAccessedMembers)] Type type)
1611public static Type GetReflectionType(object instance)
1625private static TypeDescriptionNode NodeFor(Type type) => NodeFor(type, false);
1642private static TypeDescriptionNode NodeFor(Type type, bool createDelegator)
1654Type searchType = type;
1665Type? baseType = GetNodeForBaseType(searchType);
1737Type type = instance.GetType();
1848Type keyType = key as Type ?? key.GetType();
2286private static void RaiseRefresh(Type type)
2315Type type = component.GetType();
2328Type? nodeType = de.Key as Type;
2386public static void Refresh(Type type)
2412Type? nodeType = de.Key as Type;
2473Type? nodeType = de.Key as Type;
2487Type[] populatedTypes = provider.GetPopulatedTypes(module);
2489foreach (Type populatedType in populatedTypes)
2503foreach (Type t in refreshedTypes.Keys)
2529public static Type ComObjectType
2537public static IDesigner? CreateDesigner(IComponent component, Type designerBaseType)
2539Type? type = null;
2546Type? type2 = Type.GetType(designerAttribute.DesignerBaseTypeName);
2559type = Type.GetType(designerAttribute.DesignerTypeName);
2657public static void RemoveProvider(TypeDescriptionProvider provider, Type type)
2692public static void RemoveProviderTransparent(TypeDescriptionProvider provider, Type type)
2773public override ICustomTypeDescriptor? GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
2832object ICustomTypeDescriptor.GetEditor(Type editorBaseType)
2884public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3051Type realComNativeDescriptor = Type.GetType("System.Windows.Forms.ComponentModel.Com2Interop.ComNativeDescriptor, System.Windows.Forms", throwOnError: true)!;
3056public override ICustomTypeDescriptor? GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3146object? ICustomTypeDescriptor.GetEditor(Type editorBaseType)
3241[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type objectType,
3242Type[]? argTypes,
3292Type type = instance.GetType();
3330public override Type GetReflectionType(
3331[DynamicallyAccessedMembers(ReflectTypesDynamicallyAccessedMembers)] Type objectType,
3339public override Type GetRuntimeType(Type objectType)
3350public override ICustomTypeDescriptor GetTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType, object? instance)
3366public override ICustomTypeDescriptor GetTypeDescriptorFromRegisteredType(Type objectType, object? instance)
3387internal DefaultTypeDescriptor GetDefaultTypeDescriptor([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType)
3392public override bool IsSupportedType(Type type)
3401public override bool IsRegisteredType(Type type) => Provider.IsRegisteredType(type);
3580object? ICustomTypeDescriptor.GetEditor(Type editorBaseType)
3770private readonly Type _objectType;
3778[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type objectType,
3974public object? GetEditor(Type editorBaseType)
4207internal 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 (134)
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)
291public static DataStorage CreateStorage(DataColumn column, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.PublicFields)] Type dataType, StorageType typeCode)
358internal static StorageType GetStorageType(Type? dataType)
367TypeCode tcode = Type.GetTypeCode(dataType);
375internal static Type GetTypeStorage(StorageType storageType)
381internal static bool IsTypeCustomType(Type type)
396public static bool IsSqlType(Type dataType)
408private static bool DetermineIfValueType(StorageType typeCode, Type dataType)
467Type dataType,
507private static Tuple<bool, bool, bool, bool> InspectTypeForInterfaces(Type dataType)
518internal static bool ImplementsINullableValue(StorageType typeCode, Type dataType)
568internal static Type GetType(string value)
570Type? dataType = Type.GetType(value); // throwOnError=false, ignoreCase=fase
589internal 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();
320Type type = _dataType; // real type of objects in this column
326if (type == typeof(Type))
328return Type.GetType(s)!;
367Type? type = null;
399retValue = Type.GetType(xmlReader.ReadString());
464Type type = _dataType;
469if ((type == typeof(Type)) || ((type == typeof(object)) && (value is Type)))
471return ((Type)value).AssemblyQualifiedName!;
479if (Type.GetTypeCode(value.GetType()) != TypeCode.Object)
548private static Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>? s_tempAssemblyCache;
558internal static void VerifyIDynamicMetaObjectProvider(Type type)
568internal static XmlSerializer GetXmlSerializer(Type type)
580internal static XmlSerializer GetXmlSerializer(Type type, XmlRootAttribute attribute)
583KeyValuePair<Type, XmlRootAttribute> key = new KeyValuePair<Type, XmlRootAttribute>(type, attribute);
586Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>? cache = s_tempAssemblyCache;
603Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer> tmp =
604new Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>(
606foreach (KeyValuePair<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer> entry in cache)
614cache = new Dictionary<KeyValuePair<Type, XmlRootAttribute>, XmlSerializer>(
620key = new KeyValuePair<Type, XmlRootAttribute>(type, new XmlRootAttribute());
635private sealed class TempAssemblyComparer : IEqualityComparer<KeyValuePair<Type, XmlRootAttribute>>
637internal static readonly IEqualityComparer<KeyValuePair<Type, XmlRootAttribute>> s_default = new TempAssemblyComparer();
641public bool Equals(KeyValuePair<Type, XmlRootAttribute> x, KeyValuePair<Type, XmlRootAttribute> y)
652public 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)
477public Type DataType
1483Type leftType = value.GetType();
1484Type rightType = _storage!.Get(record1).GetType();
1610internal static bool IsAutoIncrementType(Type dataType) =>
1630(DataStorage.IsTypeCustomType(value.GetType()) && !(value is Type));
1872internal abstract Type DataType { get; }
1909internal override Type DataType => typeof(long);
1990internal 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)
1899/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1901public void WriteXmlSchema(Stream? stream, Converter<Type, string> multipleTargetConverter)
1914/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1916public void WriteXmlSchema(string fileName, Converter<Type, string> multipleTargetConverter)
1929/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1931public void WriteXmlSchema(TextWriter? writer, Converter<Type, string> multipleTargetConverter)
1944/// <param name="multipleTargetConverter">A delegate used to convert <see cref='Type'/> into string.</param>
1946public void WriteXmlSchema(XmlWriter? writer, Converter<Type, string> multipleTargetConverter)
1953private void WriteXmlSchema(string fileName, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
1970private void WriteXmlSchema(Stream? stream, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
1984private void WriteXmlSchema(TextWriter? writer, SchemaFormat schemaFormat, Converter<Type, string>? multipleTargetConverter)
1998private 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\DiagnosticSourceEventSource.cs (21)
1031Type argType = args.GetType();
1058new ConcurrentDictionary<Type, TransformSpec?>(1, 8), null);
1102private static TransformSpec? MakeImplicitTransforms(Type type)
1134private ConcurrentDictionary<Type, TransformSpec?>? _implicitTransformsTable; // If there is more than one object type for an implicit transform, they go here.
1144public Type? Type;
1257Type? objType = obj?.GetType();
1281public PropertyFetch(Type? type)
1290internal Type? Type { get; }
1299public static PropertyFetch FetcherForProperty(Type? type, string propertyName)
1313foreach (Type iFaceType in typeInfo.GetInterfaces())
1362private static PropertyFetch CreateEnumeratePropertyFetch(Type type, TypeInfo enumerableOfTType)
1364Type elemType = enumerableOfTType.GetGenericArguments()[0];
1371Type instantiatedTypedPropertyFetcher = typeof(EnumeratePropertyFetch<>)
1378private static PropertyFetch CreatePropertyFetch(Type type, PropertyInfo propertyInfo)
1386Type typedPropertyFetcher = type.IsValueType ?
1388Type instantiatedTypedPropertyFetcher = typedPropertyFetcher.GetTypeInfo().MakeGenericType(
1402public RefTypedFetchProperty(Type type, PropertyInfo property) : base(type)
1421public ValueTypedFetchProperty(Type type, PropertyInfo property) : base(type)
1444public ReflectionPropertyFetch(Type type, PropertyInfo property) : base(type)
1457public EnumeratePropertyFetch(Type type) : base(type) { }
1522public EnumeratePropertyFetch(Type type) : base(type) { }
System\Diagnostics\Metrics\Meter.cs (2)
469private static Instrument? GetCachedInstrument(List<Instrument> instrumentList, Type instrumentType, string? unit, string? description, IEnumerable<KeyValuePair<string, object?>>? tags)
485private 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.Primitives (1)
System.Formats.Asn1 (13)
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 (2005)
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)
75public static unsafe Array CreateInstance(Type elementType, int length)
89public static unsafe Array CreateInstance(Type elementType, int length1, int length2)
105public static unsafe Array CreateInstance(Type elementType, int length1, int length2, int length3)
121public static unsafe Array CreateInstance(Type elementType, params int[] lengths)
146public static unsafe Array CreateInstance(Type elementType, int[] lengths, int[] lowerBounds)
175public static Array CreateInstance(Type elementType, params long[] lengths)
198/// <returns>A new one-dimensional <see cref="Array"/> of the specified <see cref="Type"/> with the specified length.</returns>
205/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int)"/>, as it has
207public static unsafe Array CreateInstanceFromArrayType(Type arrayType, int length)
226/// Creates a multidimensional <see cref="Array"/> of the specified <see cref="Type"/> and dimension lengths, with zero-based indexing.
242/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int[])"/>, as it has
244public static unsafe Array CreateInstanceFromArrayType(Type arrayType, params int[] lengths)
272/// Creates a multidimensional <see cref="Array"/> of the specified <see cref="Type"/> and dimension lengths, with the specified lower bounds.
277/// <returns>A new multidimensional <see cref="Array"/> of the specified <see cref="Type"/> with the specified length and lower bound for each dimension.</returns>
294/// <remarks>When the array type is readily available, this method should be preferred over <see cref="CreateInstance(Type, int[], int[])"/>, as it has
296public 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.All)] Type target, string method) => CreateDelegate(type, target, method, ignoreCase: false, throwOnBindFailure: true)!;
68public static Delegate CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type target, string method, bool ignoreCase) => CreateDelegate(type, target, method, ignoreCase, throwOnBindFailure: true)!;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (34)
303public static Guid GetGuid(Type eventSourceType)
332public static string GetName(Type eventSourceType)
355Type eventSourceType,
378Type eventSourceType,
695Type myType = this.GetType();
1671private static string GetName(Type eventSourceType, EventManifestOptions flags)
1702private static unsafe void DecodeObjects(object?[] decodedObjects, Type[] parameterTypes, EventData* data)
1707Type dataType = parameterTypes[i];
1721TypeCode typeCode = Type.GetTypeCode(dataType);
2042Type pType = infos[i].ParameterType;
2167new TraceLoggingEventTypes(EventName, EventTags.None, new Type[] { typeof(string) });
2485private Type[]? _parameterTypes;
2486public Type[] ParameterTypes
2492static Type[] GetParameterTypes(ParameterInfo[] parameters)
2494var types = new Type[parameters.Length];
2916Type attributeType,
2947Type attributeType,
3009private static bool AttributeTypeNamesMatch(Type attributeType, Type reflectedAttributeType)
3023private static Type? GetEventSourceBaseType(Type eventSourceType, bool allowEventSourceOverride, bool reflectionOnly)
3025Type? ret = eventSourceType;
3065Type eventSourceType,
3135Type? nestedType = eventSourceType.GetNestedType(providerEnumKind);
3400Type staticFieldType = staticField.FieldType;
3469Type dataType = parameter.ParameterType;
3475(dataType.IsEnum && Type.GetTypeCode(dataType.GetEnumUnderlyingType()) <= TypeCode.UInt32))
5357public void AddEventParameter(Type type, string name)
5385mapsTab ??= new Dictionary<string, Type>();
5543static FieldInfo[] GetEnumFields(Type localEnumType)
5552foreach (Type enumType in mapsTab.Values)
5865private string GetTypeName(Type type)
5880switch (Type.GetTypeCode(type))
6032private 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)
62Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
89public static string? GetName(Type enumType, object value)
107Type underlyingType = enumType.GetEnumUnderlyingType();
108switch (Type.GetTypeCode(underlyingType)) // can't use InternalGetCorElementType as enumType may actually be the underlying type
226Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
250public static string[] GetNames(Type enumType)
283public static Type GetUnderlyingType(Type enumType)
309public static Array GetValues(Type enumType)
334public static Array GetValuesAsUnderlyingType(Type enumType)
477Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
521public static bool IsDefined(Type enumType, object value)
550public static object Parse(Type enumType, string value) =>
562public static object Parse(Type enumType, ReadOnlySpan<char> value) =>
578public static object Parse(Type enumType, string value, bool ignoreCase)
603public static object Parse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase)
674public static bool TryParse(Type enumType, string? value, [NotNullWhen(true)] out object? result) =>
682public static bool TryParse(Type enumType, ReadOnlySpan<char> value, [NotNullWhen(true)] out object? result) =>
694public static bool TryParse(Type enumType, string? value, bool ignoreCase, [NotNullWhen(true)] out object? result)
714public static bool TryParse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase, [NotNullWhen(true)] out object? result) =>
718private static unsafe bool TryParse(Type enumType, ReadOnlySpan<char> value, bool ignoreCase, bool throwOnFailure, [NotNullWhen(true)] out object? result)
894Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
1003Type underlyingType = GetUnderlyingType(enumType);
1152Type valueType = value.GetType();
1626public static string Format(Type enumType, object value, [StringSyntax(StringSyntaxAttribute.EnumFormat)] string format)
1633Type valueType = value.GetType();
1649Type underlyingType = GetUnderlyingType(rtType);
1752Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
1811Type underlyingType = typeof(TEnum).GetEnumUnderlyingType();
2127private static RuntimeType ValidateRuntimeType(Type enumType)
2148private static void ThrowInvalidRuntimeType(Type enumType) =>
2193object IConvertible.ToType(Type type, IFormatProvider? provider) => Convert.DefaultToType(this, type, provider);
2195public static object ToObject(Type enumType, object value)
2215Type valueType = value.GetType();
2228public static object ToObject(Type enumType, sbyte value) =>
2231public static object ToObject(Type enumType, short value) =>
2234public static object ToObject(Type enumType, int value) =>
2237public static object ToObject(Type enumType, byte value) =>
2241public static object ToObject(Type enumType, ushort value) =>
2245public static object ToObject(Type enumType, uint value) =>
2248public static object ToObject(Type enumType, long value) =>
2252public static object ToObject(Type enumType, ulong value) =>
src\libraries\System.Private.CoreLib\src\System\Reflection\Assembly.cs (17)
31Type[] types = GetTypes();
46public virtual Type[] GetTypes()
55Type[][] moduleTypes = new Type[m.Length][];
64Type[] ret = new Type[finalLength];
75public virtual IEnumerable<Type> ExportedTypes
81public virtual Type[] GetExportedTypes() { throw NotImplemented.ByDesign; }
83public virtual Type[] GetForwardedTypes() { throw NotImplemented.ByDesign; }
101public virtual Stream? GetManifestResourceStream(Type type, string name) { throw NotImplemented.ByDesign; }
109public virtual Type? GetType(string name) => GetType(name, throwOnError: false, ignoreCase: false);
111public virtual Type? GetType(string name, bool throwOnError) => GetType(name, throwOnError: throwOnError, ignoreCase: false);
113public virtual Type? GetType(string name, bool throwOnError, bool ignoreCase) { throw NotImplemented.ByDesign; }
115public virtual bool IsDefined(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
121public virtual object[] GetCustomAttributes(Type attributeType, bool inherit) { throw NotImplemented.ByDesign; }
136Type? t = GetType(typeName, throwOnError: false, ignoreCase: ignoreCase);
210public 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 (26)
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);
108private static readonly Type[] s_parameterTypes = new Type[] { typeof(string) };
114Type consoleType = Type.GetType(ConsoleTypeFullName, throwOnError: true)!;
126Type consoleType = Type.GetType(ConsoleTypeFullName, throwOnError: true)!;
130Type[] parameterTypes = new Type[1];
131Type cls = localBuilder.LocalType;
154Type consoleType = Type.GetType(ConsoleTypeFullName, throwOnError: true)!;
167Type[] parameterTypes = new Type[1];
168Type cls = fld.FieldType;
186public virtual LocalBuilder DeclareLocal(Type localType)
191public 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)
319Type baseType;
330Type baseType;
344Type baseType;
365public override Type BaseType => typeof(Array);
369CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
382CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
407public override Type GetInterface(string name, bool ignoreCase)
413public override Type[] GetInterfaces()
432Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
444public override Type[] GetNestedTypes(BindingFlags bindingAttr)
450public override Type GetNestedType(string name, BindingFlags bindingAttr)
474public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
488Type baseType;
525public override Type? GetElementType()
535public override Type UnderlyingSystemType => this;
542public override object[] GetCustomAttributes(Type attributeType, bool inherit)
547public 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 (11)
26Type[] delegateParameters = new Type[5] { typeof(object), typeof(object), typeof(object), typeof(object), typeof(object) };
94Type[] delegateParameters = new Type[2] { typeof(object), typeof(Span<object>) };
151Type[] delegateParameters = new Type[3] { 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), new[] { typeof(void*), typeof(Type) })!;
346s_Type_GetTypeFromHandle ??= typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle), new[] { 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)
360private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser)
373private NullabilityInfo GetNullabilityInfo(MemberInfo memberInfo, Type type, NullableAttributeStateParser parser, ref int index)
378Type underlyingType = type;
418Type[] genericArguments = underlyingType.GetGenericArguments();
448Type? metaType = null;
466Type? type = member.DeclaringType;
475private static Type GetPropertyMetaType(PropertyInfo property)
485private void CheckGenericParameters(NullabilityInfo nullability, MemberInfo metaMember, Type metaType, Type? reflectedType)
498Type[] genericArguments = metaType.GetGenericArguments();
518private bool TryUpdateGenericParameterNullability(NullabilityInfo nullability, Type genericParameter, Type? reflectedType)
556private bool TryUpdateGenericTypeParameterNullabilityFromReflectedType(NullabilityInfo nullability, Type genericParameter, Type context, Type reflectedType)
565Type contextTypeDefinition = context.IsGenericType && !context.IsGenericTypeDefinition ? context.GetGenericTypeDefinition() : context;
571Type? baseType = contextTypeDefinition.BaseType;
583Type[] genericArguments = baseType.GetGenericArguments();
584Type genericArgument = genericArguments[genericParameter.GenericParameterPosition];
598static int CountNullabilityStates(Type type)
600Type underlyingType = Nullable.GetUnderlyingType(type) ?? type;
604foreach (Type genericArgument in underlyingType.GetGenericArguments())
668private 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 (94)
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();
77public virtual Type GetGenericTypeDefinition() => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
78public virtual Type[] GenericTypeArguments => (IsGenericType && !IsGenericTypeDefinition) ? GetGenericArguments() : EmptyTypes;
79public virtual Type[] GetGenericArguments() => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
81public virtual Type[] GetOptionalCustomModifiers() => EmptyTypes;
82public virtual Type[] GetRequiredCustomModifiers() => EmptyTypes;
86public virtual Type[] GetGenericParameterConstraints()
150public bool IsAssignableTo([NotNullWhen(true)] Type? targetType) => targetType?.IsAssignableFrom(this) ?? false;
167public ConstructorInfo? GetConstructor(Type[] types) => GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, types, null);
180/// An empty array of the type <see cref="Type"/> (that is, Type[] types = Array.Empty{Type}()) to get a constructor that takes no parameters.
188public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Type[] types) => GetConstructor(bindingAttr, binder: null, types, modifiers: null);
191public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetConstructor(bindingAttr, binder, CallingConventions.Any, types, modifiers);
194public ConstructorInfo? GetConstructor(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
206protected abstract ConstructorInfo? GetConstructorImpl(BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers);
238public virtual Type[] GetFunctionPointerCallingConventions() => throw new NotSupportedException();
239public virtual Type GetFunctionPointerReturnType() => throw new NotSupportedException();
240public virtual Type[] GetFunctionPointerParameterTypes() => throw new NotSupportedException();
267/// Searches for the <see cref="MemberInfo"/> on the current <see cref="Type"/> that matches the specified <see cref="MemberInfo"/>.
270/// The <see cref="MemberInfo"/> to find on the current <see cref="Type"/>.
272/// <returns>An object representing the member on the current <see cref="Type"/> that matches the specified member.</returns>
275/// <exception cref="ArgumentException"><paramref name="member"/> does not match a member on the current <see cref="Type"/>.</exception>
322/// An array of <see cref="Type"/> objects representing the number, order, and type of the parameters for the method to get.
324/// An empty array of <see cref="Type"/> objects (as provided by the <see cref="EmptyTypes"/> field) to get a method that takes no parameters.
328public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Type[] types) => GetMethod(name, bindingAttr, binder: null, types, modifiers: null);
331public MethodInfo? GetMethod(string name, Type[] types) => GetMethod(name, types, null);
334public MethodInfo? GetMethod(string name, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, DefaultLookup, null, types, modifiers);
337public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
340public MethodInfo? GetMethod(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
353protected abstract MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers);
356public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types) => GetMethod(name, genericParameterCount, types, null);
359public MethodInfo? GetMethod(string name, int genericParameterCount, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, genericParameterCount, DefaultLookup, null, types, modifiers);
362public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Type[] types) => GetMethod(name, genericParameterCount, bindingAttr, null, types, null);
365public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, Type[] types, ParameterModifier[]? modifiers) => GetMethod(name, genericParameterCount, bindingAttr, binder, CallingConventions.Any, types, modifiers);
368public MethodInfo? GetMethod(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
381protected virtual MethodInfo? GetMethodImpl(string name, int genericParameterCount, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
390public Type? GetNestedType(string name) => GetNestedType(name, DefaultLookup);
393public abstract Type? GetNestedType(string name, BindingFlags bindingAttr);
396public Type[] GetNestedTypes() => GetNestedTypes(DefaultLookup);
399public abstract Type[] GetNestedTypes(BindingFlags bindingAttr);
415public PropertyInfo? GetProperty(string name, Type? returnType)
423public PropertyInfo? GetProperty(string name, Type[] types) => GetProperty(name, null, types);
426public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types) => GetProperty(name, returnType, types, null);
429public PropertyInfo? GetProperty(string name, Type? returnType, Type[] types, ParameterModifier[]? modifiers) => GetProperty(name, DefaultLookup, null, returnType, types, modifiers);
432public PropertyInfo? GetProperty(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[] types, ParameterModifier[]? modifiers)
441protected abstract PropertyInfo? GetPropertyImpl(string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers);
471public static Type[] GetTypeArray(object[] args)
475Type[] cls = new Type[args.Length];
486public static TypeCode GetTypeCode(Type? type)
540Type systemType = UnderlyingSystemType;
550public static Type? GetTypeFromCLSID(Guid clsid) => GetTypeFromCLSID(clsid, null, throwOnError: false);
552public static Type? GetTypeFromCLSID(Guid clsid, bool throwOnError) => GetTypeFromCLSID(clsid, null, throwOnError: throwOnError);
554public static Type? GetTypeFromCLSID(Guid clsid, string? server) => GetTypeFromCLSID(clsid, server, throwOnError: false);
556public static Type? GetTypeFromCLSID(Guid clsid, string? server, bool throwOnError) => Marshal.GetTypeFromCLSID(clsid, server, throwOnError);
559public static Type? GetTypeFromProgID(string progID) => GetTypeFromProgID(progID, null, throwOnError: false);
561public static Type? GetTypeFromProgID(string progID, bool throwOnError) => GetTypeFromProgID(progID, null, throwOnError: throwOnError);
563public static Type? GetTypeFromProgID(string progID, string? server) => GetTypeFromProgID(progID, server, throwOnError: false);
565public static Type? GetTypeFromProgID(string progID, string? server, bool throwOnError) => Marshal.GetTypeFromProgID(progID, server, throwOnError);
567public abstract Type? BaseType { get; }
584public Type? GetInterface(string name) => GetInterface(name, ignoreCase: false);
587public abstract Type? GetInterface(string name, bool ignoreCase);
589public abstract Type[] GetInterfaces();
591public virtual InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType) => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
594public virtual bool IsEquivalentTo([NotNullWhen(true)] Type? other) => this == other;
599public virtual Type GetEnumUnderlyingType()
634public virtual Type MakeArrayType() => throw new NotSupportedException();
636public virtual Type MakeArrayType(int rank) => throw new NotSupportedException();
637public virtual Type MakeByRefType() => throw new NotSupportedException();
641public virtual Type MakeGenericType(params Type[] typeArguments) => throw new NotSupportedException(SR.NotSupported_SubclassOverride);
643public virtual Type MakePointerType() => throw new NotSupportedException();
645public static Type MakeGenericSignatureType(Type genericTypeDefinition, params Type[] typeArguments) => new SignatureConstructedGenericType(genericTypeDefinition, typeArguments);
647public static Type MakeGenericMethodParameter(int position)
661Type elementType = GetRootElementType();
674public override bool Equals(object? o) => o == null ? false : Equals(o as Type);
677Type systemType = UnderlyingSystemType;
682public virtual bool Equals(Type? o) => o == null ? false : ReferenceEquals(this.UnderlyingSystemType, o.UnderlyingSystemType);
685public static bool operator ==(Type? left, Type? right)
700public static bool operator !=(Type? left, Type? right)
706public static Type? ReflectionOnlyGetType(string typeName, bool throwIfNotFound, bool ignoreCase) => throw new PlatformNotSupportedException(SR.PlatformNotSupported_ReflectionOnly);
716public 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.All)] Type target, string method)
181Type? currentType = _target!.GetType();
182Type targetType = declaringType.GetGenericTypeDefinition();
216public static Delegate? CreateDelegate(Type type, object target, string method, bool ignoreCase, bool throwOnBindFailure)
251public static Delegate? CreateDelegate(Type type, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type target, string method, bool ignoreCase, bool throwOnBindFailure)
287public static Delegate? CreateDelegate(Type type, MethodInfo method, bool throwOnBindFailure)
322public static Delegate? CreateDelegate(Type type, object? firstArgument, MethodInfo method, bool throwOnBindFailure)
358internal static Delegate CreateDelegateNoSecurityCheck(Type type, object? target, RuntimeMethodHandle method)
src\System\Reflection\Emit\DynamicILGenerator.cs (27)
35public override LocalBuilder DeclareLocal(Type localType, bool pinned)
136public override void Emit(OpCode opcode, Type type)
187Type? returnType,
188Type[]? parameterTypes,
189Type[]? optionalParameterTypes)
227public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes)
255public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
342public override void BeginCatchBlock(Type? exceptionType)
404private int GetMemberRefToken(MethodInfo methodInfo, Type[]? optionalParameterTypes)
406Type[]? parameterTypes;
407Type[][]? requiredCustomModifiers;
408Type[][]? optionalCustomModifiers;
422parameterTypes = new Type[paramInfo.Length];
423requiredCustomModifiers = new Type[parameterTypes.Length][];
424optionalCustomModifiers = new Type[parameterTypes.Length][];
455Type? returnType,
456Type[]? parameterTypes)
465Type? returnType,
466Type[]? parameterTypes,
467Type[][]? requiredCustomModifiers,
468Type[][]? optionalCustomModifiers,
469Type[]? optionalParameterTypes)
481private void AddParameters(SignatureHelper sigHelp, Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
1034Type 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;
261Type[] parameterTypes = new Type[parameters.Length];
262Type[][] requiredCustomModifiers = new Type[parameters.Length][];
263Type[][] optionalCustomModifiers = new Type[parameters.Length][];
307private int GetMemberRefToken(MethodBase method, Type[]? optionalParameterTypes)
375internal SignatureHelper GetMemberRefSignature(CallingConventions call, Type? returnType,
376Type[]? parameterTypes, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers,
377Type[]? optionalParameterTypes, int cGenericParameters)
463Type[] parameterTypes = new Type[parameters.Length];
464Type[][] requiredCustomModifiers = new Type[parameterTypes.Length][];
465Type[][] optionalCustomModifiers = new Type[parameterTypes.Length][];
492public override object[] GetCustomAttributes(Type attributeType, bool inherit)
497public override bool IsDefined(Type attributeType, bool inherit)
512public override Type[] GetTypes()
520internal Type[] GetTypesNoLock()
522Type[] typeList = new Type[_typeBuilderDict.Count];
525foreach (Type builder in _typeBuilderDict.Values)
546public override Type? GetType(string className)
552public override Type? GetType(string className, bool ignoreCase)
558public override Type? GetType(string className, bool throwOnError, bool ignoreCase)
567private Type? GetTypeNoLock(string className, bool throwOnError, bool ignoreCase)
577Type? baseType = InternalModule.GetType(className, throwOnError, ignoreCase);
664public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
670public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
676public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
682public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
726CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
745protected override TypeBuilder DefineTypeCore(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize)
759protected override EnumBuilder DefineEnumCore(string name, TypeAttributes visibility, Type underlyingType)
779MethodAttributes attributes, CallingConventions callingConvention, Type? returnType,
780Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
795Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
796Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
807Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers,
808Type[]? parameterTypes, Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
884internal int GetTypeTokenInternal(Type type, bool getGenericDefinition = false)
892public override int GetTypeMetadataToken(Type type)
897private int GetTypeTokenWorkerNoLock(Type type, bool getGenericDefinition)
998Type? declaringType = method.DeclaringType;
1011Type[] tt = new Type[paramInfo.Length];
1029Type[] parameterTypes = new Type[parameters.Length];
1030Type[][] requiredCustomModifiers = new Type[parameterTypes.Length][];
1031Type[][] optionalCustomModifiers = new Type[parameterTypes.Length][];
1065internal int GetMethodTokenInternal(MethodBase method, Type[]? optionalParameterTypes, bool useMethodDef)
1130internal int GetArrayMethodToken(Type arrayClass, string methodName, CallingConventions callingConvention,
1131Type? returnType, Type[]? parameterTypes)
1139private int GetArrayMethodTokenNoLock(Type arrayClass, string methodName, CallingConventions callingConvention,
1140Type? returnType, Type[]? parameterTypes)
1159protected override MethodInfo GetArrayMethodCore(Type arrayClass, string methodName, CallingConventions callingConvention,
1160Type? 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];
302Type t = requiredCustomModifiers[i];
323private void AddOneArgTypeHelper(Type clsArgument) { AddOneArgTypeHelperWorker(clsArgument, false); }
324private void AddOneArgTypeHelperWorker(Type clsArgument, bool lastWasGenericInst)
341Type[] args = clsArgument.GetGenericArguments();
345foreach (Type t in args)
541private unsafe void InternalAddRuntimeType(Type type)
732internal void AddDynamicArgument(DynamicScope dynamicScope, Type clsArgument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
742Type t = optionalCustomModifiers[i];
765Type t = requiredCustomModifiers[i];
790public void AddArgument(Type clsArgument)
795public void AddArgument(Type argument, bool pinned)
803public void AddArguments(Type[]? arguments, Type[][]? requiredCustomModifiers, Type[][]? optionalCustomModifiers)
820public void AddArgument(Type argument, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers)
src\System\Reflection\RuntimeModule.cs (21)
27private static RuntimeTypeHandle[]? ConvertToTypeHandleArray(Type[]? genericArguments)
36Type typeArg = genericArguments[i];
77public override MethodBase? ResolveMethod(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
112Type declaringType = RuntimeMethodHandle.GetDeclaringType(methodHandle);
133private FieldInfo? ResolveLiteralField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
145Type declaringType = ResolveType(tkDeclaringType, genericTypeArguments, genericMethodArguments);
161public override FieldInfo? ResolveField(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
222public override Type ResolveType(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
254public override MemberInfo? ResolveMember(int metadataToken, Type[]? genericTypeArguments, Type[]? genericMethodArguments)
330CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
337CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
365public override object[] GetCustomAttributes(Type attributeType, bool inherit)
375public override bool IsDefined(Type attributeType, bool inherit)
400public override Type? GetType(
437public 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)
830Type[] interfaces = ReflectedType.BaseType!.GetInterfaces();
841Type[]? interfaces = RuntimeTypeHandle.GetInterfaces(ReflectedType);
996Type[] iFaces = iList.GetInterfaces();
1019Type[]? ifaces = RuntimeTypeHandle.GetInterfaces(declaringType);
1058Type[] constraints = declaringType.GetGenericParameterConstraints();
1067Type[] temp = constraint.GetInterfaces();
1505public Type[] FunctionPointerReturnAndParameterTypes { get; }
1507private FunctionPointerCache(Type[] functionPointerReturnAndParameterTypes)
1521internal Type[] FunctionPointerReturnAndParameterTypes
1568Type type = m_runtimeType;
1616Type DefaultMemberAttrType = typeof(DefaultMemberAttribute);
2009if (definition is Type)
2030Type genericArgument = genericArguments[i];
2031Type genericParameter = genericParameters[i];
2237Type type, BindingFlags bindingFlags, string name, bool prefixLookup, string? ns)
2254RuntimeMethodInfo method, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2261RuntimeConstructorInfo constructor, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2270MethodBase methodBase, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
2377if (argumentTypes[i] is Type t && !t.MatchesParameterTypeExactly(parameterInfos[i]))
2516Type[]? types, bool allowPrefixLookup)
2541Type[]? types, bool allowPrefixLookup)
2562string? name, BindingFlags bindingAttr, Type[]? types, bool allowPrefixLookup)
2629private ListBuilder<Type> GetNestedTypeCandidates(string? fullname, BindingFlags bindingAttr, bool allowPrefixLookup)
2637ListBuilder<Type> candidates = new ListBuilder<Type>(cache.Length);
2683public override Type[] GetInterfaces()
2686return new ReadOnlySpan<Type>(candidates).ToArray();
2690public override Type[] GetNestedTypes(BindingFlags bindingAttr)
2703ListBuilder<Type> nestedTypes = GetNestedTypeCandidates(null, bindingAttr, false);
2726public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
2798Type[]? types, ParameterModifier[]? modifiers)
2806Type[]? types, ParameterModifier[]? modifiers)
2813Type[]? types, ParameterModifier[]? modifiers)
2849Type[] types, ParameterModifier[]? modifiers)
2875string name, BindingFlags bindingAttr, Binder? binder, Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
2982public override Type? GetInterface(string fullname, bool ignoreCase)
3017public override Type? GetNestedType(string fullname, BindingFlags bindingAttr)
3055ListBuilder<Type> nestedTypes = default;
3284public override bool IsSubclassOf(Type type)
3313public override bool IsEquivalentTo([NotNullWhen(true)] Type? other)
3506public override Type GetGenericTypeDefinition()
3545public override Type[] GetGenericArguments()
3547Type[] types = GetRootElementType().TypeHandle.GetInstantiationPublic();
3552public override Type MakeGenericType(Type[] instantiation)
3583Type instantiationElem = instantiation[i];
3606return Reflection.Emit.TypeBuilderInstantiation.MakeGenericType(this, (Type[])(instantiation.Clone()));
3611Type ret;
3639public override Type[] GetGenericParameterConstraints()
3644Type[] constraints = new RuntimeTypeHandle(this).GetConstraints();
3664public override Type MakePointerType() => new RuntimeTypeHandle(this).MakePointer();
3666public override Type MakeByRefType() => new RuntimeTypeHandle(this).MakeByRef();
3668public override Type MakeArrayType() => new RuntimeTypeHandle(this).MakeSZArray();
3670public override Type MakeArrayType(int rank)
3720public override Type[] GetFunctionPointerCallingConventions()
3731public override Type[] GetFunctionPointerParameterTypes()
3738Type[] parameters = Cache.FunctionPointerReturnAndParameterTypes;
3749public override Type GetFunctionPointerReturnType()
3774public override Type? DeclaringType => Cache.GetEnclosingType();
3785Type elementType = GetRootElementType();
3822Type[] 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,
86public 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>();
510Type clrType = dataContract.UnderlyingType;
592internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName xmlName, out XmlSchemaType? xsdType, out bool hasRoot)
605private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName xmlName, out XmlSchemaType? xsdType, out bool hasRoot)
631MethodInfo? getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
694Type clrType,
746internal 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.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)
432internal void StackallocSpan(Type elementType, int len)
438_ilGen!.Emit(OpCodes.Newobj, typeof(Span<>).MakeGenericType(elementType).GetConstructor(new Type[] { typeof(void*), typeof(int) })!);
443Type objType = GetVariableType(obj).GetElementType()!;
457Type arrayType = GetVariableType(obj);
461Call(typeof(Array).GetMethod("SetValue", new Type[] { typeof(object), typeof(int) })!);
465Type objType = arrayType.GetElementType()!;
479private static bool IsStruct(Type objType)
485internal Type LoadMember(object obj, MemberInfo memberInfo)
499Type? currentType = propertyInfo.DeclaringType!.BaseType;
534internal Type LoadMember(MemberInfo memberInfo)
536Type? memberType;
567internal Type LoadMemberAddress(MemberInfo memberInfo)
569Type? memberType;
654internal void ConvertAddress(Type source, Type target)
659internal void ConvertValue(Type source, Type target)
664internal void Castclass(Type target)
669internal void Box(Type type)
674internal void Unbox(Type type)
707internal void Ldobj(Type type)
709OpCode opCode = GetLdindOpCode(Type.GetTypeCode(type));
730internal void Stobj(Type type)
762internal void Ldtoken(Type t)
769Type valueType = o.GetType();
770if (o is Type)
772Ldtoken((Type)o);
773Call(typeof(Type).GetMethod("GetTypeFromHandle", BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(RuntimeTypeHandle) })!);
781switch (Type.GetTypeCode(valueType))
819new Type[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) }
832new Type[] { typeof(long) }
846new Type[] { typeof(long) },
858new Type[] { typeof(long), typeof(TimeSpan) },
934internal void Stloc(Type type, string name)
950internal void Ldloc(Type type, string name)
1029internal void Ldelem(Type arrayElementType)
1037OpCode opCode = GetLdelemOpCode(Type.GetTypeCode(arrayElementType));
1044internal void Ldelema(Type arrayElementType)
1077internal void Stelem(Type arrayElementType)
1083OpCode opCode = GetStelemOpCode(Type.GetTypeCode(arrayElementType));
1189private void InternalConvert(Type source, Type target, bool isAddress)
1197OpCode opCode = GetConvOpCode(Type.GetTypeCode(target));
1266[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type parent,
1267Type[] interfaces)
1334internal void IsInst(Type type)
1428internal Type ArgType;
1429internal ArgBuilder(string name, int index, Type argType)
1578public void AddToFreeLocals(Dictionary<(Type, string), Queue<LocalBuilder>> freeLocals)
1582(Type, string) key = (item.Value.LocalType, item.Key);
1603public readonly Type[] ParameterTypes;
1604public MethodBuilderInfo(MethodBuilder methodBuilder, Type[] parameterTypes)
1611public void Validate(Type? returnType, Type[] parameterTypes, MethodAttributes attributes)
1625private readonly Type _sourceType;
1626private readonly Type _targetType;
1630public CodeGeneratorConversionException(Type sourceType, Type targetType, bool isAddress, string reason)
System\Xml\Serialization\Compilation.cs (21)
50internal TempAssembly(XmlMapping[] xmlMappings, Type?[] types, string? defaultNamespace, string? location)
137internal static Assembly? LoadGeneratedAssembly(Type type, string? defaultNamespace, out XmlSerializerImplementation? contract)
213Type contractType = GetTypeFromAssembly(serializer, "XmlSerializerContract");
226private static Assembly? LoadAssemblyByPath(Type type, string assemblyName)
264private static bool IsSerializerVersionMatch(Assembly serializer, Type type, string? defaultNamespace)
278private static string GenerateAssemblyId(Type type)
300internal static bool GenerateSerializerToStream(XmlMapping[] xmlMappings, Type?[] types, string? defaultNamespace, Assembly? assembly, Hashtable assemblies, Stream stream)
314foreach (Type t in scope.Types)
342Type? type = types[i];
436internal static Assembly GenerateRefEmitAssembly(XmlMapping[] xmlMappings, Type?[] types)
438var mainType = (types.Length > 0) ? types[0] : null;
461new Type[] { typeof(string) }
493Type writerType = writerCodeGen.GenerateEnd();
526[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type, string methodName)
538internal static Type GetTypeFromAssembly(Assembly assembly, string typeName)
541Type? type = assembly.GetType(typeName);
587internal static void VerifyLoadContext(Type? t, Assembly? assembly)
666private readonly Type _type;
668internal TempAssemblyCacheKey(string? ns, Type type)
693internal TempAssembly? this[string? ns, Type t]
710internal 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)
91private Type? _type;
125[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type, bool isXsdType, XmlSchemaType dataType, string formatterName, TypeFlags flags)
132[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? type, string name, string fullName, TypeKind kind, TypeDesc? baseTypeDesc, TypeFlags flags, TypeDesc? arrayElementTypeDesc)
178internal Type? Type
361[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
550internal static bool IsKnownType(Type type)
557switch (Type.GetTypeCode(type))
633[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
646[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
666[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type,
696internal TypeDesc GetTypeDesc(Type type)
702internal TypeDesc GetTypeDesc(Type type, MemberInfo? source, bool directReference)
708internal TypeDesc GetTypeDesc(Type type, MemberInfo? source, bool directReference, bool throwOnError)
727internal TypeDesc GetArrayTypeDesc(Type type)
751internal Type? GetTypeFromTypeDesc(TypeDesc typeDesc)
758return de.Key as Type;
764private TypeDesc ImportTypeDesc(Type type, MemberInfo? memberInfo, bool directReference)
768Type? arrayElementType = null;
769Type? baseType = null;
953for (Type? t = type.DeclaringType; t != null && !t.ContainsGenericParameters && !(t.IsAbstract && t.IsSealed); t = t.DeclaringType)
959private static bool IsArraySegment(Type t)
964internal static bool IsOptionalValue(Type type)
982internal static string TypeName(Type t)
1000Type[] arguments = t.GetGenericArguments();
1018internal static Type? GetArrayElementType(Type type, string? memberInfo)
1169[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type derivedType,
1173Type currentType = derivedType;
1174Type typeToBeReplaced = memberInfoToBeReplaced.DeclaringType!;
1229| DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type type)
1231ConstructorInfo? ctor = type.GetConstructor(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, Type.EmptyTypes);
1255private static Type? GetEnumeratorElementType(Type type, ref TypeFlags flags)
1259MethodInfo? enumerator = type.GetMethod("GetEnumerator", Type.EmptyTypes);
1283enumerator = type.GetMethod("System.Collections.IEnumerable.GetEnumerator", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic, Type.EmptyTypes);
1294Type currentType = (p == null ? typeof(object) : p.PropertyType);
1296MethodInfo? addMethod = type.GetMethod("Add", new Type[] { currentType });
1301addMethod = type.GetMethod("Add", new Type[] { currentType });
1316[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string? memberInfo)
1334for (Type? t = type; t != null; t = t.BaseType)
1358MethodInfo? addMethod = type.GetMethod("Add", new Type[] { indexer.PropertyType });
1365private static Type GetCollectionElementType(
1366[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type,
System\Xml\Serialization\XmlReflectionImporter.cs (43)
98Type type = ((XmlIncludeAttribute)attrs[i]).Type!;
107public void IncludeType(Type type)
113private void IncludeType(Type type, RecursionLimiter limiter)
137public XmlTypeMapping ImportTypeMapping(Type type)
146public XmlTypeMapping ImportTypeMapping(Type type, string? defaultNamespace)
155public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root)
164public XmlTypeMapping ImportTypeMapping(Type type, XmlRootAttribute? root, string? defaultNamespace)
236private XmlAttributes GetAttributes(Type type, bool canBeSimpleType)
472[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type type)
483MethodInfo? getMethod = getMethod = type.GetMethod(provider.MethodName, /* BindingFlags.DeclaredOnly | */ BindingFlags.Static | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
494private SpecialMapping ImportSpecialMapping(Type type, TypeDesc typeDesc, string? ns, ImportContext context)
607private static InvalidOperationException InvalidAttributeUseException(Type type)
631[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type type)
696private TypeMapping? GetTypeMapping(string? typeName, string? ns, TypeDesc typeDesc, NameTable typeLib, Type? type)
939internal string XsdTypeName(Type type)
949internal string XsdTypeName(Type type, XmlAttributes a, string name)
957Type genType = type.GetGenericTypeDefinition();
958Type[] names = genType.GetGenericArguments();
959Type[] types = type.GetGenericArguments();
986private void SetArrayMappingType(ArrayMapping mapping, string? defaultNs, Type type)
1366Type? choiceIdentifierType = null;
1396Type? choiceIdentifierType = null;
1405private static Type CheckChoiceIdentifierType(Type type, bool isArrayLike, string identifierName, string memberName)
1430private static Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, XmlReflectionMember[] xmlReflectionMembers, bool isArrayLike, string accessorName)
1444private static Type GetChoiceIdentifierType(XmlChoiceIdentifierAttribute choice, StructModel structModel, bool isArrayLike, string accessorName)
1474Type enumType = member.FieldType;
1480private void CreateArrayElementsFromAttributes(ArrayMapping arrayMapping, XmlArrayItemAttributes attributes, Type arrayElementType, string? arrayElementNs, RecursionLimiter limiter)
1489Type targetType = xmlArrayItem.Type ?? arrayElementType;
1505private void ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, string? ns, Type? choiceIdentifierType, bool rpc, bool openModel, RecursionLimiter limiter)
1515Type accessorType = model.FieldType;
1547Type arrayElementType = TypeScope.GetArrayElementType(accessorType, $"{model.FieldTypeDesc.FullName}.{model.Name}")!;
1574Type targetType = a.XmlAttribute!.Type == null ? arrayElementType : a.XmlAttribute.Type!;
1604Type targetType = a.XmlText.Type ?? arrayElementType;
1619Type targetType = xmlElement.Type ?? arrayElementType;
1660Type targetType = typeof(IXmlSerializable).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlNode).IsAssignableFrom(arrayElementType) ? arrayElementType : typeof(XmlElement);
1861Type targetType = xmlElement.Type ?? accessorType;
1901Type targetType = typeof(IXmlSerializable).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlNode).IsAssignableFrom(accessorType) ? accessorType : typeof(XmlElement);
2052private void CheckAmbiguousChoice(XmlAttributes a, Type accessorType, string accessorName)
2061Type type = elements[i]!.Type == null ? accessorType : elements[i]!.Type!;
2086Type type = items[i]!.Type == null ? accessorType : items[i]!.Type!;
2120private static object? GetDefaultValue(TypeDesc fieldTypeDesc, Type t, XmlAttributes a)
2235internal static XmlTypeMapping GetTopLevelMapping(Type type, string? defaultNamespace)
System\Xml\Serialization\XmlSchemaImporter.cs (18)
28public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType)
48public XmlTypeMapping ImportDerivedTypeMapping(XmlQualifiedName name, Type? baseType, bool baseTypeCanBeIndirect)
80public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType)
86public XmlTypeMapping ImportSchemaType(XmlQualifiedName typeName, Type? baseType, bool baseTypeCanBeIndirect)
182public XmlMembersMapping ImportMembersMapping(XmlQualifiedName[] names, Type? baseType, bool baseTypeCanBeIndirect)
235private ElementAccessor ImportElement(XmlQualifiedName name, Type desiredMappingType, Type? baseType)
251private ElementAccessor ImportElement(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns, bool topLevelElement)
310private TypeMapping ImportElementType(XmlSchemaElement element, string identifier, Type desiredMappingType, Type? baseType, string? ns)
397private TypeMapping? ImportType(XmlQualifiedName name, Type desiredMappingType, Type? baseType, TypeFlags flags, bool addref)
425private TypeMapping? ImportType(XmlSchemaComplexType type, string? typeNs, string identifier, Type desiredMappingType, Type? baseType)
474private StructMapping ImportStructType(XmlSchemaType type, string? typeNs, string identifier, Type? baseType, bool arrayLike)
584private StructMapping ImportStructDataType(XmlSchemaSimpleType dataType, string? typeNs, string identifier, Type baseType)
1625private TypeMapping? ImportDataType(XmlSchemaSimpleType dataType, string? typeNs, string identifier, Type? baseType, TypeFlags flags, bool isList)
System\Xml\Serialization\XmlSerializationILGen.cs (45)
21internal Dictionary<string, Type> CreatedTypes = new Dictionary<string, Type>();
72private static readonly Type[] s_typeType = new Type[] { typeof(Type) };
73private static readonly Type[] s_xmlReaderType = new Type[] { typeof(XmlReader) };
74private static readonly Type[] s_objectXmlSerializationWriterType = new Type[] { typeof(object), typeof(XmlSerializationWriter) };
75private static readonly Type[] s_xmlSerializationReaderType = new Type[] { typeof(XmlSerializationReader) };
78MethodAttributes attributes, Type? returnType, Type[] parameterTypes)
165Type.EmptyTypes,
178Type.EmptyTypes
218new Type[] { typeof(object), typeof(object) }
234internal void GenerateSupportedTypes(Type[] types, TypeBuilder serializerContractTypeBuilder)
243var uniqueTypes = new HashSet<Type>();
246Type type = types[i];
282Type.EmptyTypes);
286Type.EmptyTypes
291Type.EmptyTypes,
299Type.EmptyTypes
303Type.EmptyTypes,
311Type baseSerializerType = baseSerializerTypeBuilder.CreateType();
328Type.EmptyTypes
351new Type[] { typeof(string), typeof(string) }
376new Type[] { (mapping is XmlMembersMapping) ? typeof(object[]) : typeof(object) }
400Type.EmptyTypes
408Type typedSerializerType = typedSerializerTypeBuilder.CreateType();
422new Type[] { typeof(object), typeof(object) }
429Type.EmptyTypes
456Type? type = xmlMappings[i].Accessor.Mapping!.TypeDesc!.Type;
470Type.EmptyTypes
488internal void GenerateSerializerContract(XmlMapping[] xmlMappings, Type[] types, string readerType, string[] readMethods, string writerType, string[] writerMethods, Dictionary<string, string> serializers)
495Type.EmptyTypes
507Type.EmptyTypes,
513Type.EmptyTypes
527Type.EmptyTypes,
533Type.EmptyTypes
547Type.EmptyTypes
553Type.EmptyTypes,
570Type serializerContractType = serializerContractTypeBuilder.CreateType();
588internal void ILGenLoad(string source, Type? type)
597Type 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)
1344protected Array EnsureArrayIndex(Array? a, int index, Type elementType)
1353protected Array? ShrinkArray(Array? a, int length, Type elementType, bool isNullable)
1554Type? fallbackElementType = null;
1559Type? arrayType = (Type?)_types[new XmlQualifiedName(typeName, typeNs)];
1584Type? elementType = null;
1589elementType = (Type?)_types[qname];
1712Type? itemType = null;
1718Type currItemType = currItem.GetType();
1846protected void AddReadCallback(string name, string ns, Type type, XmlSerializationReadCallback read)
5018Writer.Write(typeof(Type).FullName);
5080private void WriteCatchException(Type exceptionType)
System\Xml\Serialization\XmlSerializationReaderILGen.cs (171)
30private static readonly Type[] s_boolType = new Type[] { typeof(bool) };
190Type.EmptyTypes);
229ilg.BeginMethod(typeof(void), "InitIDs", Type.EmptyTypes, Array.Empty<string>(),
234Type.EmptyTypes
239Type.EmptyTypes
244new Type[] { typeof(string) }
261Type readerType = this.typeBuilder.CreateType();
288Type.EmptyTypes
293new Type[] { typeof(string), typeof(string) }
312List<Type> argTypes = new List<Type>();
347ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(),
398Type.EmptyTypes,
407Type.EmptyTypes
412Type.EmptyTypes
527Type.EmptyTypes
542Type.EmptyTypes
552Type.EmptyTypes
567Type.EmptyTypes
596Type.EmptyTypes
643Type.EmptyTypes,
658Type.EmptyTypes
663Type.EmptyTypes
700new Type[] { typeof(string) }
708Type.EmptyTypes
713Type.EmptyTypes
724Type.EmptyTypes
729Type.EmptyTypes
758Type.EmptyTypes
763Type.EmptyTypes
774Type.EmptyTypes
779Type.EmptyTypes
812new Type[] { typeof(string) },
823Type.EmptyTypes
828Type.EmptyTypes
840new Type[] { typeof(string) }
848Type argType = source == "false" ? typeof(bool) : typeof(string);
865new Type[] { argType }
873new Type[] { argType }
881Type.EmptyTypes
886Type.EmptyTypes
897Type.EmptyTypes
902Type.EmptyTypes
974Type.EmptyTypes,
985Type.EmptyTypes
995new Type[] { typeof(object), typeof(object) }
1034List<Type> argTypes = new List<Type>();
1036Type returnType;
1037Type underlyingType;
1058new Type[] { typeof(string), typeof(Hashtable), typeof(string) }
1101new Type[] { typeof(string), typeof(string) }
1122new Type[] { typeof(string), typeof(Type) }
1156List<Type> argTypes = new List<Type>();
1196Type.EmptyTypes
1201Type.EmptyTypes
1216new Type[] { typeof(string) }
1221new Type[] { typeof(string) }
1226Type.EmptyTypes
1240Type.EmptyTypes
1306Type.EmptyTypes)!;
1345List<Type> argTypes = new List<Type>();
1366Type.EmptyTypes
1371Type.EmptyTypes
1410new Type[] { locXsiType.LocalType }
1453new Type[] { typeof(string), typeof(string) }
1458new Type[] { typeof(XmlQualifiedName) }
1476new Type[] { locXsiType.LocalType }
1489new Type[] { typeof(XmlQualifiedName) }
1516new Type[] { typeof(string), typeof(string) }
1630Type.EmptyTypes
1635Type.EmptyTypes
1645Type.EmptyTypes
1654Type.EmptyTypes
1668Type.EmptyTypes
1684Type.EmptyTypes
1697Type.EmptyTypes
1719Type.EmptyTypes
1724Type.EmptyTypes
1764Type.EmptyTypes
1769Type.EmptyTypes
1774Type.EmptyTypes
1830Type.EmptyTypes
1835Type.EmptyTypes
1889new Type[] { typeof(string) }
1894Type.EmptyTypes
1899Type.EmptyTypes
1904Type.EmptyTypes
1920Type.EmptyTypes
1931new Type[] { typeof(string), typeof(string) }
1936Type.EmptyTypes
1964new Type[] { typeof(string) }
1969Type.EmptyTypes
1985Type.EmptyTypes
1990new Type[] { typeof(XmlReader) }
2002new Type[] { localAttr.LocalType }
2011List<Type> argTypes = new List<Type>();
2094new Type[] { typeof(char[]) }
2099Type.EmptyTypes
2104Type.EmptyTypes
2193new Type[] { typeof(string) }
2260Type.EmptyTypes
2265Type.EmptyTypes
2293Type.EmptyTypes
2298Type.EmptyTypes
2350Type.EmptyTypes
2355Type.EmptyTypes
2360Type.EmptyTypes
2365new Type[] { typeof(string) }
2394Type.EmptyTypes
2399Type.EmptyTypes
2409new Type[] { typeof(string) }
2422new Type[] { typeof(string), typeof(bool) }
2536Type.EmptyTypes
2667new Type[] { typeof(Array), typeof(int), typeof(Type), typeof(bool) }
2721Type varType = CodeGenerator.GetVariableType(variable);
2745Type arrayElementType = localA.LocalType.GetElementType()!;
2749new Type[] { typeof(Array), typeof(int), typeof(Type) }
2794private void WriteSourceEnd(string source, Type elementType)
2799private void WriteSourceEnd(string source, Type elementType, Type stackType)
2804Type varType = CodeGenerator.GetVariableType(variable);
2832Type arrayElementType = CodeGenerator.GetVariableType(oVar).GetElementType()!;
2853new Type[] { elementType }
2856Type addParameterType = Add.GetParameters()[0].ParameterType;
2867Type varType = CodeGenerator.GetVariableType(ilg.GetVariable(match.Groups["a"].Value));
2869Type varElementType = varType.GetElementType()!;
2883Type.EmptyTypes
2919Type.EmptyTypes
2924Type.EmptyTypes
2940Type.EmptyTypes
2950Type.EmptyTypes
2962Type.EmptyTypes
2973Type.EmptyTypes
3034Type.EmptyTypes
3057Type.EmptyTypes
3062Type.EmptyTypes
3071Type.EmptyTypes
3088Type.EmptyTypes
3093Type.EmptyTypes
3103Type.EmptyTypes
3127Type.EmptyTypes
3168Type.EmptyTypes
3173Type.EmptyTypes
3184List<Type> argTypes = new List<Type>();
3233Type.EmptyTypes
3258isWrappedAny ? new Type[] { typeof(IXmlSerializable), typeof(bool) } : new Type[] { typeof(IXmlSerializable) }
3330isWrappedAny ? new Type[] { typeof(IXmlSerializable), typeof(bool) } : new Type[] { typeof(IXmlSerializable) }
3349new Type[] { typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string) }
3367new Type[] { typeof(string), typeof(string), typeof(string) }
3387Type.EmptyTypes
3392Type.EmptyTypes
3412Type.EmptyTypes
3417Type.EmptyTypes
3484new Type[] { typeof(string) }
3495new Type[] { typeof(string) }
3506private void WriteCatchException(Type exceptionType)
3519private void WriteCreateInstance(string source, bool ctorInaccessible, Type type)
3550new Type[] { typeof(object) }
3555new Type[] { typeof(object), typeof(string) }
3638Type.EmptyTypes
System\Xml\Serialization\XmlSerializationWriter.cs (50)
186private XmlQualifiedName GetPrimitiveTypeName(Type type)
192private XmlQualifiedName? GetPrimitiveTypeName(Type type, bool throwIfUnknown)
200internal static XmlQualifiedName? GetPrimitiveTypeNameInternal(Type type)
205switch (Type.GetTypeCode(type))
262Type t = o.GetType();
267switch (Type.GetTypeCode(t))
816protected Exception CreateUnknownTypeException(Type type)
856protected Exception CreateInvalidAnyTypeException(Type type)
1173protected void AddWriteCallback(Type type, string typeName, string? typeNs, XmlSerializationWriteCallback callback)
1184private void WriteArray(string name, string? ns, object o, Type type)
1186Type elementType = TypeScope.GetArrayElementType(type, null)!;
1223Type? elementBaseType = elementType.BaseType;
1315protected void WritePotentiallyReferencingElement(string? n, string? ns, object? o, Type? ambientType)
1321protected void WritePotentiallyReferencingElement(string n, string? ns, object? o, Type? ambientType, bool suppressReference)
1327protected void WritePotentiallyReferencingElement(string? n, string? ns, object? o, Type? ambientType, bool suppressReference, bool isNullable)
1334Type t = o.GetType();
1335if (Type.GetTypeCode(t) == TypeCode.Object && !(o is Guid) && (t != typeof(XmlQualifiedName)) && !(o is XmlNode[]) && (t != typeof(byte[])))
1376private void WriteReferencedElement(object o, Type? ambientType)
1382private void WriteReferencedElement(string? name, string? ns, object o, Type? ambientType)
1385Type t = o.GetType();
1403private TypeEntry? GetTypeEntry(Type t)
1476internal Type? type;
1492internal static bool IsTypeDynamic(Type type)
1506Type[] parameterTypes = type.GetGenericArguments();
1511Type parameterType = parameterTypes[i];
1527internal static bool IsTypeDynamic(Type[] arguments)
1529foreach (Type t in arguments)
1608foreach (Type type in scope.Types)
1617private string WriteTypeInfo(TypeScope scope, TypeDesc typeDesc, Type type)
1632_writer.WriteLine($"static {typeof(Type).FullName} {typeVariable} = {elementTypeVariable}.MakeArrayType();");
1637_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType(");
1646Type? parameterType = Nullable.GetUnderlyingType(type);
1650_writer.WriteLine($"static {typeof(Type).FullName} {typeVariable} = typeof(System.Nullable<>).MakeGenericType(new {typeof(Type).FullName}[] {{{parameterTypeVariable}}});");
1655_writer.Write($"static {typeof(Type).FullName} {typeVariable} = {assemblyVariable}.GetType(");
1684"object", "string", typeof(Type).FullName,
1692[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type)
1729[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type)
1752private string WriteAssemblyInfo(Type type)
1771[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string escapedName, string typeVariable, string memberName)
1820_writer.Write($"new {typeof(Type).FullName}[] {{ ");
1833[DynamicallyAccessedMembers(TrimmerConstants.PublicMembers)] Type type, string escapedName, bool collectionUseReflection, bool elementUseReflection)
1847_writer.Write(typeof(Type[]).FullName);
3112Writer.Write(typeof(Type).FullName);
4174private void WriteElementCall(string func, Type cast, string source, string name, string? ns, bool isNullable, bool isAny)
4214Type? type = Type.GetType(mapping.TypeDesc!.Type!.FullName!);
4222Type? type = Type.GetType(mapping.TypeDesc!.Type!.FullName!);
4264Type type = value.GetType();
System\Xml\Serialization\XmlSerializationWriterILGen.cs (125)
33Type.EmptyTypes);
65internal Type GenerateEnd()
92ilg.BeginMethod(typeof(void), "InitCallbacks", Type.EmptyTypes, Array.Empty<string>(),
105List<Type> argTypes = new List<Type>();
126private void WriteEnumValue(EnumMapping mapping, SourceInfo source, out Type returnType)
141new Type[] { mapping.TypeDesc!.Type! });
149private void WritePrimitiveValue(TypeDesc typeDesc, SourceInfo source, out Type returnType)
160Type argType = typeDesc.Type!;
170new Type[] { argType }
188new Type[] { typeDesc.Type! }
237List<Type> argTypes = new List<Type>();
246Type argType;
264new Type[] { typeof(string), typeof(string) }
290new Type[] { typeof(string), typeof(string) }
304new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool) }
325Type.EmptyTypes
358private static readonly Type[] s_objectArrayType = new Type[] { typeof(object[]) };
359private static readonly Type[] s_objectType = new Type[] { typeof(object) };
381Type.EmptyTypes
389Type.EmptyTypes
573Type.EmptyTypes
593Type.EmptyTypes
614List<Type> argTypes = new List<Type>();
697new Type[] { typeof(long), typeof(string[]), typeof(long[]), typeof(string) }
717Type.EmptyTypes
722new Type[] { typeof(IFormatProvider) }
727new Type[] { typeof(object), typeof(string) }
765List<Type> argTypes = new List<Type>();
772Type oType = CodeGenerator.GetVariableType(oVar);
819Type.EmptyTypes
824new Type[] { typeof(string), typeof(string) }
834new Type[] { typeof(string), typeof(string) }
844new Type[] { mapping.TypeDesc.Type! }
849new Type[] { typeof(string) }
862Type.EmptyTypes
885Type.EmptyTypes
890new Type[] { typeof(string), typeof(string) }
900new Type[] { typeof(string), typeof(string) }
912Type.EmptyTypes
931List<Type> argTypes = new List<Type>(5);
960new Type[] { typeof(string), typeof(string) }
974LocalBuilder tLoc = ilg.DeclareLocal(typeof(Type), "t");
978Type.EmptyTypes
997new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool) }
1030new Type[] { typeof(bool) }
1065new Type[] { typeof(string), typeof(string), typeof(object), typeof(bool), typeof(XmlSerializerNamespaces) }
1075new Type[] { typeof(string), typeof(string) }
1194Type.EmptyTypes
1199new Type[] { typeof(string), typeof(string), typeof(string) }
1213Type.EmptyTypes
1234Type methodType;
1235Type argType;
1245Type.EmptyTypes
1250new Type[] { typeof(string) }
1266new Type[] { typeof(string) }
1287new Type[] { argType }
1309Type.EmptyTypes
1314Type.EmptyTypes
1325Type.EmptyTypes
1332List<Type> argTypes = new List<Type>();
1345Type.EmptyTypes
1384new Type[] { typeof(XmlNode), typeof(object) }
1405Type? targetType,
1476new Type[] { typeof(string), typeof(string) }
1508Type typeIEnumerable = typeof(IEnumerable);
1513Type.EmptyTypes)!;
1519Type typeIEnumerable = typeof(IEnumerable<>).MakeGenericType(arrayElementTypeDesc.Type!);
1524Type.EmptyTypes)!;
1532Type.EmptyTypes)!;
1551Type.EmptyTypes)!;
1736Type.EmptyTypes
1741Type.EmptyTypes
1749new Type[] { typeof(string), typeof(string) }
1772new Type[] { typeof(string), typeof(string), typeof(string), typeof(string) }
1799new Type[] { typeof(string), typeof(string) }
1806Type.EmptyTypes
1811Type.EmptyTypes
1876Type argType;
1889new Type[] { argType }
1901new Type[] { typeof(XmlWriter) }
1906Type.EmptyTypes
1931Type.EmptyTypes
2020List<Type> argTypes = new List<Type>();
2089private void WriteElementCall(string func, Type cast, SourceInfo source, string? name, string? ns, bool isNullable, bool isAny)
2094new Type[] { cast, typeof(string), typeof(string), typeof(bool), typeof(bool) }
2124Type.EmptyTypes
2160Type valueType = value.GetType();
2166new Type[] { valueType, valueType }
2197new Type[] { typeof(string), typeof(string), typeof(string) }
2226new Type[] { typeof(XmlSerializerNamespaces) }
2245private void WriteLocalDecl(string variableName, string initValue, Type type)
2255private void WriteTypeCompare(string variable, Type type)
2261private void WriteInstanceOf(SourceInfo source, Type type)
2265private void WriteArrayTypeCompare(string variable, Type arrayType)
2342foreach (Type type in scope.Types)
2372internal static void ILGenForEnumMember(CodeGenerator ilg, Type type, string memberName)
2386internal static void ILGenForCreateInstance(CodeGenerator ilg, Type type, bool ctorInaccessible, bool cast)
2392Type.EmptyTypes
2410internal static void ILGenForCreateInstance(CodeGenerator ilg, Type type, Type? cast)
2424Type? xName = type.Assembly.GetType("System.Xml.Linq.XName");
2430new Type[] { typeof(string) }
2434new Type[] { xName }
2455new[] { typeof(Type) }
2489MethodInfo constructorInvoke = typeof(ConstructorInfo).GetMethod("Invoke", new Type[] { typeof(object[]) })!;
2500Type.EmptyTypes)!;
2509new Type[] { typeof(Type) }
2521Type localType = initValue.Type!;
2561internal static void WriteCreateInstance(string source, bool ctorInaccessible, Type type, CodeGenerator ilg)
2569internal static void WriteInstanceOf(SourceInfo source, Type type, CodeGenerator ilg)
2581Type localType = (typeName == arrayTypeDesc.CSharpName) ? arrayTypeDesc.Type! : arrayTypeDesc.Type!.MakeArrayType();
2587internal static void WriteTypeCompare(string variable, Type type, CodeGenerator ilg)
2591ilg.Ldloc(typeof(Type), variable);
2595internal static void WriteArrayTypeCompare(string variable, Type arrayType, CodeGenerator ilg)
2599ilg.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;
170public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace) :
176public XmlSerializer(Type type, XmlRootAttribute? root) : this(type, null, Type.EmptyTypes, root, null, null)
181public XmlSerializer(Type type, Type[]? extraTypes) : this(type, null, extraTypes, null, null, null)
186public XmlSerializer(Type type, XmlAttributeOverrides? overrides) : this(type, overrides, Type.EmptyTypes, null, null, null)
203public XmlSerializer(Type type) : this(type, (string?)null)
208public XmlSerializer(Type type, string? defaultNamespace)
267public XmlSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace, string? location)
281private static XmlTypeMapping GenerateXmlTypeMapping(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace)
300internal static TempAssembly? GenerateTempAssembly(XmlMapping xmlMapping, Type? type, string? defaultNamespace)
306internal static TempAssembly? GenerateTempAssembly(XmlMapping xmlMapping, Type? type, string? defaultNamespace, string? location)
316return new TempAssembly(new XmlMapping[] { xmlMapping }, new Type?[] { type }, defaultNamespace, location);
542return FromMappings(mappings, (Type?)null);
546public static XmlSerializer?[] FromMappings(XmlMapping[]? mappings, Type? type)
584tempAssembly = new TempAssembly(mappings, new Type?[] { type }, null, null);
617private static XmlSerializer[] GetReflectionBasedSerializers(XmlMapping[] mappings, Type? type)
634internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, Stream stream)
650Type type = types[i];
673private static XmlSerializer[] GetSerializersFromCache(XmlMapping[] mappings, Type type)
702TempAssembly tempAssembly = new TempAssembly(pendingMappings, new Type[] { type }, null, null);
720public static XmlSerializer?[] FromTypes(Type[]? types)
734public static string GetXmlSerializerAssemblyName(Type type)
739public static string GetXmlSerializerAssemblyName(Type type, string? defaultNamespace)
809private static XmlTypeMapping? GetKnownMapping(Type type, string? ns)
827switch (Type.GetTypeCode(_primitiveType))
909switch (Type.GetTypeCode(_primitiveType))
System\Xml\Serialization\XmlSerializerFactory.cs (12)
22public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides? overrides, Type[]? extraTypes, XmlRootAttribute? root, string? defaultNamespace)
28public XmlSerializer CreateSerializer(Type type, XmlRootAttribute? root)
30return CreateSerializer(type, null, Type.EmptyTypes, root, null, null);
34public XmlSerializer CreateSerializer(Type type, Type[]? extraTypes)
40public XmlSerializer CreateSerializer(Type type, XmlAttributeOverrides? overrides)
42return CreateSerializer(type, overrides, Type.EmptyTypes, null, null, null);
52public XmlSerializer CreateSerializer(Type type)
58public XmlSerializer CreateSerializer(Type type, string? defaultNamespace)
64public 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)
97public static StorageDescriptor Local(LocalBuilder loc, Type itemStorageType, bool isCached)
114public static StorageDescriptor Current(LocalBuilder locIter, MethodInfo currentMethod, Type itemStorageType)
129public static StorageDescriptor Global(MethodInfo methGlobal, Type itemStorageType, bool isCached)
167public StorageDescriptor ToStorageType(Type itemStorageType)
226public Type ItemStorageType
672public 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 (356)
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)
319Type baseType;
330Type baseType;
344Type baseType;
365public override Type BaseType => typeof(Array);
369CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers)
382CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
407public override Type GetInterface(string name, bool ignoreCase)
413public override Type[] GetInterfaces()
432Type? returnType, Type[]? types, ParameterModifier[]? modifiers)
444public override Type[] GetNestedTypes(BindingFlags bindingAttr)
450public override Type GetNestedType(string name, BindingFlags bindingAttr)
474public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
488Type baseType;
525public override Type? GetElementType()
535public override Type UnderlyingSystemType => this;
542public override object[] GetCustomAttributes(Type attributeType, bool inherit)
547public 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 => GetEnumUnderlyingType();
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();
107CallingConventions callConvention, Type[] types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
120CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
127public override Type? GetInterface(string name, bool ignoreCase) => throw new NotSupportedException();
132Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
134public override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException();
136public override Type? GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException();
139public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
143public 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();
141public override Type MakePointerType() =>
144public override Type MakeByRefType() =>
148public override Type MakeArrayType() =>
152public override Type MakeArrayType(int rank) =>
System\Reflection\Emit\ILGeneratorImpl.cs (13)
59public override void BeginCatchBlock(Type? exceptionType)
216public override LocalBuilder DeclareLocal(Type localType, bool pinned)
586public override void Emit(OpCode opcode, Type cls)
594public override void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
612new KeyValuePair<MethodInfo, Type[]>(methodInfo, optionalParameterTypes));
616private static int GetStackChange(OpCode opcode, MethodInfo methodInfo, Type[]? optionalParameterTypes)
657Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes)
686public override void EmitCalli(OpCode opcode, CallingConvention unmanagedCallConv, Type? returnType, Type[]? parameterTypes)
694private static int GetStackChange(Type? returnType, Type[]? parameterTypes)
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 (55)
23private readonly Dictionary<Type, EntityHandle> _typeReferences = new();
38private Type?[]? _coreTypes;
40private static readonly Type[] s_coreTypes = { typeof(void), typeof(object), typeof(bool), typeof(char), typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int),
54internal Type GetTypeFromCoreAssembly(CoreTypeId typeId)
66_coreTypes = new Type[s_coreTypes.Length];
75internal CoreTypeId? GetTypeIdFromCoreTypes(Type type)
87_coreTypes = new Type[s_coreTypes.Length];
204foreach (Type iface in typeBuilder._interfaces)
369Type[] gParams = method.GetGenericArguments();
614if (pair.Key is KeyValuePair<MethodInfo, Type[]> pair2)
687private EntityHandle GetTypeReferenceOrSpecificationHandle(Type type)
714private TypeSpecificationHandle AddTypeSpecification(Type type) =>
718private MethodSpecificationHandle AddMethodSpecification(EntityHandle methodHandle, Type[] genericArgs) =>
732Type declaringType = field.DeclaringType!;
771private EntityHandle GetMethodReference(MethodInfo methodInfo, Type[] optionalParameterTypes)
786private BlobBuilder GetMethodSignature(MethodInfo method, Type[]? optionalParameterTypes) =>
810Type declaringType = methodBase.DeclaringType!;
821private static Type[] ParameterTypes(ParameterInfo[] parameterInfos)
825return Type.EmptyTypes;
828Type[] parameterTypes = new Type[parameterInfos.Length];
871foreach (Type constraint in gParam.GetGenericParameterConstraints())
881Type type = defaultValue.GetType();
989internal EntityHandle GetTypeHandle(Type type)
1020if (member is Type type)
1048internal TypeBuilder DefineNestedType(string name, TypeAttributes attr, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent,
1049Type[]? interfaces, PackingSize packingSize, int typesize, TypeBuilderImpl? enclosingType)
1061public override bool IsDefined(Type attributeType, bool inherit) => throw new NotImplementedException();
1095private static bool IsConstructedFromTypeBuilder(Type type)
1102Type? elementType = type.GetElementType();
1111internal static bool ContainsTypeBuilder(Type[] genericArguments)
1113foreach (Type type in genericArguments)
1129internal EntityHandle TryGetTypeHandle(Type type)
1185internal EntityHandle TryGetMethodHandle(MethodInfo method, Type[] optionalParameterTypes)
1223public override int GetTypeMetadataToken(Type type) => GetTokenForHandle(TryGetTypeHandle(type));
1236protected override EnumBuilder DefineEnumCore(string name, TypeAttributes visibility, Type underlyingType)
1244Type? returnType, Type[]? requiredReturnTypeCustomModifiers, Type[]? optionalReturnTypeCustomModifiers, Type[]? parameterTypes,
1245Type[][]? requiredParameterTypeCustomModifiers, Type[][]? optionalParameterTypeCustomModifiers)
1278CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes, CallingConvention nativeCallConv, CharSet nativeCharSet)
1293[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packingSize, int typesize)
1312protected override MethodInfo GetArrayMethodCore(Type arrayClass, string methodName,
1313CallingConventions callingConvention, Type? returnType, Type[]? parameterTypes)
1336CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
1355internal int GetSignatureToken(CallingConventions callingConventions, Type? returnType, Type[]? parameterTypes, Type[]? optionalParameterTypes) =>
1360internal 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;
96public override Type PropertyType => _propertyType;
106public override Type? DeclaringType => _containingType;
108public override Type? ReflectedType => _containingType;
150public override object[] GetCustomAttributes(Type attributeType, bool inherit) => throw new NotSupportedException(SR.NotSupported_DynamicModule);
152public 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 (75)
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>();
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)
323Type baseType = methodInfoDeclaration.DeclaringType!;
343private bool IsInterfaceImplemented(Type interfaceType)
347foreach (Type iface in _interfaces)
358foreach (Type @interface in _typeParent.GetInterfaces())
374[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type? parent, Type[]? interfaces, PackingSize packSize, int typeSize)
381CallingConventions callingConvention, Type? returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
382Type[][]? parameterTypeRequiredCustomModifiers, Type[][]? parameterTypeOptionalCustomModifiers, CallingConvention nativeCallConv, CharSet nativeCharSet)
411Type returnType, Type[]? returnTypeRequiredCustomModifiers, Type[]? returnTypeOptionalCustomModifiers, Type[]? parameterTypes,
412Type[][]? 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
639public override Type? BaseType => _typeParent;
665CallingConventions callConvention, Type[] types, ParameterModifier[]? _)
695private static bool MatchesTheFilter(MethodBuilderImpl method, BindingFlags methodFlags, BindingFlags bindingFlags, CallingConventions callConv, Type[]? argumentTypes)
721Type[] parameterTypes = method.ParameterTypes ?? EmptyTypes;
729Type? argType = argumentTypes[i];
730Type? paramType = parameterTypes[i];
802CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers)
896public override Type? GetInterface(string name, bool ignoreCase) => throw new NotSupportedException();
899public override Type[] GetInterfaces() => _interfaces == null ? EmptyTypes : _interfaces.ToArray();
905Type? returnType, Type[]? types, ParameterModifier[]? modifiers) => throw new NotSupportedException();
908public override Type[] GetNestedTypes(BindingFlags bindingAttr) => throw new NotSupportedException();
911public override Type? GetNestedType(string name, BindingFlags bindingAttr) => throw new NotSupportedException();
917public override InterfaceMapping GetInterfaceMap([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] Type interfaceType)
965private static Type[] GetParameterTypes(ParameterInfo[] parameterInfos)
967Type[] parameterTypes = new Type[parameterInfos.Length];
975private void ValidateInterfaceType(Type interfaceType)
999public override bool IsAssignableFrom([NotNullWhen(true)] Type? c)
1019Type[] interfaces = tb.GetInterfaces();
1038internal static bool AreTypesEqual(Type t1, Type? t2)
1056public override bool IsSubclassOf(Type c)
1058Type? 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 (95)
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.BinaryFormat (41)
System.Runtime.Serialization.Formatters (197)
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.Http (7)
System.ServiceModel.NetNamedPipe.Tests (1)
System.ServiceModel.Primitives (510)
Extensions\ReflectionExtensions.cs (36)
15public static Assembly Assembly(this Type type)
19public static Type BaseType(this Type type)
23public static bool ContainsGenericParameters(this Type type)
27public static ConstructorInfo GetConstructor(this Type type, Type[] types)
31public static ConstructorInfo GetConstructor(this Type type, BindingFlags bindingAttr, object binder, Type[] types, object[] modifiers)
35public static PropertyInfo GetProperty(this Type type, string name, BindingFlags bindingAttr)
39public static Type[] GetGenericArguments(this Type type)
43public static Type[] GetInterfaces(this Type type)
47public static bool IsAbstract(this Type type)
51public static bool IsAssignableFrom(this Type type, Type otherType)
55public static bool IsClass(this Type type)
59public static bool IsDefined(this Type type, Type attributeType, bool inherit)
63public static bool IsEnum(this Type type)
67public static bool IsGenericType(this Type type)
71public static bool IsInterface(this Type type)
75public static bool IsInstanceOfType(this Type type, object o)
79public static bool IsMarshalByRef(this Type type)
83public static bool IsNotPublic(this Type type)
87public static bool IsSealed(this Type type)
91public static bool IsValueType(this Type type)
95public static InterfaceMapping GetInterfaceMap(this Type type, Type interfaceType)
99public static MemberInfo[] GetMember(this Type type, string name, BindingFlags bindingAttr)
103public static MemberInfo[] GetMembers(this Type type, BindingFlags bindingAttr)
107public static MethodInfo GetMethod(this Type type, string name)
112public static MethodInfo GetMethod(this Type type, string name, Type[] types)
119public static TypeCode GetTypeCode(this Type type)
230public static Type ReflectedType(this MethodInfo mi)
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)
52public Type OwnerType
63public bool Matches(string localId, Type ownerType)
System\ServiceModel\Description\TypedMessageConverter.cs (7)
14public static TypedMessageConverter Create(Type messageContract, string action)
19public static TypedMessageConverter Create(Type messageContract, string action, string defaultNamespace)
24public static TypedMessageConverter Create(Type messageContract, string action, XmlSerializerFormatAttribute formatterAttribute)
29public static TypedMessageConverter Create(Type messageContract, string action, DataContractFormatAttribute formatterAttribute)
34public static TypedMessageConverter Create(Type messageContract, string action, string defaultNamespace, XmlSerializerFormatAttribute formatterAttribute)
45public static TypedMessageConverter Create(Type messageContract, string action, string defaultNamespace, DataContractFormatAttribute formatterAttribute)
63private static OperationFormatter GetOperationFormatter(Type t, Attribute formatAttribute, string defaultNS, string action)
System\ServiceModel\Description\TypeLoader.cs (87)
22private static Type[] s_messageContractMemberAttributes = {
28private static Type[] s_formatterAttributes = {
33private static Type[] s_knownTypesMethodParamType = new Type[] { typeof(ICustomAttributeProvider) };
38private static readonly Type s_OperationContractAttributeType = typeof(OperationContractAttribute);
46private readonly Dictionary<Type, ContractDescription> _contracts;
47private readonly Dictionary<Type, MessageDescriptionItems> _messages;
52_contracts = new Dictionary<Type, ContractDescription>();
53_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)
347foreach (Type knownType in knownTypes)
360private IEnumerable<Type> GetKnownTypes(object[] knownTypeAttributes, ICustomAttributeProvider provider)
367Type type = knownTypeAttribute.DeclaringType;
370type = provider as Type;
382if (!typeof(IEnumerable<Type>).IsAssignableFrom(method.ReturnType))
387return (IEnumerable<Type>)method.Invoke(null, new object[] { provider });
391List<Type> knownTypes = new List<Type>();
405private KeyedByTypeCollection<IOperationBehavior> GetIOperationBehaviorAttributesFromType(OperationDescription opDesc, Type targetIface, Type implType)
440Type ifaceType, Type implType, bool useImplAttrs)
515private static MethodInfo GetCorrespondingMethodFromType(Type type, MethodInfo methodInfo)
594internal void AddBehaviorsSFx(ServiceEndpoint serviceEndpoint, Type contractType)
606internal void AddBehaviorsFromImplementationType(ServiceEndpoint serviceEndpoint, Type implementationType)
623Type targetIface = serviceEndpoint.Contract.CallbackContractType;
631delegate (Type currentType, KeyedByTypeCollection<IOperationBehavior> behaviors)
644Type t = behavior.GetType();
686Type contractToGetMethodsFrom,
714internal static void EnsureCallbackType(Type callbackType)
723internal static void EnsureSubcontract(ServiceContractAttribute svcContractAttr, Type contractType)
725Type callbackType = svcContractAttr.CallbackContract;
727List<Type> types = ServiceReflector.GetInheritedContractTypes(contractType);
730Type inheritedContractType = types[i];
751private ContractDescription CreateContractDescription(ServiceContractAttribute contractAttr, Type contractType, Type serviceType, out ContractReflectionInfo reflectionInfo, object serviceImplementation)
763Type callbackType = contractAttr.CallbackContract;
778List<Type> types = ServiceReflector.GetInheritedContractTypes(contractType);
779List<Type> inheritedCallbackTypes = new List<Type>();
782Type inheritedContractType = types[i];
876Type taskTResult;
1003IEnumerable<Type> knownTypes = GetKnownTypes(methodAttributes, methodInfo);
1004foreach (Type knownType in knownTypes)
1145Type taskTResult,
1184Type responseType = isTask ? taskTResult : methodInfo.ReturnType;
1229Type returnType,
1282private static MessagePartDescription CreateParameterPartDescription(XmlName defaultName, string defaultNS, int index, ICustomAttributeProvider attrProvider, Type type)
1295internal MessageDescription CreateTypedMessageDescription(Type typedMessageType,
1325for (Type baseType = typedMessageType; baseType != null && baseType != typeof(object) && baseType != typeof(ValueType); baseType = baseType.BaseType())
1396Type memberType;
1458private MessagePartDescription CreateMessagePartDescription(Type bodyType,
1494private MessageHeaderDescription CreateMessageHeaderDescription(Type headerParameterType,
1574internal static Type GetParameterType(ParameterInfo parameterInfo)
1576Type parameterType = parameterInfo.ParameterType;
2015internal Type iface;
2016internal Type callbackiface;
2032Type serviceType,
2040for (Type currentType = serviceType; currentType != null; currentType = currentType.BaseType())
2046public delegate void ServiceInheritanceCallback<IBehavior, TBehaviorCollection>(Type currentType, KeyedByTypeCollection<IBehavior> behaviors);
2058Type type,
System\ServiceModel\Description\XmlSerializerOperationBehavior.cs (20)
209internal Reflector(string defaultNs, Type type)
229Type contractType = operation.DeclaringContract != null ? operation.DeclaringContract.ContractType : null;
383foreach (Type knownType in Operation.KnownTypes)
582Type bodyObjectType = bodyPart.Type;
603Type bodyObjectType = bodyPart.Type;
712private HashSet<Type> _includedTypes;
758private HashSet<Type> IncludedTypes
764_includedTypes = new HashSet<Type>();
801internal XmlTypeMapping ImportTypeMapping(Type type, bool isEncoded)
813internal void IncludeType(Type knownType, bool isEncoded)
847private Type _type;
850internal SerializerGenerationContext(Type type)
918private XmlSerializer[] CreateSerializersFromMappings(XmlMapping[] mappings, Type type)
1058static internal XmlReflectionMember GetXmlReflectionMember(XmlName memberName, XmlName elementName, string ns, Type type, ICustomAttributeProvider additionalAttributesProvider, bool isMultiple, bool isEncoded, bool isWrapped)
1098Type invalidAttributeType = null;
1131Type invalidAttributeType = null;
1242public static XmlSerializer[] FromMappings(XmlMapping[] mappings, Type type)
1252private static XmlSerializer[] FromMappingsViaReflection(XmlMapping[] mappings, Type type)
1262private static XmlSerializer[] FromMappingsViaInjection(XmlMapping[] mappings, Type type)
1269Type t;
System\ServiceModel\Dispatcher\DataContractSerializerOperationFormatter.cs (26)
21internal static DataContractSerializer CreateSerializer(Type type, int maxItems)
26internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, int maxItems)
33internal static DataContractSerializer CreateSerializer(Type type, string rootName, string rootNs, int maxItems)
38internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, string rootName, string rootNs, int maxItems)
47internal static DataContractSerializer CreateSerializer(Type type, XmlDictionaryString rootName, XmlDictionaryString rootNs, int maxItems)
52internal static DataContractSerializer CreateSerializer(Type type, IList<Type> knownTypes, XmlDictionaryString rootName, XmlDictionaryString rootNs, int maxItems)
64private static Type s_typeOfIQueryable = typeof(IQueryable);
65private static Type s_typeOfIQueryableGeneric = typeof(IQueryable<>);
66private static Type s_typeOfIEnumerable = typeof(IEnumerable);
67private static Type s_typeOfIEnumerableGeneric = typeof(IEnumerable<>);
71private IList<Type> _knownTypes;
84foreach (Type type in description.KnownTypes)
88_knownTypes = new List<Type>();
154private void ValidateDataContractType(Type type)
309KeyValuePair<Type, ArrayList>[] multipleHeaderValues = null;
350multipleHeaderValues = new KeyValuePair<Type, ArrayList>[parameters.Length];
355multipleHeaderValues[headerDescription.Index] = new KeyValuePair<Type, ArrayList>(headerDescription.TypedHeader ? TypedHeaderManager.GetMessageHeaderType(headerDescription.Type) : headerDescription.Type, new ArrayList());
400Type dataContractType = DataContractSerializerOperationFormatter.GetSubstituteDataContractType(headerDescription.Type, out isQueryable);
553internal static Type GetSubstituteDataContractType(Type type, out bool isQueryable)
609private IList<Type> _knownTypes;
614IList<Type> knownTypes, DataContractSerializerOperationBehavior behavior)
626public Type ContractType { get; }
System\ServiceModel\MessageHeaderT.cs (13)
47internal Type GetGenericArgument()
67private static Dictionary<Type, TypedHeaderManager> s_cache = new Dictionary<Type, TypedHeaderManager>();
69private static Type s_GenericAdapterType = typeof(GenericAdapter<>);
71internal static object Create(Type t, object content, bool mustUnderstand, bool relay, string actor)
76internal static object GetContent(Type t, object typedHeaderInstance, out bool mustUnderstand, out bool relay, out string actor)
81internal static Type GetMessageHeaderType(Type contentType)
85internal static Type GetHeaderType(Type headerParameterType)
96private static TypedHeaderManager GetTypedHeaderManager(Type t)
138protected abstract Type GetMessageHeaderType();
174protected override Type GetMessageHeaderType()
System\ServiceModel\Security\WSSecurityTokenSerializer.cs (13)
55public WSSecurityTokenSerializer(SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes)
60public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes)
65public WSSecurityTokenSerializer(SecurityVersion securityVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes,
71public WSSecurityTokenSerializer(SecurityVersion securityVersion, TrustVersion trustVersion, SecureConversationVersion secureConversationVersion, bool emitBspRequiredAttributes, SamlSerializer samlSerializer, SecurityStateEncoder securityStateEncoder, IEnumerable<Type> knownTypes,
341internal Type[] GetTokenTypes(string tokenTypeUri)
358protected internal virtual string GetTokenTypeUri(Type tokenType)
428private Type[] _tokenTypes = null;
431public Type TokenType { get { return GetTokenTypes()[0]; } }
435protected abstract Type[] GetTokenTypesCore();
437public Type[] GetTokenTypes()
447public bool SupportsCore(Type tokenType)
449Type[] tokenTypes = GetTokenTypes();
465protected static SecurityKeyIdentifierClause CreateDirectReference(XmlElement issuedTokenXml, string idAttributeLocalName, string idAttributeNamespace, Type tokenType)
System.ServiceModel.Primitives.Tests (20)
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 (550)
System\Text\Json\Serialization\Converters\CastingConverter.cs (6)
16internal override Type? KeyType => _sourceConverter.KeyType;
17internal override Type? ElementType => _sourceConverter.ElementType;
42public override T? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
48internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out T? value)
58public override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
61internal 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)
19public sealed override object ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
25internal sealed override object ReadAsPropertyNameCore(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
55Type runtimeType = value.GetType();
80public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
99public override object? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
110internal override bool OnTryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value)
System\Text\Json\Serialization\JsonConverter.cs (9)
30public abstract Type? Type { get; }
37public abstract bool CanConvert(Type typeToConvert);
155internal virtual Type? ElementType => null;
157internal virtual Type? KeyType => null;
189internal abstract object? ReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
190internal abstract bool OnTryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value);
191internal abstract bool TryReadAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, scoped ref ReadStack state, out object? value);
192internal abstract object? ReadAsPropertyNameAsObject(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options);
193internal 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);
583/// <param name="typeToConvert">The <see cref="System.Type"/> being converted.</param>
587public virtual T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
599internal 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\PolymorphicTypeResolver.cs (16)
18private readonly ConcurrentDictionary<Type, DerivedJsonTypeInfo?> _typeToDiscriminatorId = new();
22public PolymorphicTypeResolver(JsonSerializerOptions options, JsonPolymorphismOptions polymorphismOptions, Type baseType, bool converterCanHaveMetadata)
35foreach ((Type derivedType, object? typeDiscriminator) in polymorphismOptions.DerivedTypes)
94public Type BaseType { get; }
101public bool TryGetDerivedJsonTypeInfo(Type runtimeType, [NotNullWhen(true)] out JsonTypeInfo? jsonTypeInfo, out object? typeDiscriminator)
167public static bool IsSupportedPolymorphicBaseType(Type? type) =>
175public static bool IsSupportedDerivedType(Type baseType, Type? derivedType) =>
181private DerivedJsonTypeInfo? CalculateNearestAncestor(Type type)
195for (Type? candidate = type.BaseType; BaseType.IsAssignableFrom(candidate); candidate = candidate.BaseType)
209foreach (Type interfaceTy in type.GetInterfaces())
249for (Type? candidate = typeInfo.Type.BaseType; candidate != null; candidate = candidate.BaseType)
261foreach (Type interfaceType in typeInfo.Type.GetInterfaces())
294static JsonTypeInfo? ResolveAncestorTypeInfo(Type type, JsonSerializerOptions options)
316public DerivedJsonTypeInfo(Type type, object? typeDiscriminator)
324public Type DerivedType { get; }
System\Text\Json\Serialization\Metadata\ReflectionEmitMemberAccessor.cs (31)
23public override Func<object>? CreateParameterlessConstructor(Type type, ConstructorInfo? constructorInfo)
41Type.EmptyTypes,
80Type? type = constructor.DeclaringType;
100Type paramType = parameters[i].ParameterType;
121private static DynamicMethod? CreateParameterizedConstructor(ConstructorInfo constructor, Type parameterType1, Type parameterType2, Type parameterType3, Type parameterType4)
123Type? type = constructor.DeclaringType;
168[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods)] Type collectionType)
198private static DynamicMethod CreateImmutableEnumerableCreateRangeDelegate(Type collectionType, Type elementType, Type enumerableType)
226private static DynamicMethod CreateImmutableDictionaryCreateRangeDelegate(Type collectionType, Type keyType, Type valueType, Type enumerableType)
249private static DynamicMethod CreatePropertyGetter(PropertyInfo propertyInfo, Type runtimePropertyType)
254Type? declaringType = propertyInfo.DeclaringType;
257Type declaredPropertyType = propertyInfo.PropertyType;
295private static DynamicMethod CreatePropertySetter(PropertyInfo propertyInfo, Type runtimePropertyType)
300Type? declaringType = propertyInfo.DeclaringType;
303Type declaredPropertyType = propertyInfo.PropertyType;
333private static DynamicMethod CreateFieldGetter(FieldInfo fieldInfo, Type runtimeFieldType)
335Type? declaringType = fieldInfo.DeclaringType;
338Type declaredFieldType = fieldInfo.FieldType;
367private static DynamicMethod CreateFieldSetter(FieldInfo fieldInfo, Type runtimeFieldType)
369Type? declaringType = fieldInfo.DeclaringType;
372Type declaredFieldType = fieldInfo.FieldType;
397private static DynamicMethod CreateGetterMethod(string memberName, Type memberType) =>
407private static DynamicMethod CreateSetterMethod(string memberName, Type memberType) =>
System\Text\Json\ThrowHelper.Serialization.cs (73)
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)
337public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsNull(Type converterType)
343public static void ThrowInvalidOperationException_SerializerConverterFactoryReturnsJsonConverterFactorty(Type converterType)
350Type parentType,
365public static void ThrowInvalidOperationException_ConstructorParameterIncompleteBinding(Type parentType)
377public static void ThrowInvalidOperationException_JsonIncludeOnInaccessibleProperty(string memberName, Type declaringType)
383public static void ThrowInvalidOperationException_IgnoreConditionOnValueTypeInvalid(string clrPropertyName, Type propertyDeclaringType)
396public static void ThrowInvalidOperationException_ConverterCanConvertMultipleTypes(Type runtimePropertyType, JsonConverter jsonConverter)
422public static void ThrowInvalidOperationException_CreateObjectConverterNotCompatible(Type type)
479Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
522public static void ThrowInvalidOperationException_SerializationDuplicateAttribute(Type attribute, MemberInfo memberInfo)
524string location = memberInfo is Type type ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}";
529public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute(Type classType, Type attribute)
535public static void ThrowInvalidOperationException_SerializationDuplicateTypeAttribute<TAttribute>(Type classType)
541public static void ThrowInvalidOperationException_ExtensionDataConflictsWithUnmappedMemberHandling(Type classType, JsonPropertyInfo jsonPropertyInfo)
573Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
601Type propertyType = state.Current.JsonPropertyInfo?.PropertyType ?? state.Current.JsonTypeInfo.Type;
621Type type = typeInfo.Type;
648public static void ThrowNotSupportedException_CannotPopulateCollection(Type type, ref Utf8JsonReader reader, scoped ref ReadStack state)
692public static void ThrowJsonException_UnmappedJsonProperty(Type type, string unmappedPropertyName)
746public static void ThrowJsonException_MetadataInvalidReferenceToValueType(Type propertyType)
752public static void ThrowJsonException_MetadataInvalidPropertyInArrayMetadata(scoped ref ReadStack state, Type propertyType, in Utf8JsonReader reader)
763public static void ThrowJsonException_MetadataPreservedArrayValuesNotFound(scoped ref ReadStack state, Type propertyType)
774public static void ThrowJsonException_MetadataCannotParsePreservedObjectIntoImmutable(Type propertyType)
780public static void ThrowInvalidOperationException_MetadataReferenceOfTypeCannotBeAssignedToType(string referenceId, Type currentType, Type typeToConvert)
811public static void ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
816public static NotSupportedException GetNotSupportedException_AmbiguousMetadataForType(Type type, Type match1, Type match2)
822public static void ThrowNotSupportedException_ConstructorContainsNullParameterNames(Type declaringType)
828public static void ThrowInvalidOperationException_NoMetadataForType(Type type, IJsonTypeInfoResolver? resolver)
833public static Exception GetInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, Type type)
839public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, Type type)
851public static void ThrowNotSupportedException_BaseConverterDoesNotSupportMetadata(Type derivedType)
857public static void ThrowNotSupportedException_DerivedConverterDoesNotSupportMetadata(Type derivedType)
863public static void ThrowNotSupportedException_RuntimeTypeNotSupported(Type baseType, Type runtimeType)
869public static void ThrowNotSupportedException_RuntimeTypeDiamondAmbiguity(Type baseType, Type runtimeType, Type derivedType1, Type derivedType2)
875public static void ThrowInvalidOperationException_TypeDoesNotSupportPolymorphism(Type baseType)
881public static void ThrowInvalidOperationException_DerivedTypeNotSupported(Type baseType, Type derivedType)
887public static void ThrowInvalidOperationException_DerivedTypeIsAlreadySpecified(Type baseType, Type derivedType)
893public static void ThrowInvalidOperationException_TypeDicriminatorIdIsAlreadySpecified(Type baseType, object typeDiscriminator)
905public static void ThrowInvalidOperationException_PolymorphicTypeConfigurationDoesNotSpecifyDerivedTypes(Type baseType)
911public static void ThrowInvalidOperationException_InvalidEnumTypeWithSpecialChar(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)
67private static readonly MethodInfo s_spanIndexOfChar = typeof(MemoryExtensions).GetMethod("IndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
68private static readonly MethodInfo s_spanIndexOfSpan = typeof(MemoryExtensions).GetMethod("IndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
70private static readonly MethodInfo s_spanIndexOfAnyCharChar = typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
71private static readonly MethodInfo s_spanIndexOfAnyCharCharChar = typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
72private static readonly MethodInfo s_spanIndexOfAnySpan = typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
73private static readonly MethodInfo s_spanIndexOfAnySearchValues = typeof(MemoryExtensions).GetMethod("IndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
75private static readonly MethodInfo s_spanIndexOfAnyExceptChar = typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
76private static readonly MethodInfo s_spanIndexOfAnyExceptCharChar = typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
77private static readonly MethodInfo s_spanIndexOfAnyExceptCharCharChar = typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
78private static readonly MethodInfo s_spanIndexOfAnyExceptSpan = typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
79private static readonly MethodInfo s_spanIndexOfAnyExceptSearchValues = typeof(MemoryExtensions).GetMethod("IndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
80private static readonly MethodInfo s_spanIndexOfAnyInRange = typeof(MemoryExtensions).GetMethod("IndexOfAnyInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
81private static readonly MethodInfo s_spanIndexOfAnyExceptInRange = typeof(MemoryExtensions).GetMethod("IndexOfAnyExceptInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
82private static readonly MethodInfo s_spanLastIndexOfChar = typeof(MemoryExtensions).GetMethod("LastIndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
83private static readonly MethodInfo s_spanLastIndexOfAnyCharChar = typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
84private static readonly MethodInfo s_spanLastIndexOfAnyCharCharChar = typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
85private static readonly MethodInfo s_spanLastIndexOfAnySpan = typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
86private static readonly MethodInfo s_spanLastIndexOfAnySearchValues = typeof(MemoryExtensions).GetMethod("LastIndexOfAny", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
87private static readonly MethodInfo s_spanLastIndexOfSpan = typeof(MemoryExtensions).GetMethod("LastIndexOf", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
88private static readonly MethodInfo s_spanLastIndexOfAnyExceptChar = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
89private static readonly MethodInfo s_spanLastIndexOfAnyExceptCharChar = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
90private static readonly MethodInfo s_spanLastIndexOfAnyExceptCharCharChar = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
91private static readonly MethodInfo s_spanLastIndexOfAnyExceptSpan = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
92private static readonly MethodInfo s_spanLastIndexOfAnyExceptSearchValues = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExcept", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(SearchValues<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
93private static readonly MethodInfo s_spanLastIndexOfAnyInRange = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
94private static readonly MethodInfo s_spanLastIndexOfAnyExceptInRange = typeof(MemoryExtensions).GetMethod("LastIndexOfAnyExceptInRange", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), Type.MakeGenericMethodParameter(0), Type.MakeGenericMethodParameter(0)])!.MakeGenericMethod(typeof(char));
97private static readonly MethodInfo s_spanStartsWithSpan = typeof(MemoryExtensions).GetMethod("StartsWith", [typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(ReadOnlySpan<>).MakeGenericType(Type.MakeGenericMethodParameter(0))])!.MakeGenericMethod(typeof(char));
103private static readonly MethodInfo s_memoryMarshalGetArrayDataReferenceSearchValues = 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.Web.Services.Description (120)
System\Web\Services\Configuration\XmlFormatExtensionAttribute.cs (18)
8private Type[] _types;
15public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1) : this(elementName, ns, new Type[] { extensionPoint1 }) {
18public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2 }) {
21public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3 }) {
24public XmlFormatExtensionAttribute(string elementName, string ns, Type extensionPoint1, Type extensionPoint2, Type extensionPoint3, Type extensionPoint4) : this(elementName, ns, new Type[] { extensionPoint1, extensionPoint2, extensionPoint3, extensionPoint4 }) {
27public XmlFormatExtensionAttribute(string elementName, string ns, Type[] extensionPoints) {
33public Type[] ExtensionPoints {
34get { return _types == null ? new Type[0] : _types; }
System.Windows.Controls.Ribbon (54)
Microsoft\Windows\Controls\Ribbon\RibbonContextMenu.cs (5)
47Type ownerType = typeof(RibbonContextMenu);
409public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
439public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
467public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
478public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
System.Windows.Extensions (1)
System.Xaml (385)
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\ReflectionHelper.cs (25)
86internal static Type GetQualifiedType(string typeName)
95return Type.GetType(nameFrags[0]);
125internal static bool IsNullableType(Type type)
130internal static bool IsInternalType(Type type)
132Type origType = type;
152internal static bool IsPublicType(Type type)
169internal static Type GetFrameworkType(string assemblyName, Type type)
193internal static Type GetSystemType(Type type)
219internal static string GetTypeConverterAttributeData(Type type, out Type converterType)
225internal static string GetTypeConverterAttributeData(MemberInfo mi, out Type converterType)
233private static string GetCustomAttributeData(MemberInfo mi, Type attrType, out Type typeValue)
256private static string GetCustomAttributeData(IList<CustomAttributeData> list, Type attrType, out Type typeValue, bool allowTypeAlso, bool allowZeroArgs)
277internal static string GetCustomAttributeData(Type t,
278Type attrType,
281out Type typeValue)
285Type currentType = t;
320Type attrType,
321out Type typeValue,
344if (attrValue == null && allowTypeAlso && tca.ArgumentType == typeof(Type))
347typeValue = tca.Value as Type;
System\Xaml\Runtime\ClrObjectRuntime.cs (12)
76Type type = xamlType.UnderlyingType;
105protected virtual object InvokeFactoryMethod(Type type, string methodName, object[] args)
111protected MethodInfo GetFactoryMethod(Type type, string methodName, object[] args, BindingFlags flags)
116factory = type.GetMethod(methodName, flags, null, Type.EmptyTypes, null);
136return Type.DefaultBinder.BindToMethod(
187public override bool CanConvertTo(ITypeDescriptorContext context, TypeConverter converter, Type type)
374Type keyType = dictionaryType.KeyType.UnderlyingType;
375Type itemType = dictionaryType.ItemType.UnderlyingType;
376Type genericKVP = typeof(KeyValuePair<,>).MakeGenericType(keyType, itemType);
377Type genericIEnumerator = typeof(IEnumerator<>).MakeGenericType(genericKVP);
382var method = openMethod.MakeGenericMethod(new Type[] { keyType, itemType });
661protected virtual Delegate CreateDelegate(Type delegateType, object target, string methodName)
System\Xaml\Runtime\DynamicMethodRuntime.cs (41)
44delegate Delegate DelegateCreator(Type delegateType, object target, string methodName);
48Type _localType;
63Dictionary<Type, object> _converterInstances;
64Dictionary<Type, DelegateCreator> _delegateCreators;
103private Dictionary<Type, object> ConverterInstances
109_converterInstances = new Dictionary<Type, object>();
115private Dictionary<Type, DelegateCreator> DelegateCreators
121_delegateCreators = new Dictionary<Type, DelegateCreator>();
143Type clrType = ts.ConverterType;
169Type delegateType;
178protected override Delegate CreateDelegate(Type delegateType, object target, string methodName)
181Type targetType = target.GetType();
195private object CreateInstanceWithCtor(Type type, object[] args)
200ctor = type.GetConstructor(BF_AllInstanceMembers, null, Type.EmptyTypes, null);
218protected override object InvokeFactoryMethod(Type type, string methodName, object[] args)
264private DelegateCreator CreateDelegateCreator(Type targetType)
273helperFlags, null, new Type[] { typeof(Type), typeof(string) }, null);
284typeof(Delegate), typeof(Type), typeof(object), typeof(string));
301typeof(Delegate), typeof(Type), typeof(object), typeof(string));
309new Type[] { typeof(Type), typeof(object), typeof(string) }, null);
357Type[] paramTypes = new Type[parameters.Length];
361Type paramType = parameters[i].ParameterType;
369Type elementType = paramType.GetElementType();
414Type targetType = getter.IsStatic ? getter.GetParameters()[0].ParameterType : GetTargetType(getter);
433Type targetType = setter.IsStatic ? parameters[0].ParameterType : GetTargetType(setter);
434Type valueType = setter.IsStatic ? parameters[1].ParameterType : parameters[0].ParameterType;
447private DynamicMethod CreateDynamicMethod(string name, Type returnType, params Type[] argTypes)
459private Type GetTargetType(MethodInfo instanceMethod)
461Type declaringType = instanceMethod.DeclaringType;
492private static void Emit_CastTo(ILGenerator ilGenerator, Type toType)
504private static void Emit_BoxIfValueType(ILGenerator ilGenerator, Type type)
552private void Emit_LateBoundInvoke(ILGenerator ilGenerator, Type targetType, string methodName,
582s_InvokeMemberMethod = typeof(Type).GetMethod(KnownStrings.InvokeMember,
583new Type[] { typeof(string), typeof(BindingFlags), typeof(Binder), typeof(object), typeof(object[]) });
588private void Emit_TypeOf(ILGenerator ilGenerator, Type type)
593s_GetTypeFromHandleMethod = typeof(Type).GetMethod(
595null, new Type[] { typeof(RuntimeTypeHandle) }, null);
System\Xaml\Schema\CollectionReflector.cs (33)
16private static Type[] s_typeOfObjectArray;
17private static Type[] s_typeOfTwoObjectArray;
31internal static XamlCollectionKind LookupCollectionKind(Type type, out MethodInfo addMethod)
81internal static MethodInfo LookupAddMethod(Type type, XamlCollectionKind collectionKind)
106private static bool TryGetICollectionAdder(Type type, out MethodInfo addMethod)
109Type genericICollection = GetGenericInterface(type, typeof(ICollection<>), out hasMoreThanOneICollection);
124private static bool TryGetCollectionAdder(Type type, bool mayBeICollection, out MethodInfo addMethod)
170private static bool TryGetIDictionaryAdder(Type type, out MethodInfo addMethod)
173Type genericIDictionary = GetGenericInterface(type, typeof(IDictionary<,>), out hasMoreThanOneIDictionary);
188private static bool TryGetDictionaryAdder(Type type, bool mayBeIDictionary, out MethodInfo addMethod)
232internal static MethodInfo GetAddMethod(Type type, Type contentType)
234return GetMethod(type, KnownStrings.Add, new Type[] { contentType });
237internal static MethodInfo GetEnumeratorMethod(Type type)
249internal static MethodInfo GetIsReadOnlyMethod(Type collectionType, Type itemType)
251Type genericICollection = typeof(ICollection<>).MakeGenericType(itemType);
260private static MethodInfo LookupEnumeratorMethod(Type type)
262MethodInfo result = GetMethod(type, KnownStrings.GetEnumerator, Type.EmptyTypes);
270private static Type GetGenericInterface(Type type, Type interfaceType, out bool hasMultiple)
272Type result = null;
278foreach (Type currentInterface in type.GetInterfaces())
294private static MethodInfo GetAddMethod(Type type, int paramCount, out bool hasMoreThanOne)
325private static BindingFlags GetBindingFlags(Type type)
337private static MethodInfo GetMethod(Type type, string name, Type[] argTypes)
347private static MethodInfo GetPublicMethod(Type type, string name, int argCount)
361private static Type[] TypeOfObjectArray
367s_typeOfObjectArray = new Type[] { typeof(object) };
373private static Type[] TypeOfTwoObjectArray
379s_typeOfTwoObjectArray = new Type[] { typeof(object), typeof(object) };
System\Xaml\Schema\Reflector.cs (33)
45public bool IsAttributePresent(Type attributeType)
64public string GetAttributeString(Type attributeType, out bool checkedInherited)
130public IReadOnlyDictionary<char,char> GetBracketCharacterAttributes(Type attributeType)
164public T? GetAttributeValue<T>(Type attributeType) where T : struct
202public Type GetAttributeType(Type attributeType)
214return Type.GetType(typeName);
243public Type[] GetAttributeTypes(Type attributeType, int count)
255Type converterType = Type.GetType(tca.LoaderTypeName);
256Type contentType = Type.GetType(tca.ContentTypeName);
257return new Type[] { converterType, contentType };
275public List<T> GetAllAttributeContents<T>(Type attributeType)
379private static bool TypesAreEqual(Type userType, Type builtInType)
391private ReadOnlyDictionary<char, char> TokenizeBracketCharacters(Type attributeType)
412private Type ExtractType(CustomAttributeData cad)
414Type result = null;
421ThrowInvalidMetadata(cad, 1, typeof(Type));
426private Type[] ExtractTypes(CustomAttributeData cad, int count)
430ThrowInvalidMetadata(cad, count, typeof(Type));
432Type[] result = new Type[count];
438ThrowInvalidMetadata(cad, count, typeof(Type));
444private Type ExtractType(CustomAttributeTypedArgument arg)
446if (arg.ArgumentType == typeof(Type))
448return (Type)arg.Value;
453return Type.GetType(typeName);
481private CustomAttributeData GetAttribute(Type attributeType)
494private void GetAttributes(Type attributeType, IList<CustomAttributeData> cads)
506protected void ThrowInvalidMetadata(CustomAttributeData cad, int expectedCount, Type expectedType)
System\Xaml\XamlSchemaContext.cs (15)
469private ConcurrentDictionary<Type, XamlType> _masterTypeList;
470private ConcurrentDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object> _masterValueConverterList;
492private ConcurrentDictionary<Type, XamlType> MasterTypeList
497Interlocked.CompareExchange(ref _masterTypeList, CreateDictionary<Type, XamlType>(ReferenceEqualityComparer.Instance), null);
503private ConcurrentDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object> MasterValueConverterList
508Interlocked.CompareExchange(ref _masterValueConverterList, CreateDictionary<ReferenceEqualityTuple<Type, XamlType, Type>, object>(), null);
524public virtual XamlType GetXamlType(Type type)
531internal XamlType GetXamlType(Type type, string alias)
596Type converterType, XamlType targetType)
599var key = new ReferenceEqualityTuple<Type, XamlType, Type>(converterType, targetType, typeof(TConverterBase));
894Type clrType = type.UnderlyingType;
System\Xaml\XamlType.cs (37)
35private NullableReference<Type> _underlyingType;
60public XamlType(Type underlyingType, XamlSchemaContext schemaContext)
65public XamlType(Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker)
70internal XamlType(string alias, Type underlyingType, XamlSchemaContext schemaContext, XamlTypeInvoker invoker, TypeReflector reflector)
155public Type UnderlyingType
170internal NullableReference<Type> UnderlyingTypeInternal
418Type baseUnderlyingType = xamlType.UnderlyingType;
422Type curUnderlyingType = curType.UnderlyingType;
594Type underlyingType = UnderlyingType;
625internal ConstructorInfo GetConstructor(Type[] paramTypes)
637MethodBase result = Type.DefaultBinder.SelectMethod(ConstructorBindingFlags, ctorArray, paramTypes, null);
645Type attributeType = null;
708Type underlyingType = UnderlyingType;
738Type underlyingType = UnderlyingType;
748ConstructorInfo defaultCtor = underlyingType.GetConstructor(ConstructorBindingFlags, null, Type.EmptyTypes, null);
776List<Type> wrapperTypes = _reflector.GetAllAttributeContents<Type>(typeof(ContentWrapperAttribute));
780foreach (Type wrapperType in wrapperTypes)
813Type[] loaderTypes = _reflector.GetAttributeTypes(typeof(XamlDeferLoadAttribute), 2);
828Type underlyingType = UnderlyingType;
935Type result = null;
968Type returnType = _reflector.GetAttributeType(typeof(MarkupExtensionReturnTypeAttribute));
1107protected virtual Type LookupUnderlyingType()
1114Type underlyingType = UnderlyingType;
1154Type converterType = _reflector.GetAttributeType(typeof(TypeConverterAttribute));
1170Type underlyingType = UnderlyingType;
1184Type[] typeArgs = underlyingType.GetGenericArguments();
1198Type converterType = _reflector.GetAttributeType(typeof(ValueSerializerAttribute));
1214Type underlyingType = UnderlyingType;
1224Type[] typeArgs = underlyingType.GetGenericArguments();
1486private static ReadOnlyCollection<XamlType> GetTypeArguments(Type type, XamlSchemaContext schemaContext)
1488Type genericType = type;
1497Type[] types = genericType.GetGenericArguments();
1506private static string GetTypeName(Type type)
1574XamlType typeOfType = SchemaContext.GetXamlType(typeof(Type));
1588Type type = param.ParameterType;
1684private bool TryGetAttributeString(Type attributeType, out string result)
System.Xaml.Tests (53)
System\Windows\Markup\ValueSerializerTests.cs (15)
118yield return new object[] { typeof(Type) };
127public void GetSerializerFor_WellKnownType_ReturnsExpected(Type type)
198public void GetSerializerFor_NoSuchTypeConverterAttribute_ReturnsNull(Type type)
229Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!));
230Assert.Throws<ArgumentNullException>("type", () => ValueSerializer.GetSerializerFor((Type)null!, null));
284public void GetSerializerFor_DescriptorHasNoConverter_ReturnsNull(Type type)
442public ValueSerializer? GetValueSerializerFor(Type type) => SerializerResult;
452public object GetService(Type serviceType) => throw new NotImplementedException();
462public override bool CanConvertTo(ITypeDescriptorContext? context, Type? sourceType)
468public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
479public override object ConvertTo(ITypeDescriptorContext? context, CultureInfo? culture, object? value, Type destinationType)
487public override bool CanConvertTo(ITypeDescriptorContext? context, Type? sourceType)
492public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
500public override bool CanConvertTo(ITypeDescriptorContext? context, Type? sourceType)
505public override bool CanConvertFrom(ITypeDescriptorContext? context, Type? sourceType)
UIAutomationClient (12)
UnitTests.Common (7)
WasmAppBuilder (21)
WindowsFormsIntegration (2)
XmlFileLogger (4)
XmlFormattersWebSite (2)
xunit.assert (77)
xunit.console (5)
Xunit.NetCore.Extensions (12)