36 overrides of DeclaringType
PresentationFramework (1)
MS\Internal\Data\IndexerPropertyInfo.cs (1)
80public override Type DeclaringType
System.Private.CoreLib (16)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\ConstructorOnTypeBuilderInstantiation.cs (1)
40public override Type? DeclaringType => _type;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\DynamicMethod.cs (1)
317public override Type? DeclaringType => null;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\FieldOnTypeBuilderInstantiation.cs (1)
47public override Type? DeclaringType => _type;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilderInstantiation.cs (1)
45public override Type? DeclaringType => _method.DeclaringType;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodOnTypeBuilderInstantiation.cs (1)
53public override Type? DeclaringType => _type;
src\libraries\System.Private.CoreLib\src\System\Type.cs (1)
43public override Type? DeclaringType => null;
src\System\Reflection\Emit\RuntimeConstructorBuilder.cs (1)
69public override Type? DeclaringType => m_methodBuilder.DeclaringType;
src\System\Reflection\Emit\RuntimeFieldBuilder.cs (1)
61public override Type? DeclaringType
src\System\Reflection\Emit\RuntimeMethodBuilder.cs (1)
409public override Type? DeclaringType
src\System\Reflection\Emit\RuntimePropertyBuilder.cs (1)
192public override Type? DeclaringType => m_containingType;
src\System\Reflection\Emit\SymbolMethod.cs (1)
78public override Type? DeclaringType => m_containingType;
src\System\Reflection\RuntimeConstructorInfo.CoreCLR.cs (1)
164public override Type? DeclaringType => m_reflectedTypeCache.IsGlobal ? null : m_declaringType;
src\System\Reflection\RuntimeEventInfo.cs (1)
123public override Type? DeclaringType => m_declaringType;
src\System\Reflection\RuntimeFieldInfo.cs (1)
43public override Type? DeclaringType => m_reflectedTypeCache.IsGlobal ? null : m_declaringType;
src\System\Reflection\RuntimeMethodInfo.CoreCLR.cs (1)
206public override Type? DeclaringType
src\System\Reflection\RuntimePropertyInfo.cs (1)
171public override Type? DeclaringType => m_declaringType;
System.Reflection.Context (7)
System\Reflection\Context\Delegation\DelegatingConstructorInfo.cs (1)
34public override Type? DeclaringType
System\Reflection\Context\Delegation\DelegatingEventInfo.cs (1)
23public override Type? DeclaringType
System\Reflection\Context\Delegation\DelegatingFieldInfo.cs (1)
24public override Type? DeclaringType
System\Reflection\Context\Delegation\DelegatingMethodInfo.cs (1)
36public override Type? DeclaringType
System\Reflection\Context\Delegation\DelegatingPropertyInfo.cs (1)
34public override Type? DeclaringType
System\Reflection\Context\Virtual\VirtualPropertyBase.cs (1)
42public sealed override Type? DeclaringType
System\Reflection\Context\Virtual\VirtualPropertyBase.FuncPropertyAccessorBase.cs (1)
29public sealed override Type? DeclaringType
System.Reflection.Emit (2)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilderInstantiation.cs (1)
45public override Type? DeclaringType => _method.DeclaringType;
System\Reflection\Emit\ArrayMethod.cs (1)
56public override Type? DeclaringType => _containingType;
System.Reflection.MetadataLoadContext (5)
System\Reflection\TypeLoading\Constructors\RoConstructor.cs (1)
19public sealed override Type DeclaringType => GetRoDeclaringType();
System\Reflection\TypeLoading\Events\RoEvent.cs (1)
30public sealed override Type DeclaringType => GetRoDeclaringType();
System\Reflection\TypeLoading\Fields\RoField.cs (1)
32public sealed override Type DeclaringType => GetRoDeclaringType();
System\Reflection\TypeLoading\Methods\RoMethod.cs (1)
27public sealed override Type DeclaringType => GetRoDeclaringType();
System\Reflection\TypeLoading\Properties\RoProperty.cs (1)
31public sealed override Type DeclaringType => GetRoDeclaringType();
System.Runtime.InteropServices (1)
System\Runtime\InteropServices\ComAwareEventInfo.cs (1)
74public override Type? DeclaringType => _innerEventInfo.DeclaringType;
System.Runtime.Serialization.Formatters (1)
System\Runtime\Serialization\SerializationFieldInfo.cs (1)
35public override Type? DeclaringType => m_field.DeclaringType;
System.Xaml.Tests (3)
Common\CustomConstructorInfo.cs (1)
23public override Type DeclaringType => DeclaringTypeResult.Or(DelegatingConstructor.DeclaringType!);
Common\CustomMethodInfo.cs (1)
23public override Type DeclaringType => DeclaringTypeResult.Or(DelegatingMethod.DeclaringType)!;
System\Xaml\XamlMemberTests.cs (1)
2379public override Type DeclaringType => DelegatingProperty.DeclaringType!;
874 references to DeclaringType
Aspire.Confluent.Kafka (1)
src\Vendoring\OpenTelemetry.Instrumentation.ConfluentKafka\Shared\PropertyFetcher.AOT.cs (1)
112var declaringType = propertyInfo.DeclaringType;
Aspire.Hosting.Testing (2)
DistributedApplicationEntryPointInvoker.cs (1)
126Name = $"{_entryPoint.DeclaringType?.Assembly.GetName().Name ?? "Unknown"}.EntryPoint"
DistributedApplicationTestingBuilder.cs (1)
358var asm = stackFrame.GetMethod()?.DeclaringType?.Assembly;
Aspire.Microsoft.Data.SqlClient (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\PropertyFetcher.cs (1)
108var declaringType = propertyInfo.DeclaringType;
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\DiagnosticSourceInstrumentation\PropertyFetcher.cs (1)
108var declaringType = propertyInfo.DeclaringType;
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Shared\PropertyFetcher.AOT.cs (1)
114var declaringType = propertyInfo.DeclaringType;
dotnet-svcutil-lib (100)
FrameworkFork\Microsoft.Xml\Xml\Serialization\CodeGenerator.cs (2)
637if (methodInfo.IsVirtual && !methodInfo.DeclaringType.GetTypeInfo().IsValueType) 738Type currentType = propertyInfo.DeclaringType.GetTypeInfo().BaseType;
FrameworkFork\Microsoft.Xml\Xml\Serialization\Mappings.cs (3)
1309throw new InvalidOperationException(string.Format(ResXml.XmlSerializableRootDupName, _getSchemaMethod.DeclaringType.FullName, e.Name, elementNs)); 1395throw new InvalidOperationException(string.Format(ResXml.XmlGetSchemaInclude, _xsiType.Namespace, _getSchemaMethod.DeclaringType.FullName, _getSchemaMethod.Name)); 1405throw new InvalidOperationException(string.Format(ResXml.XmlGetSchemaTypeMissing, _getSchemaMethod.DeclaringType.FullName, _getSchemaMethod.Name, _xsiType.Name, _xsiType.Namespace));
FrameworkFork\Microsoft.Xml\Xml\Serialization\Models.cs (6)
195throw new InvalidOperationException(string.Format(ResXml.XmlSerializerUnsupportedMember, member.DeclaringType.FullName + "." + member.Name, type.FullName), typeDesc.Exception); 204if (fieldInfo.DeclaringType != Type) return null; 216if (propertyInfo.DeclaringType != Type) return null; 282_checkShouldPersistMethodInfo = memberInfo.DeclaringType.GetMethod("ShouldSerialize" + memberInfo.Name, new Type[0]); 285FieldInfo specifiedField = memberInfo.DeclaringType.GetField(memberInfo.Name + "Specified"); 297PropertyInfo specifiedProperty = memberInfo.DeclaringType.GetProperty(memberInfo.Name + "Specified");
FrameworkFork\Microsoft.Xml\Xml\Serialization\SoapReflectionImporter.cs (1)
186SoapAttributes attrs = _attributeOverrides[memberInfo.DeclaringType, memberInfo.Name];
FrameworkFork\Microsoft.Xml\Xml\Serialization\Types.cs (5)
854arrayElementType = GetCollectionElementType(type, memberInfo == null ? null : memberInfo.DeclaringType.FullName + "." + memberInfo.Name); 927exception = new NotSupportedException(string.Format(ResXml.XmlUnsupportedInterfaceDetails, memberInfo.DeclaringType.FullName + "." + memberInfo.Name, type.FullName)); 1126throw new InvalidOperationException(string.Format(ResXml.XmlReadOnlyPropertyError, propertyInfo.DeclaringType, propertyInfo.Name)); 1213Type typeToBeReplaced = memberInfoToBeReplaced.DeclaringType; 1365if (defaultProp.DeclaringType != t) continue;
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlReflectionImporter.cs (1)
253XmlAttributes attrs = _attributeOverrides[memberInfo.DeclaringType, memberInfo.Name];
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ClassDataContract.cs (18)
370Type declaringType = memberContract.MemberInfo.DeclaringType; 954ThrowInvalidDataContractException(string.Format(SRSerialization.TooManyDataMembers, DataContract.GetClrTypeFullName(member.DeclaringType), member.Name)); 969ThrowInvalidDataContractException(string.Format(SRSerialization.NoGetMethodForProperty, property.DeclaringType, property.Name)); 974ThrowInvalidDataContractException(string.Format(SRSerialization.NoSetMethodForProperty, property.DeclaringType, property.Name)); 978ThrowInvalidDataContractException(string.Format(SRSerialization.IndexedPropertyCannotBeSerialized, property.DeclaringType, property.Name)); 1000DataContract.GetClrTypeFullName(member.DeclaringType), 1019ThrowInvalidDataContractException(string.Format(SRSerialization.TooManyIgnoreDataMemberAttributes, DataContract.GetClrTypeFullName(member.DeclaringType), member.Name)); 1066DataContract.GetClrTypeFullName(member.DeclaringType), 1230DataContract.ThrowInvalidDataContractException(string.Format(SRSerialization.DuplicateCallback, method, currentCallback, DataContract.GetClrTypeFullName(method.DeclaringType), attributeType), method.DeclaringType); 1232DataContract.ThrowInvalidDataContractException(string.Format(SRSerialization.DuplicateAttribute, prevAttributeType, attributeType, DataContract.GetClrTypeFullName(method.DeclaringType), method), method.DeclaringType); 1234DataContract.ThrowInvalidDataContractException(string.Format(SRSerialization.CallbacksCannotBeVirtualMethods, method, DataContract.GetClrTypeFullName(method.DeclaringType), attributeType), method.DeclaringType); 1238DataContract.ThrowInvalidDataContractException(string.Format(SRSerialization.CallbackMustReturnVoid, DataContract.GetClrTypeFullName(method.DeclaringType), method), method.DeclaringType); 1240DataContract.ThrowInvalidDataContractException(string.Format(SRSerialization.CallbackParameterInvalid, DataContract.GetClrTypeFullName(method.DeclaringType), method, Globals.TypeOfStreamingContext), method.DeclaringType);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\CodeGenerator.cs (14)
594if (methodInfo.IsVirtual && !methodInfo.DeclaringType.GetTypeInfo().IsValueType) 597EmitSourceInstruction("Callvirt " + methodInfo.ToString() + " on type " + methodInfo.DeclaringType.ToString()); 603EmitSourceInstruction("Static Call " + methodInfo.ToString() + " on type " + methodInfo.DeclaringType.ToString()); 609EmitSourceInstruction("Call " + methodInfo.ToString() + " on type " + methodInfo.DeclaringType.ToString()); 617EmitSourceInstruction("Call " + ctor.ToString() + " on type " + ctor.DeclaringType.ToString()); 624EmitSourceInstruction("Newobj " + constructorInfo.ToString() + " on type " + constructorInfo.DeclaringType.ToString()); 696EmitSourceInstruction("Ldsfld " + fieldInfo + " on type " + fieldInfo.DeclaringType); 702EmitSourceInstruction("Ldfld " + fieldInfo + " on type " + fieldInfo.DeclaringType); 714throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(string.Format(SRSerialization.NoGetMethodForProperty, property.DeclaringType, property))); 725throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(string.Format(SRSerialization.CannotLoadMemberType, "Unknown", memberInfo.DeclaringType, memberInfo.Name))); 739EmitSourceInstruction("Stsfld " + fieldInfo + " on type " + fieldInfo.DeclaringType); 745EmitSourceInstruction("Stfld " + fieldInfo + " on type " + fieldInfo.DeclaringType); 756throw /*System.Runtime.Serialization.*/DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(string.Format(SRSerialization.NoSetMethodForProperty, property.DeclaringType, property))); 1448ConvertAddress(GetVariableType(thisObj), methodInfo.DeclaringType);
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContract.cs (1)
2280if (!IsTypeVisibleInSerializationModule(member.DeclaringType))
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\DataContractSet.cs (1)
266DataContract.GetClrTypeFullName(dataMemberType), DataContract.GetClrTypeFullName(dataMember.MemberInfo.DeclaringType), dataMember.MemberInfo.Name)));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\EnumDataContract.cs (2)
289ThrowInvalidDataContractException(string.Format(SRSerialization.TooManyEnumMembers, DataContract.GetClrTypeFullName(field.DeclaringType), field.Name)); 307ThrowInvalidDataContractException(string.Format(SRSerialization.DataMemberOnEnumField, DataContract.GetClrTypeFullName(field.DeclaringType), field.Name));
FrameworkFork\System.Runtime.Serialization\System\Runtime\Serialization\ExceptionDataContract.cs (1)
453Type declaringType = memberContract.MemberInfo.DeclaringType;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ServiceChannelProxy.cs (2)
64Type declaringType = method.DeclaringType; 325if (methodData.MethodBase.DeclaringType == typeof(System.ServiceModel.ICommunicationObject)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\OperationGenerator.cs (1)
996if (member.DeclaringType == typeof(Attribute))
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\ServiceReflector.cs (9)
494attrType.Name, method.Name, method.DeclaringType.Name), e)); 503attrType.Name, param.Name, method.Name, method.DeclaringType.Name), e)); 667methodInfo.Name, methodInfo.DeclaringType.Name))); 676methodInfo.Name, methodInfo.DeclaringType.Name))); 790MethodInfo[] endMethods = beginMethod.DeclaringType.GetTypeInfo().GetDeclaredMethods(endMethodName).ToArray(); 793throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.NoEndMethodFoundForAsyncBeginMethod3, beginMethod.Name, beginMethod.DeclaringType.FullName, endMethodName))); 797throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.MoreThanOneEndMethodFoundForAsyncBeginMethod3, beginMethod.Name, beginMethod.DeclaringType.FullName, endMethodName))); 808throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.InvalidAsyncEndMethodSignatureForMethod2, endMethod.Name, endMethod.DeclaringType.FullName))); 841throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.InvalidAsyncBeginMethodSignatureForMethod2, method.Name, method.DeclaringType.FullName)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\TypeLoader.cs (29)
368type = provider.MethodInfo.DeclaringType; 468opDesc.SyncMethod.DeclaringType, 479opDesc.SyncMethod.DeclaringType, 489opDesc.TaskMethod.DeclaringType, 507if (methodInfo.DeclaringType == type) 976throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.OneWayAndFaultsIncompatible2, methodInfo.DeclaringType.FullName, operationName.EncodedName))); 1190throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(string.Format(SRServiceModel.SFxMultipleUnknownHeaders, methodInfo, methodInfo.DeclaringType))); 1596_syncOperation.SyncMethod.DeclaringType, 1612_syncOperation.SyncMethod.DeclaringType, 1629_syncOperation.SyncMethod.DeclaringType, 1644_syncOperation.SyncMethod.DeclaringType, 1658_syncOperation.SyncMethod.DeclaringType, 1673_syncOperation.SyncMethod.DeclaringType, 1688_syncOperation.SyncMethod.DeclaringType, 1705_syncOperation.SyncMethod.DeclaringType, 1737_syncOperation.SyncMethod.DeclaringType, 1752_syncOperation.SyncMethod.DeclaringType, 1766_syncOperation.SyncMethod.DeclaringType, 1779_syncOperation.SyncMethod.DeclaringType, 1793_syncOperation.SyncMethod.DeclaringType, 1807_syncOperation.SyncMethod.DeclaringType, 1823_syncOperation.SyncMethod.DeclaringType, 1854_taskOperation.TaskMethod.DeclaringType, 1870_taskOperation.TaskMethod.DeclaringType, 1885_taskOperation.TaskMethod.DeclaringType, 1899_taskOperation.TaskMethod.DeclaringType, 1914_taskOperation.TaskMethod.DeclaringType, 1929_taskOperation.TaskMethod.DeclaringType, 1946_taskOperation.TaskMethod.DeclaringType,
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\XmlSerializerOperationBehavior.cs (1)
271_keyBase = methodInfo.DeclaringType.FullName + ":" + methodInfo.ToString();
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\ImmutableClientRuntime.cs (1)
189methodBase.DeclaringType.Name)));
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\SyncMethodInvoker.cs (1)
139ServiceModelActivity.Start(activity, string.Format(SRServiceModel.ActivityExecuteMethod, _method.DeclaringType.FullName, _method.Name), ActivityType.ExecuteUserCode);
FrameworkFork\System.ServiceModel\System\ServiceModel\Dispatcher\TaskMethodInvoker.cs (1)
199string.Format(SRServiceModel.ActivityExecuteMethod, _taskMethod.DeclaringType.FullName, _taskMethod.Name),
GenerateDocumentationAndConfigFiles (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
GetDocument.Insider (3)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.7.25358.102\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
97var programType = assembly?.EntryPoint?.DeclaringType;
Commands\GetDocumentCommandWorker.cs (2)
59var entryPointType = assembly.EntryPoint?.DeclaringType; 461Resources.FormatMethodReturnedNull(method.Name, method.DeclaringType, method.ReturnType));
Infrastructure.Common (3)
xunit\ConditionAttribute.cs (1)
43Type testMethodDeclaringType = testMethodInfo.DeclaringType;
xunit\WcfTestDiscoverer.cs (2)
92failFastAttribute = testMethodInfo.DeclaringType.GetCustomAttribute<FailFastAfterAttribute>(); 98failFastAttribute = testMethodInfo.DeclaringType.Assembly.GetCustomAttribute<FailFastAfterAttribute>();
Metrics (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Metrics.Legacy (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.AspNetCore (2)
WebHost.cs (2)
44var startupAssemblyName = app.GetMethodInfo().DeclaringType!.Assembly.GetName().Name; 66var startupAssemblyName = routeBuilder.GetMethodInfo().DeclaringType!.Assembly.GetName().Name;
Microsoft.AspNetCore.Components.Endpoints (6)
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
Microsoft.AspNetCore.Components.Forms (2)
src\Components\Shared\src\ExpressionFormatting\ExpressionFormatter.cs (2)
167var declaringType = methodInfo.DeclaringType; 278var convertExpression = Expression.Convert(parameterExpression, memberExpression.Member.DeclaringType!);
Microsoft.AspNetCore.Components.Web (2)
src\Components\Shared\src\ExpressionFormatting\ExpressionFormatter.cs (2)
167var declaringType = methodInfo.DeclaringType; 278var convertExpression = Expression.Convert(parameterExpression, memberExpression.Member.DeclaringType!);
Microsoft.AspNetCore.Components.WebAssembly (1)
.packages\microsoft.dotnet.hotreload.agent\10.0.100-preview.7.25358.102\contentFiles\cs\net6.0\MetadataUpdateHandlerInvoker.cs (1)
296=> $"{method.DeclaringType!.FullName}.{method.Name}";
Microsoft.AspNetCore.Connections.Abstractions (1)
src\Shared\ActivatorUtilities\ActivatorUtilities.cs (1)
158throw new InvalidOperationException($"Unable to resolve service for type '{_parameters[index].ParameterType}' while attempting to activate '{_constructor.DeclaringType}'.");
Microsoft.AspNetCore.Diagnostics (5)
src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (5)
84var type = method.DeclaringType; 161var type = method.DeclaringType; 199Debug.Assert(method.DeclaringType != null); 201declaringType = method.DeclaringType; 228declaringType = candidateMethod.DeclaringType;
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Internal\Binding\JsonTranscodingServiceMethodProvider.cs (1)
57serviceDescriptor = ServiceDescriptorHelpers.GetServiceDescriptor(bindMethodInfo.DeclaringType!);
Internal\Binding\ReflectionServiceInvokerResolver.cs (1)
74if (baseDefinitionMethod != null && baseDefinitionMethod.DeclaringType == _declaringType)
Microsoft.AspNetCore.Grpc.Swagger (3)
Internal\GrpcJsonTranscodingDescriptionProvider.cs (1)
129? ModelMetadataIdentity.ForProperty(bodyDescriptor.PropertyInfo, bodyDescriptor.PropertyInfo.PropertyType, bodyDescriptor.PropertyInfo.DeclaringType!)
Internal\XmlComments\GrpcXmlCommentsOperationFilter.cs (2)
37var targetMethod = methodInfo.DeclaringType!.IsConstructedGenericType 47ApplyServiceTags(operation, targetMethod.DeclaringType!);
Microsoft.AspNetCore.Hosting (13)
GenericHost\GenericWebHostBuilder.cs (3)
191var startupAssemblyName = startupFactory.GetMethodInfo().DeclaringType!.Assembly.GetName().Name; 314var startupAssemblyName = configure.GetMethodInfo().DeclaringType!.Assembly.GetName().Name!; 337var startupAssemblyName = configure.GetMethodInfo().DeclaringType!.Assembly.GetName().Name!;
GenericHost\SlimWebHostBuilder.cs (1)
79var startupAssemblyName = configure.GetMethodInfo().DeclaringType!.Assembly.GetName().Name!;
Internal\ConfigureBuilder.cs (1)
52MethodInfo.DeclaringType?.FullName), ex);
src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (5)
84var type = method.DeclaringType; 161var type = method.DeclaringType; 199Debug.Assert(method.DeclaringType != null); 201declaringType = method.DeclaringType; 228declaringType = candidateMethod.DeclaringType;
WebHostBuilderExtensions.cs (3)
41var startupAssemblyName = configureApp.GetMethodInfo().DeclaringType!.Assembly.GetName().Name!; 70var startupAssemblyName = configureApp.GetMethodInfo().DeclaringType!.Assembly.GetName().Name!; 100var startupAssemblyName = startupFactory.GetMethodInfo().DeclaringType!.Assembly.GetName().Name;
Microsoft.AspNetCore.Hosting.Tests (1)
ConfigureBuilderTests.cs (1)
30+ $" 'service' of method '{methodInfo.Name}' on type '{methodInfo.DeclaringType.FullName}'.", ex.Message);
Microsoft.AspNetCore.Http.Abstractions (11)
Extensions\UseMiddlewareExtensions.cs (5)
230var declaringType = methodInfo.DeclaringType!; 312methodArguments[i] = GetMethodArgument(parameter, providerArg, parameterType, methodInfo.DeclaringType); 316if (methodInfo.DeclaringType != null && methodInfo.DeclaringType != typeof(T)) 318middlewareInstanceArg = Expression.Convert(middlewareInstanceArg, methodInfo.DeclaringType);
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
Microsoft.AspNetCore.Http.Extensions (3)
RequestDelegateFactory.cs (3)
232if (methodInfo.DeclaringType is null) 251targetFactory ??= context => Activator.CreateInstance(methodInfo.DeclaringType)!; 253var targetExpression = Expression.Convert(TargetExpr, methodInfo.DeclaringType);
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateFactoryTests.cs (1)
2207return Activator.CreateInstance(methodInfo!.DeclaringType!)!;
Microsoft.AspNetCore.Identity.EntityFrameworkCore.Test (3)
src\Identity\test\Shared\ApiConsistencyTestBase.cs (3)
21where GetBasestTypeInAssembly(method.DeclaringType) == type 41where GetBasestTypeInAssembly(method.DeclaringType) == type 48.Select(method => method.DeclaringType.Name + "." + method.Name)
Microsoft.AspNetCore.Identity.InMemory.Test (3)
src\Identity\test\Shared\ApiConsistencyTestBase.cs (3)
21where GetBasestTypeInAssembly(method.DeclaringType) == type 41where GetBasestTypeInAssembly(method.DeclaringType) == type 48.Select(method => method.DeclaringType.Name + "." + method.Name)
Microsoft.AspNetCore.Identity.Test (3)
src\Identity\test\Shared\ApiConsistencyTestBase.cs (3)
21where GetBasestTypeInAssembly(method.DeclaringType) == type 41where GetBasestTypeInAssembly(method.DeclaringType) == type 48.Select(method => method.DeclaringType.Name + "." + method.Name)
Microsoft.AspNetCore.InternalTesting (6)
LoggedTest\LoggedTestBase.cs (2)
66?? methodInfo.DeclaringType.GetCustomAttribute<LogLevelAttribute>() 67?? methodInfo.DeclaringType.Assembly.GetCustomAttribute<LogLevelAttribute>();
xunit\AspNetTestRunner.cs (4)
143attributeCandidate = methodInfo.DeclaringType.GetCustomAttribute<RepeatAttribute>(); 149return methodInfo.DeclaringType.Assembly.GetCustomAttribute<RepeatAttribute>(); 160attributeCandidate = methodInfo.DeclaringType.GetCustomAttribute<RetryAttribute>(); 166return methodInfo.DeclaringType.Assembly.GetCustomAttribute<RetryAttribute>();
Microsoft.AspNetCore.Mvc.ApiExplorer (6)
EndpointMetadataApiDescriptionProvider.cs (5)
89if (methodInfo.DeclaringType is not null && !TypeHelper.IsCompilerGeneratedType(methodInfo.DeclaringType)) 91controllerName = methodInfo.DeclaringType.Name; 461if (parameterInfo.Member is PropertyInfo propertyInfo && propertyInfo.DeclaringType is not null) 463return new(ModelMetadataIdentity.ForProperty(propertyInfo, type, propertyInfo.DeclaringType));
src\Shared\RoslynUtils\TypeHelper.cs (1)
38return Attribute.IsDefined(method, typeof(CompilerGeneratedAttribute)) || IsCompilerGeneratedType(method.DeclaringType);
Microsoft.AspNetCore.Mvc.Core (12)
ApiConventionTypeAttribute.cs (1)
72var methodDisplayName = TypeNameHelper.GetTypeDisplayName(method.DeclaringType!) + "." + method.Name;
ApplicationModels\DefaultApplicationModelProvider.cs (3)
219var declaringType = propertyInfo.DeclaringType!; 428if (methodInfo.GetBaseDefinition().DeclaringType == typeof(object)) 689var declaringType = baseMethodInfo.DeclaringType;
Filters\MiddlewareFilterConfigurationProvider.cs (1)
115MethodInfo.DeclaringType!.FullName),
ModelBinding\Metadata\DefaultModelMetadataProvider.cs (1)
179ModelMetadataIdentity.ForProperty(property, modelType, property.DeclaringType!),
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
Microsoft.AspNetCore.Mvc.Core.Test (3)
ApplicationModels\DefaultApplicationModelProviderTest.cs (1)
1317Assert.Equal(typeInfo, action.ActionMethod.DeclaringType.GetTypeInfo());
ModelBinding\ParameterBinderTest.cs (2)
441var modelMetadata = modelMetadataProvider.GetMetadataForProperty(property.DeclaringType, property.Name); 495var modelMetadata = modelMetadataProvider.GetMetadataForProperty(property.DeclaringType, property.Name);
Microsoft.AspNetCore.Mvc.RazorPages (9)
ApplicationModels\DefaultPageApplicationModelPartsProvider.cs (4)
112var propertyMetadata = _modelMetadataProvider.GetMetadataForProperty(property.DeclaringType!, property.Name); 119var declaringType = property.DeclaringType!; 158if (methodInfo.GetBaseDefinition().DeclaringType == typeof(object)) 194var declaringType = methodInfo.DeclaringType;
Infrastructure\ExecutorFactory.cs (4)
89Expression.Convert(receiver, method.DeclaringType!), 122Expression.Convert(receiver, method.DeclaringType!), 155Expression.Convert(receiver, method.DeclaringType!), 182Expression.Convert(receiver, method.DeclaringType!),
PageLoggerExtensions.cs (1)
89var declaringTypeName = TypeNameHelper.GetTypeDisplayName(handler.MethodInfo.DeclaringType);
Microsoft.AspNetCore.Mvc.RazorPages.Test (7)
ApplicationModels\DefaultPageApplicationModelProviderTest.cs (7)
146.Where(p => p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo); 630.Where(p => p.PropertyInfo.DeclaringType.GetTypeInfo() == typeInfo); 682handlerMethods.OrderBy(h => h.MethodInfo.DeclaringType.Name).ThenBy(h => h.MethodInfo.Name), 686Assert.Equal(typeInfo, handler.MethodInfo.DeclaringType.GetTypeInfo()); 691Assert.Equal(baseType, handler.MethodInfo.DeclaringType); 696Assert.Equal(baseType, handler.MethodInfo.DeclaringType); 953Assert.Equal(typeof(HidesAProperty).GetTypeInfo(), p.PropertyInfo.DeclaringType.GetTypeInfo());
Microsoft.AspNetCore.Mvc.Testing (2)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.7.25358.102\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
97var programType = assembly?.EntryPoint?.DeclaringType;
WebApplicationFactory.cs (1)
296typeof(TEntryPoint).Assembly.EntryPoint!.DeclaringType!.FullName,
Microsoft.AspNetCore.Mvc.ViewFeatures (4)
CachedExpressionCompiler.cs (1)
177Expression.Convert(parameterExpression, memberExpression.Member.DeclaringType);
ExpressionHelper.cs (1)
244var declaringType = methodExpression.Method.DeclaringType;
Filters\SaveTempDataPropertyFilterBase.cs (2)
128Resources.FormatTempDataProperties_PublicGetterSetter(property.DeclaringType.FullName, property.Name, nameof(TempDataAttribute))); 137TypeNameHelper.GetTypeDisplayName(property.DeclaringType),
Microsoft.AspNetCore.OpenApi (4)
Services\OpenApiGenerator.cs (3)
348if (methodInfo.DeclaringType is not null && !TypeHelper.IsCompilerGeneratedType(methodInfo.DeclaringType)) 350controllerName = methodInfo.DeclaringType.Name;
src\Shared\RoslynUtils\TypeHelper.cs (1)
38return Attribute.IsDefined(method, typeof(CompilerGeneratedAttribute)) || IsCompilerGeneratedType(method.DeclaringType);
Microsoft.AspNetCore.OpenApi.SourceGenerators.Tests (1)
SnapshotTestHelper.cs (1)
287var programType = assembly.EntryPoint.DeclaringType;
Microsoft.AspNetCore.Routing (7)
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
src\Shared\RoslynUtils\TypeHelper.cs (1)
38return Attribute.IsDefined(method, typeof(CompilerGeneratedAttribute)) || IsCompilerGeneratedType(method.DeclaringType);
Microsoft.AspNetCore.Routing.Abstractions (6)
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
Microsoft.AspNetCore.Routing.Tests (3)
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (3)
876Assert.NotNull(routeHandlerContext.MethodInfo.DeclaringType); 878Assert.Equal("RouteHandlerEndpointRouteBuilderExtensionsTest", routeHandlerContext.MethodInfo.DeclaringType?.Name); 1085context.HttpContext.Items["parentName"] = _routeHandlerContext.MethodInfo.DeclaringType?.Name;
Microsoft.AspNetCore.Server.IIS (5)
src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (5)
84var type = method.DeclaringType; 161var type = method.DeclaringType; 199Debug.Assert(method.DeclaringType != null); 201declaringType = method.DeclaringType; 228declaringType = candidateMethod.DeclaringType;
Microsoft.AspNetCore.Shared.Tests (12)
src\Shared\ActivatorUtilities\ActivatorUtilities.cs (1)
158throw new InvalidOperationException($"Unable to resolve service for type '{_parameters[index].ParameterType}' while attempting to activate '{_constructor.DeclaringType}'.");
src\Shared\PropertyHelper\PropertyHelper.cs (6)
218if (getMethod.DeclaringType!.IsValueType) 248var typeInput = propertyGetMethod.DeclaringType!; 275Debug.Assert(!propertyInfo.DeclaringType!.IsValueType); 290var typeInput = setMethod.DeclaringType!; 426if (propertyHelper.Property.DeclaringType != type) 444var declaringType = propertyHelper.Property.DeclaringType;
src\Shared\StackTrace\StackFrame\StackTraceHelper.cs (5)
84var type = method.DeclaringType; 161var type = method.DeclaringType; 199Debug.Assert(method.DeclaringType != null); 201declaringType = method.DeclaringType; 228declaringType = candidateMethod.DeclaringType;
Microsoft.AspNetCore.SignalR.Core (3)
Internal\HubMethodDescriptor.cs (2)
120$"{methodExecutor.MethodInfo.DeclaringType?.Name}.{methodExecutor.MethodInfo.Name}: The {nameof(FromKeyedServicesAttribute)} is not supported on parameters that are also annotated with {nameof(IFromServiceMetadata)}."); 302throw new InvalidOperationException($"Method '{methodInfo.DeclaringType}.{methodInfo.Name}' is not supported with native AOT because it has a parameter of type '{parameterType}'. A ValueType streaming parameter is not supported because the native code to support the ValueType will not be available with native AOT.");
Internal\HubReflectionHelper.cs (1)
22var baseDefinition = methodInfo.GetBaseDefinition().DeclaringType!;
Microsoft.AspNetCore.TestHost (1)
.packages\microsoft.extensions.hostfactoryresolver.sources\10.0.0-preview.7.25358.102\contentFiles\cs\netstandard2.0\HostFactoryResolver.cs (1)
97var programType = assembly?.EntryPoint?.DeclaringType;
Microsoft.CodeAnalysis.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.AnalyzerUtilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.BannedApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.CodeStyle (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.CSharp (1)
Lowering\ExtensionMethodReferenceRewriter.cs (1)
185{ Name: nameof(VisitMethodSymbolWithExtensionRewrite), DeclaringType: { } declaringType } => declaringType == typeof(ExtensionMethodReferenceRewriter),
Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities (1)
Threading\WpfTestSharedData.cs (1)
42_recentTestCases.Add($"{testMethod.DeclaringType.Name}::{testMethod.Name}");
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
Options\GlobalOptionsTests.cs (8)
164=> !(property.DeclaringType == typeof(AddImportPlacementOptions) && property.Name == nameof(AddImportPlacementOptions.AllowInHiddenRegions) || 165property.DeclaringType == typeof(AddImportPlacementOptions) && property.Name == nameof(AddImportPlacementOptions.UsingDirectivePlacement) && language == LanguageNames.VisualBasic || 166property.DeclaringType == typeof(DocumentFormattingOptions) && property.Name == nameof(DocumentFormattingOptions.FileHeaderTemplate) || 167property.DeclaringType == typeof(DocumentFormattingOptions) && property.Name == nameof(DocumentFormattingOptions.InsertFinalNewLine) || 168property.DeclaringType == typeof(ClassificationOptions) && property.Name == nameof(ClassificationOptions.FrozenPartialSemantics) || 169property.DeclaringType == typeof(HighlightingOptions) && property.Name == nameof(HighlightingOptions.FrozenPartialSemantics) || 170property.DeclaringType == typeof(BlockStructureOptions) && property.Name == nameof(BlockStructureOptions.IsMetadataAsSource) || 171property.DeclaringType == typeof(WorkspaceConfigurationOptions) && property.Name == nameof(WorkspaceConfigurationOptions.SourceGeneratorExecution));
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider.Utilities (5)
Debugger\MemberInfo\ConstructorInfoImpl.cs (1)
46return (TypeImpl)Constructor.DeclaringType;
Debugger\MemberInfo\FieldInfoImpl.cs (1)
34get { return (TypeImpl)this.Field.DeclaringType; }
Debugger\MemberInfo\MethodInfoImpl.cs (1)
38get { return (TypeImpl)this.Method.DeclaringType; }
Debugger\MemberInfo\PropertyInfoImpl.cs (1)
47get { return (TypeImpl)this.Property.DeclaringType; }
Debugger\MemberInfo\TypeImpl.cs (1)
459if (map.TargetMethods.Any(m => m.DeclaringType == t))
Microsoft.CodeAnalysis.LanguageServer (1)
Logging\RoslynLogger.cs (1)
201var declaringTypeName = method?.DeclaringType?.FullName;
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Protocol\Converters\SumConverter.cs (1)
166var expression = (LambdaExpression)expressionLambdaMethod.Invoke(null, [typeof(StjReader<>).MakeGenericType(constructor.DeclaringType), body, new[] { param1, param2 }])!;
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.PublicApiAnalyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.Remote.ServiceHub (4)
src\VisualStudio\Core\Def\Watson\FaultReporter.cs (4)
209if (method != null && method.DeclaringType != null) 212var methodName = method.DeclaringType.FullName + "." + method.Name; 215faultUtility.SetBucketParameter(P4ModuleNameDefaultIndex, method.DeclaringType.Assembly.GetName().Name); 247var declaringTypeName = method?.DeclaringType?.FullName;
Microsoft.CodeAnalysis.ResxSourceGenerator (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Microsoft.CodeAnalysis.Scripting (6)
Hosting\CommonMemberFilter.cs (3)
23if (method.DeclaringType?.FullName.StartsWith("Submission#0").ToThreeState() == ThreeState.True) 33var type = method.DeclaringType; 73info = info.DeclaringType?.GetTypeInfo();
Hosting\ObjectFormatter\CommonObjectFormatter.cs (1)
116var declaringType = method.DeclaringType;
ScriptExecutionState.cs (2)
136Activator.CreateInstance(precedingExecutors[executorIndex++].GetMethodInfo().DeclaringType, submissionCtorArgs); 147Activator.CreateInstance(currentExecutor.GetMethodInfo().DeclaringType, submissionCtorArgs);
Microsoft.CodeAnalysis.Test.Utilities (1)
Platform\Custom\MetadataSignatureHelper.cs (1)
92AppendType(attribute.Constructor.DeclaringType, sb);
Microsoft.CodeAnalysis.UnitTests (3)
AnalyzerAssemblyLoaderTests.cs (3)
130method.DeclaringType!.FullName!, 144testAction.Method.DeclaringType!.FullName!, 159testAction.Method.DeclaringType!.FullName!,
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (3)
ExpressionTrees\Sources\ExprLambdaUtils.vb (3)
185_s.AppendLine(indent + "method: " + node.Method.ToString() + " in " + node.Method.DeclaringType.ToString()) 328_s.AppendLine(indent + "method: " + node.Method.ToString() + " in " + node.Method.DeclaringType.ToString()) 345_s.AppendLine(indent + "method: " + node.Method.ToString() + " in " + node.Method.DeclaringType.ToString() + " (")
Microsoft.CodeAnalysis.Workspaces (5)
CodeActions\CodeAction.cs (2)
123static codeAction => new Func<CancellationToken, Task<IEnumerable<CodeActionOperation>>>(codeAction.ComputeOperationsAsync).Method.DeclaringType != typeof(CodeAction)); 131static codeAction => new Func<CancellationToken, Task<Solution?>>(codeAction.GetChangedSolutionAsync).Method.DeclaringType != typeof(CodeAction));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Workspace\Solution\FileTextLoader.cs (1)
68GetType(), _ => new StrongBox<bool>(new Func<Stream, Workspace, SourceText>(CreateText).Method.DeclaringType != typeof(FileTextLoader))).Value;
Workspace\Solution\TextLoader.cs (1)
65_ => new StrongBox<bool>(new Func<Workspace, DocumentId, CancellationToken, Task<TextAndVersion>>(LoadTextAndVersionAsync).Method.DeclaringType != typeof(TextLoader))).Value)
Microsoft.CSharp (20)
Microsoft\CSharp\RuntimeBinder\ExpressionTreeCallRewriter.cs (1)
437t = f.DeclaringType;
Microsoft\CSharp\RuntimeBinder\RuntimeBinderExtensions.cs (10)
56&& method1.DeclaringType.IsGenericallyEqual(method2.DeclaringType) 66&& ctor1.DeclaringType.IsGenericallyEqual(ctor2.DeclaringType) 73&& prop1.DeclaringType.IsGenericallyEqual(prop2.DeclaringType) 157if (t1.DeclaringMethod == null && member1.DeclaringType.Equals(t1.DeclaringType)) 159if (!(t2.DeclaringMethod == null && member2.DeclaringType.Equals(t2.DeclaringType))) 164else if (t2.DeclaringMethod == null && member2.DeclaringType.Equals(t2.DeclaringType)) 244return member.DeclaringType.GetGenericArguments()[typeParam.GenericParameterPosition].Equals(typeInst);
Microsoft\CSharp\RuntimeBinder\Semantics\Tree\MethodInfo.cs (2)
45type = methodInfo.DeclaringType; 116type = ctorInfo.DeclaringType;
Microsoft\CSharp\RuntimeBinder\Semantics\Tree\PropertyInfo.cs (1)
44type = propertyInfo.DeclaringType;
Microsoft\CSharp\RuntimeBinder\SymbolTable.cs (6)
175.Where(member => member.DeclaringType == type && member.Name == name).GetEnumerator(); 1179&& property.DeclaringType?.GetCustomAttribute<DefaultMemberAttribute>() 1347if (m.Name == methodName.Text && m.DeclaringType == t) 1727AggregateSymbol aggregate = ((AggregateType)GetCTypeFromType(baseMethodInfo.DeclaringType)).OwningAggregate; 1742CType t = GetCTypeFromType(baseMemberInfo.DeclaringType); 1828if (conversion.DeclaringType == type && conversion.IsSpecialName && !conversion.IsGenericMethod)
Microsoft.DotNet.Build.Tasks.Workloads (1)
EmbeddedTemplates.cs (1)
66string ns = MethodBase.GetCurrentMethod().DeclaringType.Namespace;
Microsoft.DotNet.Internal.DependencyInjection.Testing (1)
DependencyInjectionValidation.cs (1)
139msgBuilder.Append(ctor.DeclaringType.FullName);
Microsoft.DotNet.RemoteExecutor (1)
RemoteExecutor.cs (1)
437Type t = method.DeclaringType;
Microsoft.DotNet.XUnitExtensions (1)
src\Microsoft.DotNet.XUnitExtensions.Shared\Discoverers\ConditionalTestDiscoverer.cs (1)
40Type testMethodDeclaringType = testMethodInfo.DeclaringType;
Microsoft.DotNet.XUnitV3Extensions (1)
src\Microsoft.DotNet.XUnitExtensions.Shared\Discoverers\ConditionalTestDiscoverer.cs (1)
40Type testMethodDeclaringType = testMethodInfo.DeclaringType;
Microsoft.Extensions.AI.Abstractions (3)
Functions\AIFunctionFactory.cs (1)
1024Debug.Assert(specializedType.IsGenericType && specializedType.GetGenericTypeDefinition() == genericMethodDefinition.DeclaringType, "generic member definition doesn't match type.");
src\Shared\JsonSchemaExporter\NullabilityInfoContext\NullabilityInfoContext.cs (2)
60memberInfo = memberInfo.DeclaringType; 429Type? type = member.DeclaringType;
Microsoft.Extensions.AI.Abstractions.Tests (2)
Functions\DelegatingAIFunctionTests.cs (2)
50Assert.True(methodInfo.DeclaringType == typeof(DelegatingAIFunction), $"{methodInfo.Name} not overridden"); 54Assert.True(propertyInfo.DeclaringType == typeof(DelegatingAIFunction), $"{propertyInfo.Name} not overridden");
Microsoft.Extensions.DependencyInjection (3)
ServiceLookup\ConstructorCallSite.cs (3)
20if (!serviceType.IsAssignableFrom(constructorInfo.DeclaringType)) 22throw new ArgumentException(SR.Format(SR.ImplementationTypeCantBeConvertedToServiceType, constructorInfo.DeclaringType, serviceType)); 32public override Type? ImplementationType => ConstructorInfo.DeclaringType;
Microsoft.Extensions.DependencyInjection.Abstractions (3)
ActivatorUtilities.cs (3)
416Expression.Constant(constructor.DeclaringType, typeof(Type)), 443Type declaringType = constructor.DeclaringType!; 864throw new InvalidOperationException(SR.Format(SR.UnableToResolveService, _constructor.Parameters[index].ParameterType, _constructor.Info.DeclaringType));
Microsoft.Extensions.Validation.GeneratorTests (1)
ValidationsGeneratorTestBase.cs (1)
292var programType = assembly.EntryPoint.DeclaringType;
Microsoft.Maui.Controls (1)
BindingExpression.cs (1)
141 if (part.LastGetter == null || !part.LastGetter.DeclaringType.GetTypeInfo().IsAssignableFrom(currentType))
Microsoft.Maui.Controls.Xaml (4)
ApplyPropertiesVisitor.cs (3)
723 if (method.IsPrivate && method.DeclaringType == rootElement.GetType()) 725 if ((method.IsAssembly || method.IsFamilyOrAssembly) && method.DeclaringType.AssemblyQualifiedName == rootElement.GetType().AssemblyQualifiedName) 727 if (method.IsFamily && method.DeclaringType.IsAssignableFrom(rootElement.GetType()))
CreateValuesVisitor.cs (1)
319 throw new XamlParseException($"The Property {propname} is required to create a {ctorInfo.DeclaringType.FullName} object.", enode as IXmlLineInfo);
Microsoft.ML.Core (15)
ComponentModel\ComponentCatalog.cs (3)
346Name = attribute.Name ?? string.Join(".", method.DeclaringType.Name, method.Name); 648if (prop.DeclaringType != loaderType) 665if (meth.DeclaringType != loaderType)
Utilities\FuncInstanceMethodInfo1`2.cs (2)
40Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 64Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`3.cs (2)
41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo1`4.cs (2)
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo2`4.cs (2)
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`3.cs (2)
41Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 65Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Utilities\FuncInstanceMethodInfo3`4.cs (2)
42Contracts.CheckParam(GenericMethodDefinition.DeclaringType == typeof(TTarget), nameof(methodInfo), _targetTypeCheckMessage); 66Contracts.CheckParam(methodCallExpression.Method.DeclaringType == typeof(MethodInfo), nameof(expression), "Unexpected expression form");
Microsoft.ML.Tests (1)
ExpressionLanguageTests\ExpressionLanguageTests.cs (1)
205wrt.WriteLine("Unknown Exception: {0}!", del != null ? del.GetMethodInfo().DeclaringType : (object)"<null>");
Microsoft.ML.Transforms (2)
CustomMappingTransformer.cs (1)
62_contractAssembly = _mapAction.Method.DeclaringType.Assembly.FullName;
StatefulCustomMappingTransformer.cs (1)
60_contractAssembly = _mapAction.Method.DeclaringType.Assembly.FullName;
Microsoft.VisualBasic.Core (48)
Microsoft\VisualBasic\CompilerServices\ConversionResolution.vb (1)
792IsGeneric(current.DeclaringType)) AndAlso
Microsoft\VisualBasic\CompilerServices\LateBinding.vb (5)
42If mi(i).DeclaringType.IsSubclassOf(Selected.DeclaringType) Then 1142ThisMember.DeclaringType.IsSubclassOf(mi(j).DeclaringType) Then 1165If (Value Is Nothing) OrElse Member.DeclaringType.IsAssignableFrom(Value.GetType) Then
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (5)
655IsOrInheritsFrom(existing.DeclaringType, newCandidate.DeclaringType), 658If newCandidate.DeclaringType Is existing.DeclaringType Then 669Symbols.IsCollectionInterface(newCandidate.DeclaringType) AndAlso 745Dim currentScope As Type = members(index).DeclaringType 894Loop While index < members.Length AndAlso members(index).DeclaringType Is currentScope
Microsoft\VisualBasic\CompilerServices\Symbols.vb (6)
731Dim declaringType As System.Type = member.DeclaringType 757Dim leftType As Type = left.DeclaringType 758Dim rightType As Type = right.DeclaringType 1378Dim declaringType As System.Type = item.DeclaringType 1403Return _item.DeclaringType 1410Dim declaringType As System.Type = _item.DeclaringType
Microsoft\VisualBasic\CompilerServices\Utils.LateBinder.vb (2)
558If Not method.DeclaringType.IsInterface Then 664If Not prop.DeclaringType.IsInterface Then
Microsoft\VisualBasic\CompilerServices\Utils.vb (8)
182method1.DeclaringType.IsGenericallyEqual(method2.DeclaringType) AndAlso 203ctor1.DeclaringType.IsGenericallyEqual(ctor2.DeclaringType) Then 274If t1.DeclaringMethod Is Nothing AndAlso member1.DeclaringType.Equals(t1.DeclaringType) Then 275If Not (t2.DeclaringMethod Is Nothing AndAlso member2.DeclaringType.Equals(t2.DeclaringType)) Then 278ElseIf t2.DeclaringMethod Is Nothing AndAlso member2.DeclaringType.Equals(t2.DeclaringType) Then 340Return member.DeclaringType.GetGenericArguments()(typeParam.GenericParameterPosition).Equals(typeInst)
Microsoft\VisualBasic\CompilerServices\VBBinder.vb (21)
225ThisMethod.DeclaringType.IsSubclassOf(match(j).DeclaringType) Then 243ThisMethod.DeclaringType.IsSubclassOf(match(j).DeclaringType) Then 1048(ThisMethod.DeclaringType.IsSubclassOf(match(j).DeclaringType) AndAlso 1581If match(i).DeclaringType.IsSubclassOf(BindToField.DeclaringType) Then 1707If ThisProperty.DeclaringType.IsSubclassOf(match(0).DeclaringType) Then 1714ElseIf match(0).DeclaringType.IsSubclassOf(ThisProperty.DeclaringType) Then 2089DeclaringType = ThisMember.DeclaringType 2096DeclaringType.IsSubclassOf(mi(j).DeclaringType) Then 2126DeclaringType = ThisMember.DeclaringType 2131DeclaringType.IsSubclassOf(mi(j).DeclaringType) Then 2171DeclaringType = ThisMember.DeclaringType 2176DeclaringType.IsSubclassOf(mi(j).DeclaringType) Then 2208DeclaringType = ThisMember.DeclaringType 2213DeclaringType.IsSubclassOf(mi(j).DeclaringType) Then 2266declaringType = member.DeclaringType
Microsoft.VisualStudio.LanguageServices (5)
ErrorReporting\VisualStudioErrorReportingService.ExceptionFormatting.cs (1)
85let declaringType = method?.DeclaringType
Watson\FaultReporter.cs (4)
209if (method != null && method.DeclaringType != null) 212var methodName = method.DeclaringType.FullName + "." + method.Name; 215faultUtility.SetBucketParameter(P4ModuleNameDefaultIndex, method.DeclaringType.Assembly.GetName().Name); 247var declaringTypeName = method?.DeclaringType?.FullName;
PresentationBuildTasks (27)
MS\Internal\MarkupCompiler\MarkupCompiler.cs (9)
1834CodeFieldReferenceExpression cfre = new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(desc.MemberInfo.DeclaringType.FullName), desc.MemberInfo.Name); 1852CodeMethodInvokeExpression cmie = new CodeMethodInvokeExpression(new CodeTypeReferenceExpression(desc.MemberInfo.DeclaringType.FullName), desc.MemberInfo.Name); 1869CodeObjectCreateExpression coce = new CodeObjectCreateExpression(desc.MemberInfo.DeclaringType.FullName); 1910FieldInfo fiEvent = miEvent.DeclaringType.GetField(eventName + EVENT, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); 1913ThrowCompilerException(nameof(SR.RoutedEventNotRegistered), miEvent.DeclaringType.FullName, eventName, eventHandler); 1916CodeTypeReferenceExpression ctreEvent = new CodeTypeReferenceExpression(miEvent.DeclaringType.FullName); 1924Type eventTarget = cc != null ? cc.ElementType : miEvent.DeclaringType; 1977if (mei.mi.DeclaringType.IsAssignableFrom(eventTarget)) 3172(memberInfo.DeclaringType.IsAssignableFrom(_ccRoot.ElementType) && (memberInfo is PropertyInfo)));
MS\Internal\MarkupCompiler\ParserExtension.cs (2)
162KnownTypes.Types[(int)KnownElements.Application].IsAssignableFrom(memberInfo.DeclaringType)) 569bool appEvent = KnownTypes.Types[(int)KnownElements.Application].IsAssignableFrom(xamlClrEventNode.EventMember.DeclaringType);
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\MarkupExtensionParser.cs (1)
1677declaringType = mi.DeclaringType;
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\StyleXamlParser.cs (2)
360dpInfo.DeclaringType, 553_setterOrTriggerValueNode.ValueDeclaringType = _setterOrTriggerPropertyInfo.DeclaringType;
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\TemplateXamlParser.cs (2)
409dpInfo.DeclaringType, 576_setterOrTriggerValueNode.ValueDeclaringType = _setterOrTriggerPropertyMemberInfo.DeclaringType;
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlReaderHelper.cs (5)
1094XamlPropertyFullName declaringProp = new XamlPropertyFullName(mi.DeclaringType, propertyName); 1805declaringType = eventMember.DeclaringType; 1859declaringType = mi.DeclaringType; 3206methodInfo = methodInfo.DeclaringType.GetMethod( 3519null != methodInfo.DeclaringType.GetMethod($"Set{methodInfo.Name.Substring("Get".Length)}",
src\Microsoft.DotNet.Wpf\src\PresentationFramework\System\Windows\Markup\XamlTypeMapper.cs (5)
1016if (fi.ReflectedType.Assembly == fi.DeclaringType.Assembly) 1073if (mi.ReflectedType.Assembly == mi.DeclaringType.Assembly) 2118validType = memInfo.DeclaringType; 2311if (memberInfo.DeclaringType != targetType) 2313targetType = memberInfo.DeclaringType;
src\Microsoft.DotNet.Wpf\src\Shared\System\Windows\Markup\TypeConverterHelper.cs (1)
88memberInfo = methodInfo.DeclaringType.GetMethod(
PresentationFramework (18)
MS\Internal\Data\PropertyPathWorker.cs (3)
691Type declaringType = (oldPI != null) ? oldPI.DeclaringType 862Type declaringType = (newPI != null) ? newPI.DeclaringType 1438Type type = pi.DeclaringType;
System\Windows\Markup\Baml2006\WpfKnownMemberInvoker.cs (1)
49Type declaringType = _member.UnderlyingMember.DeclaringType;
System\Windows\Markup\Baml2006\WpfMemberInvoker.cs (1)
69Type declaringType = _member.UnderlyingMember.DeclaringType;
System\Windows\Markup\Baml2006\WpfXamlType.cs (1)
105return method.DeclaringType != typeof(ResourceDictionary);
System\Windows\Markup\BamlRecordReader.cs (2)
1546ThrowExceptionWithLine(SR.Format(SR.ParserFailedToCreateFromConstructor, info.DeclaringType.Name), e); 5142return $"{pi.DeclaringType.Name}.{pi.Name}";
System\Windows\Markup\BamlWriter.cs (2)
1137if(mostDerived == null || mostDerived.DeclaringType.IsAssignableFrom(pi.DeclaringType))
System\Windows\Markup\MarkupExtensionParser.cs (1)
1677declaringType = mi.DeclaringType;
System\Windows\Markup\XamlTypeMapper.cs (6)
1124isPublic = mi != null && mi.IsPublic && ReflectionHelper.IsPublicType(mi.DeclaringType); 1137isPublic = mi != null && mi.IsPublic && ReflectionHelper.IsPublicType(mi.DeclaringType); 1150isPublic = mi != null && mi.IsPublic && ReflectionHelper.IsPublicType(mi.DeclaringType); 2118validType = memInfo.DeclaringType; 2311if (memberInfo.DeclaringType != targetType) 2313targetType = memberInfo.DeclaringType;
System\Windows\PropertyPathConverter.cs (1)
209type = pi.DeclaringType;
ReachFramework (1)
Serialization\Manager\ReachSerializationCacheItems.cs (1)
240DependencyProperty.FromName(propertyInfo.Name, propertyInfo.DeclaringType);
Roslyn.Diagnostics.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Shared (3)
JsonSchemaExporter\JsonSchemaExporter.ReflectionHelpers.cs (3)
269if (parameter.Member is { DeclaringType.IsConstructedGenericType: true } 286if (member.DeclaringType?.IsConstructedGenericType is true) 288return member.DeclaringType.GetGenericTypeDefinition().GetMemberWithSameMetadataDefinitionAs(member);
System.ComponentModel.Composition (11)
Microsoft\Internal\ReflectionServices.cs (8)
23Debug.Assert(member.DeclaringType != null); 24return member.DeclaringType.Assembly; 29return constructor.DeclaringType!.IsVisible && constructor.IsPublic; 34Debug.Assert(field.DeclaringType != null); 35return field.DeclaringType.IsVisible && field.IsPublic; 40Debug.Assert(method.DeclaringType != null); 41if (!method.DeclaringType.IsVisible) 79return GetDisplayName(member.DeclaringType!, member.Name);
System\ComponentModel\Composition\Hosting\CompositionServices.cs (2)
295if (pi.DeclaringType == CompositionServices.ExportAttributeType || pi.DeclaringType == CompositionServices.AttributeType)
System\ComponentModel\Composition\ReflectionModel\ReflectionMember.cs (1)
18get { return UnderlyingMember.DeclaringType!; }
System.ComponentModel.Composition.Registration (5)
System\ComponentModel\Composition\Registration\PartBuilder.cs (1)
424PropertyInfo declaredPi = pi.DeclaringType.UnderlyingSystemType.GetProperty(pi.Name, pi.PropertyType);
System\ComponentModel\Composition\Registration\RegistrationBuilder.cs (4)
228if (!_memberInfos.TryGetValue(member.DeclaringType.UnderlyingSystemType, out cachedAttributes)) 241GetCustomAttributes(member.DeclaringType, s_emptyList); 264if (!_memberInfos.TryGetValue(parameter.Member.DeclaringType, out cachedAttributes)) 276GetCustomAttributes(parameter.Member.DeclaringType, s_emptyList);
System.ComponentModel.TypeConverter (3)
System\ComponentModel\ReflectTypeDescriptionProvider.cs (3)
1187if ((!(eventInfo.DeclaringType!.IsPublic || eventInfo.DeclaringType.IsNestedPublic)) && (eventInfo.DeclaringType.Assembly == typeof(ReflectTypeDescriptionProvider).Assembly))
System.Composition.Convention (5)
System\Composition\Convention\ConventionBuilder.cs (2)
224if (!(member is TypeInfo) && member.DeclaringType != reflectedType) 245&& !_memberInfos.TryGetValue(member.DeclaringType.GetTypeInfo() as MemberInfo, out cachedAttributes))
System\Composition\Convention\PartConventionBuilder.cs (3)
619MethodInfo underlyingMi = mi.DeclaringType.GetRuntimeMethod(mi.Name, _emptyTypeArray); 678underlyingPi ??= pi.DeclaringType.GetRuntimeProperty(pi.Name); 715underlyingPi ??= pi.DeclaringType.GetRuntimeProperty(pi.Name);
System.Composition.TypedParts (7)
System\Composition\CompositionContextExtensions.cs (1)
57if (ContractHelpers.TryGetExplicitImportInfo(pi.PropertyType, conventions.GetDeclaredAttributes(pi.DeclaringType, pi), site, out importInfo))
System\Composition\TypedParts\ActivationFeatures\OnImportsSatisfiedFeature.cs (1)
39.Where(mi => _attributeContext.GetDeclaredAttribute<OnImportsSatisfiedAttribute>(mi.DeclaringType, mi) != null);
System\Composition\TypedParts\ActivationFeatures\PropertyInjectionFeature.cs (1)
32let attrs = _attributeContext.GetDeclaredAttributes(pi.DeclaringType, pi).ToArray()
System\Composition\TypedParts\ContractHelpers.cs (1)
73.Where(p => p.GetMethod.IsPublic && p.DeclaringType == attrType && p.CanRead))
System\Composition\TypedParts\Discovery\DiscoveredPropertyExport.cs (1)
29Expression.Convert(Expression.Call(Expression.Constant(partActivator), s_activatorInvoke, args), _property.DeclaringType),
System\Composition\TypedParts\Discovery\TypeInspector.cs (1)
158.Where(p => p.DeclaringType == attrType && p.CanRead))
System\Composition\TypedParts\Util\DirectAttributeContext.cs (1)
17if (!(member is TypeInfo) && member.DeclaringType != reflectedType)
System.Configuration.ConfigurationManager (1)
System\Configuration\ConfigurationProperty.cs (1)
107validatorAttribute.SetDeclaringType(info.DeclaringType);
System.Diagnostics.DiagnosticSource (2)
System\Diagnostics\DsesFilterAndTransform.cs (2)
821if (!RuntimeFeature.IsDynamicCodeSupported && (propertyInfo.DeclaringType!.IsValueType || propertyInfo.PropertyType.IsValueType)) 829propertyInfo.DeclaringType!, propertyInfo.PropertyType);
System.Linq.Expressions (53)
System\Dynamic\DynamicObject.cs (1)
820if (mi.DeclaringType != typeof(DynamicObject) && mi.GetBaseDefinition() == method)
System\Dynamic\Utils\TypeExtensions.cs (1)
65public static Type GetReturnType(this MethodBase mi) => mi.IsConstructor ? mi.DeclaringType! : ((MethodInfo)mi).ReturnType;
System\Dynamic\Utils\TypeUtils.cs (1)
236Type? targetType = member.DeclaringType;
System\Linq\Expressions\BinaryExpression.cs (2)
400MethodInfo? opTrueFalse = TypeUtils.GetBooleanOperator(Method!.DeclaringType!, opName); 827Type? declaringType = method.DeclaringType;
System\Linq\Expressions\Compiler\ILGen.cs (3)
292Debug.Assert(!ci.DeclaringType!.ContainsGenericParameters); 441Type? dt = mb.DeclaringType; 478Type? dt = mb.DeclaringType;
System\Linq\Expressions\Compiler\LambdaCompiler.Expressions.cs (6)
492if (mi.DeclaringType!.IsValueType) 626if (node.Constructor.DeclaringType!.IsAbstract) 980EmitMemberAddress(binding.Member, binding.Member.DeclaringType); 984EmitMemberGet(binding.Member, binding.Member.DeclaringType); 998EmitMemberAddress(binding.Member, binding.Member.DeclaringType); 1002EmitMemberGet(binding.Member, binding.Member.DeclaringType);
System\Linq\Expressions\Compiler\LambdaCompiler.Logical.cs (2)
283MethodInfo? opFalse = TypeUtils.GetBooleanOperator(b.Method.DeclaringType!, "op_False"); 389MethodInfo? opTrue = TypeUtils.GetBooleanOperator(b.Method.DeclaringType!, "op_True");
System\Linq\Expressions\DebugViewWriter.cs (3)
535Out(member.DeclaringType!.ToString() + "." + member.Name); 772else if (node.Method.DeclaringType != null) 774Out(node.Method.DeclaringType.ToString());
System\Linq\Expressions\ExpressionStringBuilder.cs (3)
401Out(member.DeclaringType!.Name); 758Out(node.Indexer.DeclaringType!.Name); 784if (toString.DeclaringType != typeof(Expression) && !toString.IsStatic)
System\Linq\Expressions\Interpreter\CallInstruction.cs (6)
46if (info.DeclaringType != null && info.DeclaringType.IsArray && (info.Name == "Get" || info.Name == "Set")) 54if (!info.IsStatic && info.DeclaringType!.IsValueType) 121Type arrayType = info.DeclaringType!; 180return target.DeclaringType; 213if (!info.IsStatic) types.Add(info.DeclaringType!);
System\Linq\Expressions\Interpreter\InterpretedFrame.cs (1)
130return method.DeclaringType == typeof(Interpreter) && method.Name == "Run";
System\Linq\Expressions\Interpreter\LightCompiler.cs (2)
1359MethodInfo? opTrue = TypeUtils.GetBooleanOperator(expr.Method!.DeclaringType!, andAlso ? "op_False" : "op_True"); 2389if (node.Constructor.DeclaringType!.IsAbstract)
System\Linq\Expressions\Interpreter\NewInstruction.cs (1)
67public override string ToString() => "New " + _constructor.DeclaringType!.Name + "(" + _constructor + ")";
System\Linq\Expressions\MemberAssignment.cs (1)
89Type? decType = member.DeclaringType;
System\Linq\Expressions\MemberExpression.cs (5)
139if (!TypeUtils.AreReferenceAssignable(field.DeclaringType!, expression.Type)) 141throw Error.FieldInfoNotDefinedForType(field.DeclaringType, field.Name, expression.Type); 310Type? type = mi.DeclaringType; 329throw Error.MethodNotPropertyAccessor(mi.DeclaringType, mi.Name, paramName, index); 343Type type = method.DeclaringType!;
System\Linq\Expressions\MemberMemberBinding.cs (2)
125Type? decType = member.DeclaringType; 160if (!b.Member.DeclaringType!.IsAssignableFrom(type))
System\Linq\Expressions\MethodCallExpression.cs (1)
1265throw Error.InstanceAndMethodTypeMismatch(method, method.DeclaringType, instanceType);
System\Linq\Expressions\NewExpression.cs (11)
33public override Type Type => Constructor!.DeclaringType!; 139ArgumentNullException.ThrowIfNull(constructor.DeclaringType, nameof(constructor)); 140if (constructor.DeclaringType is null) 143throw new ArgumentNullException($"{nameof(constructor)}.{nameof(constructor.DeclaringType)}"); 146TypeUtils.ValidateType(constructor.DeclaringType!, nameof(constructor), allowByRef: true, allowPointer: true); 165if (constructor.DeclaringType is null) 168throw new ArgumentNullException($"{nameof(constructor)}.{nameof(constructor.DeclaringType)}"); 171TypeUtils.ValidateType(constructor.DeclaringType!, nameof(constructor), allowByRef: true, allowPointer: true); 241if (!TypeUtils.AreEquivalent(member.DeclaringType, constructor.DeclaringType)) 243throw Error.ArgumentMemberNotDeclOnType(member.Name, constructor.DeclaringType!.Name, nameof(members), i);
System\Runtime\CompilerServices\CallSiteHelpers.cs (1)
38if (mb.DeclaringType == typeof(UpdateDelegates))
System.Linq.Queryable (3)
System\Linq\EnumerableRewriter.cs (3)
39if ((mInfo.IsStatic || mInfo.DeclaringType!.IsAssignableFrom(obj!.Type)) 45else if (mInfo.DeclaringType == typeof(Queryable)) 55MethodInfo method = FindMethod(mInfo.DeclaringType!, mInfo.Name, args, typeArgs);
System.Private.CoreLib (125)
src\libraries\System.Private.CoreLib\src\System\DefaultBinder.cs (7)
1030int hierarchyDepth1 = GetHierarchyDepth(m1.DeclaringType!); 1031int hierarchyDepth2 = GetHierarchyDepth(m2.DeclaringType!); 1057int hierarchyDepth1 = GetHierarchyDepth(cur1.DeclaringType!); 1058int hierarchyDepth2 = GetHierarchyDepth(cur2.DeclaringType!); 1080int hierarchyDepth1 = GetHierarchyDepth(cur1.DeclaringType!); 1081int hierarchyDepth2 = GetHierarchyDepth(cur2.DeclaringType!); 1138int currentHierarchyDepth = GetHierarchyDepth(match[i].DeclaringType!);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Contracts\Contracts.cs (1)
628Assembly? caller = stack.GetFrame(i)!.GetMethod()?.DeclaringType?.Assembly;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\DiagnosticMethodInfo.cs (1)
33Type? declaringType = _method.DeclaringType;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\StackTrace.cs (5)
241Type? declaringType = mb.DeclaringType; 394Type? declaringType = mb.DeclaringType; 438Debug.Assert(method.DeclaringType != null); 440declaringType = method.DeclaringType; 484declaringType = candidateMethod.DeclaringType!;
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\TraceLogging\PropertyValue.cs (3)
160if (property.DeclaringType!.IsValueType) 195var helper = (TypeHelper)Activator.CreateInstance(typeof(ReferenceTypeHelper<>).MakeGenericType(property.DeclaringType!))!; 207return property.GetMethod!.CreateDelegate(typeof(Func<,>).MakeGenericType(property.DeclaringType!, propertyType));
src\libraries\System.Private.CoreLib\src\System\Reflection\CustomAttributeData.cs (2)
52vsb.Append(Constructor.DeclaringType!.FullName); 82public virtual Type AttributeType => Constructor.DeclaringType!;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilderInstantiation.cs (1)
45public override Type? DeclaringType => _method.DeclaringType;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodOnTypeBuilderInstantiation.cs (1)
43Type t = info.DeclaringType!;
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\TypeBuilder.cs (7)
346if (method.DeclaringType == null || !method.DeclaringType.IsGenericTypeDefinition) 351if (type.GetGenericTypeDefinition() != method.DeclaringType) 381if (!constructor.DeclaringType!.IsGenericTypeDefinition) 386if (type.GetGenericTypeDefinition() != constructor.DeclaringType) 414if (!field.DeclaringType!.IsGenericTypeDefinition) 419if (type.GetGenericTypeDefinition() != field.DeclaringType)
src\libraries\System.Private.CoreLib\src\System\Reflection\FieldAccessor.cs (2)
486throw new ArgumentException(SR.Format(SR.Arg_FieldDeclTarget, fieldInfo.Name, fieldInfo.DeclaringType, target.GetType())); 489throw new FieldAccessException(SR.Format(SR.RFLCT_CannotSetInitonlyStaticField, fieldInfo.Name, fieldInfo.DeclaringType));
src\libraries\System.Private.CoreLib\src\System\Reflection\InvokerEmitUtil.cs (14)
28string declaringTypeName = method.DeclaringType != null ? method.DeclaringType.Name + "." : string.Empty; 42if (method.DeclaringType!.IsValueType) 44il.Emit(OpCodes.Unbox, method.DeclaringType); 96string declaringTypeName = method.DeclaringType != null ? method.DeclaringType.Name + "." : string.Empty; 110if (method.DeclaringType!.IsValueType) 112il.Emit(OpCodes.Unbox, method.DeclaringType); 153string declaringTypeName = method.DeclaringType != null ? method.DeclaringType.Name + "." : string.Empty; 167if (method.DeclaringType!.IsValueType) 169il.Emit(OpCodes.Unbox, method.DeclaringType); 227else if (method.IsStatic || method.DeclaringType!.IsValueType) 239Type returnType = method.DeclaringType!;
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodInvokerCommon.cs (2)
97if (!method.DeclaringType!.IsInstanceOfType(target)) 99throw new TargetException(SR.Format(SR.RFLCT_Targ_ITargMismatch_WithType, method.DeclaringType, target.GetType()));
src\libraries\System.Private.CoreLib\src\System\Reflection\NullabilityInfoContext.cs (2)
54memberInfo = memberInfo.DeclaringType; 431Type? type = member.DeclaringType;
src\libraries\System.Private.CoreLib\src\System\Threading\Timer.cs (1)
526string? typeName = _timerCallback.Method.DeclaringType?.FullName;
src\libraries\System.Private.CoreLib\src\System\ThrowHelper.cs (1)
691Type? declaringType = memberInfo.DeclaringType;
src\System\Attribute.CoreCLR.cs (2)
270if (param.Member.DeclaringType is null) // This is an interface so we are done. 340if (param.Member.DeclaringType is null || !inherit) // This is an interface so we are done.
src\System\Diagnostics\StackTrace.CoreCLR.cs (1)
31Type? t = mb.DeclaringType;
src\System\Reflection\Emit\CustomAttributeBuilder.cs (20)
150if (property.DeclaringType != con.DeclaringType 151&& (con.DeclaringType is not TypeBuilderInstantiation) 152&& !con.DeclaringType!.IsSubclassOf(property.DeclaringType!)) 157if (!RuntimeTypeBuilder.IsTypeEqual(property.DeclaringType, con.DeclaringType)) 163if (property.DeclaringType is not TypeBuilder || 164!con.DeclaringType.IsSubclassOf(((RuntimeTypeBuilder)property.DeclaringType).BakedRuntimeType)) 202if (namedField.DeclaringType != con.DeclaringType 203&& (con.DeclaringType is not TypeBuilderInstantiation) 204&& !con.DeclaringType!.IsSubclassOf(namedField.DeclaringType!)) 209if (!RuntimeTypeBuilder.IsTypeEqual(namedField.DeclaringType, con.DeclaringType)) 215if (namedField.DeclaringType is not TypeBuilder || 216!con.DeclaringType.IsSubclassOf(((RuntimeTypeBuilder)namedFields[i].DeclaringType!).BakedRuntimeType))
src\System\Reflection\Emit\DynamicILGenerator.cs (4)
147int token = field.DeclaringType == null ? 257if (methodInfo.DeclaringType != null && methodInfo.DeclaringType.ContainsGenericParameters) 1022Type t = m.DeclaringType!.GetGenericTypeDefinition();
src\System\Reflection\Emit\RuntimeMethodBuilder.cs (1)
704if (con.DeclaringType == typeof(DllImportAttribute))
src\System\Reflection\Emit\RuntimeModuleBuilder.cs (30)
241tr = GetTypeTokenInternal(constructor.DeclaringType!); 242mr = GetMemberRef(constructor.DeclaringType!.Module, tr, conOnTypeBuilderInst.MetadataToken); 331if (method.DeclaringType!.IsGenericType) 350if (method.DeclaringType!.IsGenericType) 352byte[] sig = SignatureHelper.GetTypeSigToken(this, method.DeclaringType).InternalGetSignature(out int length); 358tkParent = GetTypeMetadataToken(method.DeclaringType); 422methDef.DeclaringType?.GetGenericArguments(), 429methodBase.DeclaringType?.GetGenericArguments(), 972if (method.DeclaringType == null) 978tr = getGenericTypeDefinition ? GetTypeMetadataToken(method.DeclaringType) : GetTypeTokenInternal(method.DeclaringType); 979mr = GetMemberRef(method.DeclaringType.Module, tr, methodToken); 995Type declaringType = method.DeclaringType ?? 1077|| (methodInfoUnbound.DeclaringType != null && methodInfoUnbound.DeclaringType.IsGenericType)) 1102(method.DeclaringType == null || !method.DeclaringType.IsGenericType)) 1181if (field.DeclaringType != null && field.DeclaringType.IsGenericType) 1183byte[] sig = SignatureHelper.GetTypeSigToken(this, field.DeclaringType).InternalGetSignature(out int length); 1195if (field.DeclaringType == null) 1199tr = GetTypeTokenInternal(field.DeclaringType); 1207if (field.DeclaringType == null) 1212if (field.DeclaringType != null && field.DeclaringType.IsGenericType) 1214byte[] sig = SignatureHelper.GetTypeSigToken(this, field.DeclaringType).InternalGetSignature(out int length); 1216mr = GetMemberRefOfFieldInfo(tr, field.DeclaringType.TypeHandle, rtField); 1220tr = GetTypeTokenInternal(field.DeclaringType!); 1221mr = GetMemberRefOfFieldInfo(tr, field.DeclaringType!.TypeHandle, rtField); 1227byte[] sig = SignatureHelper.GetTypeSigToken(this, field.DeclaringType!).InternalGetSignature(out int length);
src\System\Reflection\Emit\RuntimeTypeBuilder.cs (1)
1072if (!ReferenceEquals(methodInfoBody.DeclaringType, this))
src\System\Reflection\FieldInfo.CoreCLR.cs (1)
15Type? declaringType = f.DeclaringType;
src\System\Reflection\MethodBase.CoreCLR.cs (1)
22Type? declaringType = m?.DeclaringType;
src\System\Reflection\RuntimeCustomAttributeData.cs (4)
227if (attrs[i].Constructor.DeclaringType == caType) 256if (m_ctor!.DeclaringType!.IsGenericType) 275FieldInfo[] fields = m_ctor.DeclaringType!.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); 276PropertyInfo[] properties = m_ctor.DeclaringType.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
src\System\Reflection\RuntimeExceptionHandlingClause.cs (1)
56Type? declaringType = _methodBody._methodBase.DeclaringType;
src\System\Reflection\RuntimeParameterInfo.cs (2)
376Debug.Assert(attr.Constructor.DeclaringType == typeof(DecimalConstantAttribute)); 397Debug.Assert(attr.Constructor.DeclaringType == typeof(DateTimeConstantAttribute));
src\System\RuntimeType.CoreCLR.cs (7)
1590if (ReferenceEquals(attrs[i].Constructor.DeclaringType, DefaultMemberAttrType)) 2164bool isInherited = !ReferenceEquals(memberInfo.DeclaringType, memberInfo.ReflectedType); 2940if (ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) 2943if ((match.DeclaringType!.IsInterface) && (fieldInfo.DeclaringType!.IsInterface)) 2947if (match == null || fieldInfo.DeclaringType!.IsSubclassOf(match.DeclaringType!) || match.DeclaringType!.IsInterface) 2952if (multipleStaticFieldMatches && match!.DeclaringType!.IsInterface)
System.Private.DataContractSerialization (44)
System\Runtime\Serialization\AccessorBuilder.cs (6)
46Type declaringType = propInfo.DeclaringType!; 91throw new InvalidOperationException(SR.Format(SR.InvalidMember, DataContract.GetClrTypeFullName(memberInfo.DeclaringType!), memberInfo.Name)); 103Type declaringType = propInfo.DeclaringType!; 129var createSetterGeneric = s_createSetterInternal.MakeGenericMethod(propInfo.DeclaringType!, propInfo.PropertyType).CreateDelegate<Func<PropertyInfo, Setter>>(); 143throw new InvalidOperationException(SR.Format(SR.NoSetMethodForProperty, propInfo.DeclaringType, propInfo.Name)); 155throw new InvalidOperationException(SR.Format(SR.InvalidMember, DataContract.GetClrTypeFullName(memberInfo.DeclaringType!), memberInfo.Name));
System\Runtime\Serialization\ClassDataContract.cs (25)
260Type declaringType = memberContract.MemberInfo.DeclaringType!; 826ThrowInvalidDataContractException(SR.Format(SR.TooManyDataMembers, DataContract.GetClrTypeFullName(member.DeclaringType!), member.Name)); 839ThrowInvalidDataContractException(SR.Format(SR.NoGetMethodForProperty, property.DeclaringType, property.Name)); 844_serializationExceptionMessage = SR.Format(SR.NoSetMethodForProperty, property.DeclaringType, property.Name); 848ThrowInvalidDataContractException(SR.Format(SR.IndexedPropertyCannotBeSerialized, property.DeclaringType, property.Name)); 870DataContract.GetClrTypeFullName(member.DeclaringType!), 889ThrowInvalidDataContractException(SR.Format(SR.TooManyIgnoreDataMemberAttributes, DataContract.GetClrTypeFullName(member.DeclaringType!), member.Name)); 940DataContract.GetClrTypeFullName(member.DeclaringType!), 1105Debug.Assert(method.DeclaringType != null); 1108ThrowInvalidDataContractException(SR.Format(SR.DuplicateExtensionDataSetMethod, method, _extensionDataSetMethod, DataContract.GetClrTypeFullName(method.DeclaringType))); 1110DataContract.ThrowInvalidDataContractException(SR.Format(SR.ExtensionDataSetMustReturnVoid, DataContract.GetClrTypeFullName(method.DeclaringType), method), method.DeclaringType); 1112DataContract.ThrowInvalidDataContractException(SR.Format(SR.ExtensionDataSetParameterInvalid, DataContract.GetClrTypeFullName(method.DeclaringType), method, Globals.TypeOfExtensionDataObject), method.DeclaringType); 1122Debug.Assert(method.DeclaringType != null); 1125DataContract.ThrowInvalidDataContractException(SR.Format(SR.DuplicateCallback, method, currentCallback, DataContract.GetClrTypeFullName(method.DeclaringType), attributeType), method.DeclaringType); 1127DataContract.ThrowInvalidDataContractException(SR.Format(SR.DuplicateAttribute, prevAttributeType, attributeType, DataContract.GetClrTypeFullName(method.DeclaringType), method), method.DeclaringType); 1129DataContract.ThrowInvalidDataContractException(SR.Format(SR.CallbacksCannotBeVirtualMethods, method, DataContract.GetClrTypeFullName(method.DeclaringType), attributeType), method.DeclaringType); 1133DataContract.ThrowInvalidDataContractException(SR.Format(SR.CallbackMustReturnVoid, DataContract.GetClrTypeFullName(method.DeclaringType), method), method.DeclaringType); 1135DataContract.ThrowInvalidDataContractException(SR.Format(SR.CallbackParameterInvalid, DataContract.GetClrTypeFullName(method.DeclaringType), method, Globals.TypeOfStreamingContext), method.DeclaringType);
System\Runtime\Serialization\CodeGenerator.cs (5)
494if (methodInfo.IsVirtual && !methodInfo.DeclaringType!.IsValueType) 591throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.NoGetMethodForProperty, property.DeclaringType, property)); 600throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.CannotLoadMemberType, "Unknown", memberInfo.DeclaringType, memberInfo.Name)); 622throw XmlObjectSerializer.CreateSerializationException(SR.Format(SR.NoSetMethodForProperty, property.DeclaringType, property)); 1109ConvertAddress(GetVariableType(thisObj), methodInfo.DeclaringType!);
System\Runtime\Serialization\DataContract.cs (1)
2205if (!IsTypeVisibleInSerializationModule(member.DeclaringType!))
System\Runtime\Serialization\DataContractSet.cs (3)
277(dataMember.MemberInfo.DeclaringType != null) ? DataContract.GetClrTypeFullName(dataMember.MemberInfo.DeclaringType) : dataMember.MemberInfo.DeclaringType,
System\Runtime\Serialization\EnumDataContract.cs (2)
233ThrowInvalidDataContractException(SR.Format(SR.TooManyEnumMembers, DataContract.GetClrTypeFullName(field.DeclaringType!), field.Name)); 252ThrowInvalidDataContractException(SR.Format(SR.DataMemberOnEnumField, DataContract.GetClrTypeFullName(field.DeclaringType!), field.Name));
System\Runtime\Serialization\XPathQueryGenerator.cs (2)
77if (member.MemberInfo.Name == memberNode.Name && member.MemberInfo.DeclaringType!.IsAssignableFrom(memberNode.DeclaringType))
System.Private.Windows.Core (1)
System\Private\Windows\BinaryFormat\Deserializer\ClassRecordFieldInfoDeserializer.cs (1)
60throw new SerializationException(string.Format(SR.Serialization_MissingField, field.Name, field.DeclaringType!.Name));
System.Private.Xml (27)
System\Xml\Serialization\CodeGenerator.cs (3)
308Debug.Assert(ICollection_get_Count.IsVirtual && !ICollection_get_Count.DeclaringType!.IsValueType); 403if (methodInfo.IsVirtual && !methodInfo.DeclaringType!.IsValueType) 500Type? currentType = propertyInfo.DeclaringType!.BaseType;
System\Xml\Serialization\Mappings.cs (5)
1005Type? baseDeclaringType = baseMember.DeclaringType; 1006Type? derivedDeclaringType = derivedMember.DeclaringType; 1266throw new InvalidOperationException(SR.Format(SR.XmlSerializableRootDupName, _getSchemaMethod!.DeclaringType!.FullName, e.Name, elementNs)); 1352throw new InvalidOperationException(SR.Format(SR.XmlGetSchemaInclude, _xsiType.Namespace, _getSchemaMethod.DeclaringType!.FullName, _getSchemaMethod.Name)); 1362throw new InvalidOperationException(SR.Format(SR.XmlGetSchemaTypeMissing, _getSchemaMethod.DeclaringType!.FullName, _getSchemaMethod.Name, _xsiType.Name, _xsiType.Namespace));
System\Xml\Serialization\Models.cs (6)
210throw new InvalidOperationException(SR.Format(SR.XmlSerializerUnsupportedMember, $"{member.DeclaringType!.FullName}.{member.Name}", type.FullName), typeDesc.Exception); 220if (fieldInfo.DeclaringType != Type) return null; 233if (propertyInfo.DeclaringType != Type) return null; 300_checkShouldPersistMethodInfo = memberInfo.DeclaringType!.GetMethod($"ShouldSerialize{memberInfo.Name}", Type.EmptyTypes); 303FieldInfo? specifiedField = memberInfo.DeclaringType.GetField($"{memberInfo.Name}Specified"); 315PropertyInfo? specifiedProperty = memberInfo.DeclaringType.GetProperty($"{memberInfo.Name}Specified");
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (2)
1665member.Source = (value) => throw new InvalidOperationException(SR.Format(SR.XmlReadOnlyPropertyError, pi.Name, pi.DeclaringType!.FullName)); 1684throw new InvalidOperationException(SR.Format(SR.XmlReadOnlyPropertyError, pi.Name, pi.DeclaringType!.FullName));
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (1)
1445if (declaringType == mi.DeclaringType)
System\Xml\Serialization\SoapReflectionImporter.cs (1)
151SoapAttributes? attrs = _attributeOverrides[memberInfo.DeclaringType!, memberInfo.Name];
System\Xml\Serialization\Types.cs (5)
815arrayElementType = GetCollectionElementType(type, memberInfo == null ? null : $"{memberInfo.DeclaringType!.FullName}.{memberInfo.Name}"); 885exception = new NotSupportedException(SR.Format(SR.XmlUnsupportedInterfaceDetails, $"{memberInfo.DeclaringType!.FullName}.{memberInfo.Name}", type.FullName)); 1082throw new InvalidOperationException(SR.Format(SR.XmlReadOnlyPropertyError, propertyInfo.DeclaringType, propertyInfo.Name)); 1189Type typeToBeReplaced = memberInfoToBeReplaced.DeclaringType!; 1355if (defaultProp.DeclaringType != t) continue;
System\Xml\Serialization\XmlReflectionImporter.cs (1)
261XmlAttributes? attrs = _attributeOverrides[memberInfo.DeclaringType!, memberInfo.Name];
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (3)
1385Type typAgg = methAgg.DeclaringType!; 3633_helper.CallGetEarlyBoundObject(_helper.StaticData.DeclareEarlyBound(ndName.NamespaceUri, extFunc.Method.DeclaringType!), extFunc.Method.DeclaringType!);
System.Reflection.Context (15)
System\Reflection\Context\Custom\CustomType.cs (1)
272Type? declaringType = match.DeclaringType;
System\Reflection\Context\Delegation\DelegatingConstructorInfo.cs (1)
36get { return UnderlyingConstructor.DeclaringType; }
System\Reflection\Context\Delegation\DelegatingEventInfo.cs (1)
25get { return UnderlyingEvent.DeclaringType; }
System\Reflection\Context\Delegation\DelegatingFieldInfo.cs (1)
26get { return UnderlyingField.DeclaringType; }
System\Reflection\Context\Delegation\DelegatingMethodInfo.cs (1)
38get { return UnderlyingMethod.DeclaringType; }
System\Reflection\Context\Delegation\DelegatingPropertyInfo.cs (1)
36get { return UnderlyingProperty.DeclaringType; }
System\Reflection\Context\Virtual\InheritedMethodInfo.cs (2)
19Debug.Assert(reflectedType.IsSubclassOf(baseMethod.DeclaringType!)); 23Debug.Assert(baseMethod.ReflectedType!.Equals(baseMethod.DeclaringType));
System\Reflection\Context\Virtual\InheritedPropertyInfo.cs (2)
19Debug.Assert(reflectedType.IsSubclassOf(baseProperty.DeclaringType!)); 23Debug.Assert(baseProperty.ReflectedType!.Equals(baseProperty.DeclaringType));
System\Reflection\Context\Virtual\VirtualMethodBase.cs (5)
48get { return DeclaringType!.Module; } 53get { return DeclaringType; } 123DeclaringType!.Equals(other.DeclaringType) && 130DeclaringType!.GetHashCode() ^
System.Reflection.Emit (15)
src\libraries\System.Private.CoreLib\src\System\Reflection\Emit\MethodBuilderInstantiation.cs (1)
45public override Type? DeclaringType => _method.DeclaringType;
System\Reflection\Emit\CustomAttributeWrapper.cs (3)
44throw new ArgumentException(SR.Format(SR.Argument_InvalidCustomAttributeLength, ctor.DeclaringType, binaryAttribute.Length), nameof(binaryAttribute)); 48throw new ArgumentException(SR.Format(SR.Argument_InvalidProlog, ctor.DeclaringType), nameof(binaryAttribute)); 88throw new ArgumentException(SR.Format(SR.Argument_UnknownNamedType, ctor.DeclaringType, namedType), nameof(binaryAttribute));
System\Reflection\Emit\LocalBuilderImpl.cs (1)
34if (_method.DeclaringType is TypeBuilder typeBuilder && typeBuilder.IsCreated())
System\Reflection\Emit\ModuleBuilderImpl.cs (5)
736Type declaringType = field.DeclaringType!; 750memberHandle = AddMemberReference(ctor.Name, GetTypeHandle(memberInfo.DeclaringType!), MetadataSignatureHelper.GetConstructorSignature(ctor.GetParameters(), this)); 764memberHandle = AddMemberReference(method.Name, GetTypeHandle(memberInfo.DeclaringType!), GetMethodSignature(method, null)); 821Type declaringType = memberInfo.DeclaringType!; 1098if (IsConstructedFromTypeBuilder(member.DeclaringType!))
System\Reflection\Emit\TypeBuilderImpl.cs (5)
306if (!ReferenceEquals(methodInfoBody.DeclaringType, this)) 311Type baseType = methodInfoDeclaration.DeclaringType!; 541throw new ArgumentException(SR.Format(SR.Argument_UnknownNamedType, con.DeclaringType, name), nameof(binaryAttribute)); 860if (match != null && ReferenceEquals(fieldInfo.DeclaringType, match.DeclaringType)) 1067throw new AmbiguousMatchException(SR.Format(SR.AmbiguousMatch_MemberInfo, firstCandidate.DeclaringType, firstCandidate.Name));
System.Reflection.MetadataLoadContext (11)
System\Reflection\DefaultBinder.cs (5)
514int hierarchyDepth1 = GetHierarchyDepth(m1.DeclaringType!); 515int hierarchyDepth2 = GetHierarchyDepth(m2.DeclaringType!); 541int hierarchyDepth1 = GetHierarchyDepth(cur1.DeclaringType!); 542int hierarchyDepth2 = GetHierarchyDepth(cur2.DeclaringType!); 599int currentHierarchyDepth = GetHierarchyDepth(match[i].DeclaringType!);
System\Reflection\Runtime\BindingFlagSupport\QueryResult.cs (2)
114if (match.DeclaringType!.Equals(challenger.DeclaringType))
System\Reflection\TypeLoading\CustomAttributes\CustomAttributeHelpers.cs (1)
110Type attributeType = ci.DeclaringType!;
System\Reflection\TypeLoading\CustomAttributes\RoPseudoCustomAttributeData.cs (1)
38protected sealed override Type? ComputeAttributeType() => _constructor.DeclaringType;
System\Reflection\TypeLoading\Methods\RoDefinitionMethod.DllImport.cs (1)
36Type attributeType = ctor.DeclaringType!;
System\ThrowHelper.cs (1)
21Type? declaringType = memberInfo.DeclaringType;
System.Resources.Extensions (1)
System\Resources\Extensions\BinaryFormat\Deserializer\ClassRecordFieldInfoDeserializer.cs (1)
65throw new SerializationException(SR.Format(SR.Serialization_MissingField, field.Name, field.DeclaringType!.Name));
System.Runtime.InteropServices (2)
System\Runtime\InteropServices\ComAwareEventInfo.cs (2)
74public override Type? DeclaringType => _innerEventInfo.DeclaringType; 103object[] comEventInterfaces = eventInfo.DeclaringType!.GetCustomAttributes(typeof(ComEventInterfaceAttribute), inherit: false);
System.Runtime.Serialization.Formatters (1)
System\Runtime\Serialization\SerializationFieldInfo.cs (1)
35public override Type? DeclaringType => m_field.DeclaringType;
System.Security.Cryptography.Xml (1)
System\Security\Cryptography\Xml\SignedXmlDebugLog.cs (1)
326validationMethod.DeclaringType!.FullName,
System.Text.Json (17)
System\ReflectionExtensions.cs (3)
122if (parameter.Member is { DeclaringType.IsConstructedGenericType: true } 141if (member.DeclaringType!.IsConstructedGenericType) 147Type genericTypeDef = member.DeclaringType.GetGenericTypeDefinition();
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Converters.cs (1)
179Type declaringType = memberInfo?.DeclaringType ?? typeToConvert;
System\Text\Json\Serialization\Metadata\DefaultJsonTypeInfoResolver.Helpers.cs (4)
238ThrowHelper.ThrowInvalidOperationException_CannotSerializeInvalidType(typeToConvert, memberInfo.DeclaringType, memberInfo); 253JsonPropertyInfo jsonPropertyInfo = typeInfo.CreatePropertyUsingReflection(typeToConvert, declaringType: memberInfo.DeclaringType); 300Debug.Assert(typeInfo.Converter.ConstructorInfo.DeclaringType != null); 301ThrowHelper.ThrowNotSupportedException_ConstructorContainsNullParameterNames(typeInfo.Converter.ConstructorInfo.DeclaringType);
System\Text\Json\Serialization\Metadata\ReflectionEmitMemberAccessor.cs (6)
76Type? type = constructor.DeclaringType; 117Type? type = constructor.DeclaringType; 238Type? declaringType = propertyInfo.DeclaringType; 284Type? declaringType = propertyInfo.DeclaringType; 319Type? declaringType = fieldInfo.DeclaringType; 353Type? declaringType = fieldInfo.DeclaringType;
System\Text\Json\Serialization\Metadata\ReflectionMemberAccessor.cs (2)
44Debug.Assert(constructor.DeclaringType == type && constructor.IsPublic && !constructor.IsStatic); 79Debug.Assert(constructor.DeclaringType == type && constructor.IsPublic && !constructor.IsStatic);
System\Text\Json\ThrowHelper.Serialization.cs (1)
566string location = memberInfo is Type type ? type.ToString() : $"{memberInfo.DeclaringType}.{memberInfo.Name}";
System.Windows.Forms.Design (1)
System\ComponentModel\Design\Serialization\CodeDomSerializerBase.cs (1)
1994Type expressionType = descriptor.MemberInfo!.DeclaringType!;
System.Windows.Forms.Tests (1)
System\Windows\Forms\AccessibleObjects\AccessibleObjectTests.cs (1)
2731Assert.Equal(type, runtimeIdProperty.DeclaringType);
System.Xaml (30)
System\Xaml\MS\Impl\XmlNsInfo.cs (5)
168if (LooseTypeExtensions.AssemblyQualifiedNameEquals(cad.Constructor.DeclaringType, typeof(XmlnsDefinitionAttribute))) 259if (LooseTypeExtensions.AssemblyQualifiedNameEquals(cad.Constructor.DeclaringType, typeof(InternalsVisibleToAttribute))) 318if (LooseTypeExtensions.AssemblyQualifiedNameEquals(cad.Constructor.DeclaringType, typeof(XmlnsCompatibleWithAttribute))) 371if (LooseTypeExtensions.AssemblyQualifiedNameEquals(cad.Constructor.DeclaringType, typeof(XmlnsPrefixAttribute))) 421if (LooseTypeExtensions.AssemblyQualifiedNameEquals(cad.Constructor.DeclaringType, typeof(RootNamespaceAttribute)))
System\Xaml\Runtime\DynamicMethodRuntime.cs (3)
329DynamicMethod dynamicMethod = CreateDynamicMethod($"{ctor.DeclaringType.Name}Ctor", 474Type declaringType = instanceMethod.DeclaringType; 503OpCode callType = (method.IsStatic || method.DeclaringType.IsValueType) ? OpCodes.Call : OpCodes.Callvirt;
System\Xaml\Schema\MemberReflector.cs (6)
232if (TypeReflector.IsInternal(method.DeclaringType)) 239method.DeclaringType.Assembly, accessingAssembly); 256if (!derivedType.Equals(method.DeclaringType) && !derivedType.IsSubclassOf(method.DeclaringType)) 268if (TypeReflector.IsInternal(method.DeclaringType)) 275method.DeclaringType.Assembly, derivedType.Assembly);
System\Xaml\Schema\Reflector.cs (3)
521if (TypesAreEqual(_attributeData[i].Constructor.DeclaringType, attributeType)) 535if (TypesAreEqual(_attributeData[i].Constructor.DeclaringType, attributeType)) 545cad.Constructor.DeclaringType, Member, expectedCount, expectedType));
System\Xaml\Schema\TypeReflector.cs (6)
514if (shadowedProp.DeclaringType.IsAssignableFrom(currentProp.DeclaringType)) 568if (shadowedEvent.DeclaringType.IsAssignableFrom(currentEvent.DeclaringType)) 611if (mostDerived is null || mostDerived.DeclaringType.IsAssignableFrom(pi.DeclaringType))
System\Xaml\Schema\XamlMemberInvoker.cs (1)
113Type declaringType = _member.UnderlyingMember.DeclaringType;
System\Xaml\XamlMember.cs (4)
57_declaringType = schemaContext.GetXamlType(propertyInfo.DeclaringType); 80_declaringType = schemaContext.GetXamlType(eventInfo.DeclaringType); 115_declaringType = schemaContext.GetXamlType(accessor.DeclaringType); 142_declaringType = schemaContext.GetXamlType(adder.DeclaringType);
System\Xaml\XamlObjectReader.cs (2)
1242var declaringType = memberInfo.DeclaringType; 3245Type baseDeclaringType = accessor.GetBaseDefinition().DeclaringType;
System.Xaml.Tests (8)
Common\CustomConstructorInfo.cs (1)
23public override Type DeclaringType => DeclaringTypeResult.Or(DelegatingConstructor.DeclaringType!);
Common\CustomMethodInfo.cs (1)
23public override Type DeclaringType => DeclaringTypeResult.Or(DelegatingMethod.DeclaringType)!;
System\Xaml\XamlMemberTests.cs (5)
57Assert.Equal(new XamlType(propertyInfo.DeclaringType, schemaContext), member.DeclaringType); 79Assert.Equal(new XamlType(propertyInfo.DeclaringType, schemaContext), member.DeclaringType); 113Assert.Equal(new XamlType(eventInfo.DeclaringType, schemaContext), member.DeclaringType); 135Assert.Equal(new XamlType(eventInfo.DeclaringType, schemaContext), member.DeclaringType); 2379public override Type DeclaringType => DelegatingProperty.DeclaringType!;
System\Xaml\XamlTypeTests.cs (1)
5214DeclaringTypeResult = new ReflectionOnlyType(c.Constructor.DeclaringType!)
Templates.Blazor.WebAssembly.Auth.Tests (1)
src\Shared\E2ETesting\CaptureSeleniumLogsAttribute.cs (1)
19if (!typeof(BrowserTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
Templates.Blazor.WebAssembly.Tests (1)
src\Shared\E2ETesting\CaptureSeleniumLogsAttribute.cs (1)
19if (!typeof(BrowserTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
Templates.Mvc.Tests (1)
src\Shared\E2ETesting\CaptureSeleniumLogsAttribute.cs (1)
19if (!typeof(BrowserTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
Templates.Tests (1)
src\Shared\E2ETesting\CaptureSeleniumLogsAttribute.cs (1)
19if (!typeof(BrowserTestBase).IsAssignableFrom(methodUnderTest.DeclaringType))
Test.Utilities (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
Text.Analyzers (1)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Formatting\Engine\ChainedFormattingRules.cs (1)
105key => key.type.GetRuntimeMethods().FirstOrDefault(method => method.Name == key.name)?.DeclaringType);
xunit.assert (1)
Sdk\ArgumentFormatter.cs (1)
279 if (toString != null && toString.DeclaringType != typeof(object))