// // Return all declared methods whose name matches "optionalNameFilter". If optionalNameFilter is null, return them all. // internal IEnumerable <RuntimeMethodInfo> GetDeclaredMethodsInternal(RuntimeNamedTypeInfo definingType, String optionalNameFilter) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); MetadataReader reader = definingType.Reader; foreach (MethodHandle methodHandle in definingType.DeclaredMethodAndConstructorHandles) { Method method = methodHandle.GetMethod(reader); if ((optionalNameFilter != null) && !method.Name.StringEquals(optionalNameFilter, reader)) { continue; } if (MetadataReaderExtensions.IsConstructor(ref method, reader)) { continue; } yield return(RuntimeNamedMethodInfo.GetRuntimeNamedMethodInfo(methodHandle, definingType, this)); } } foreach (RuntimeMethodInfo syntheticMethod in SyntheticMethods) { if (optionalNameFilter == null || optionalNameFilter == syntheticMethod.Name) { yield return(syntheticMethod); } } }
// // Return all declared properties whose name matches "optionalNameFilter". If optionalNameFilter is null, return them all. // internal IEnumerable <RuntimePropertyInfo> GetDeclaredPropertiesInternal(RuntimeNamedTypeInfo definingType, String optionalNameFilter) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); MetadataReader reader = definingType.Reader; foreach (PropertyHandle propertyHandle in definingType.DeclaredPropertyHandles) { if (optionalNameFilter == null || propertyHandle.GetProperty(reader).Name.StringEquals(optionalNameFilter, reader)) { yield return(RuntimePropertyInfo.GetRuntimePropertyInfo(propertyHandle, definingType, this)); } } } }
// // Return all declared constructors. // private IEnumerable <RuntimeConstructorInfo> GetDeclaredConstructorsInternal(RuntimeNamedTypeInfo definingType) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); RuntimeTypeInfo contextType = this; foreach (MethodHandle methodHandle in definingType.DeclaredConstructorHandles) { yield return(RuntimePlainConstructorInfo.GetRuntimePlainConstructorInfo(methodHandle, definingType, contextType)); } } foreach (RuntimeConstructorInfo syntheticConstructor in SyntheticConstructors) { yield return(syntheticConstructor); } }
// // Return all declared constructors. // private IEnumerable<RuntimeConstructorInfo> GetDeclaredConstructorsInternal(RuntimeNamedTypeInfo definingType) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); RuntimeTypeInfo contextType = this; foreach (MethodHandle methodHandle in definingType.DeclaredConstructorHandles) { yield return RuntimePlainConstructorInfo.GetRuntimePlainConstructorInfo(methodHandle, definingType, contextType); } } foreach (RuntimeConstructorInfo syntheticConstructor in SyntheticConstructors) { yield return syntheticConstructor; } }
// // Return all declared properties whose name matches "optionalNameFilter". If optionalNameFilter is null, return them all. // internal IEnumerable<RuntimePropertyInfo> GetDeclaredPropertiesInternal(RuntimeNamedTypeInfo definingType, String optionalNameFilter) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); MetadataReader reader = definingType.Reader; foreach (PropertyHandle propertyHandle in definingType.DeclaredPropertyHandles) { if (optionalNameFilter == null || propertyHandle.GetProperty(reader).Name.StringEquals(optionalNameFilter, reader)) yield return RuntimePropertyInfo.GetRuntimePropertyInfo(propertyHandle, definingType, this); } } }
// // Return all declared methods whose name matches "optionalNameFilter". If optionalNameFilter is null, return them all. // internal IEnumerable<RuntimeMethodInfo> GetDeclaredMethodsInternal(RuntimeNamedTypeInfo definingType, String optionalNameFilter) { if (definingType != null) { // We require the caller to pass a value that we could calculate ourselves because we're an iterator and we // don't want any MissingMetadataException that AnchoringType throws to be deferred. Debug.Assert(definingType.Equals(this.AnchoringTypeDefinitionForDeclaredMembers)); MetadataReader reader = definingType.Reader; foreach (MethodHandle methodHandle in definingType.DeclaredMethodAndConstructorHandles) { Method method = methodHandle.GetMethod(reader); if ((optionalNameFilter != null) && !method.Name.StringEquals(optionalNameFilter, reader)) continue; if (MetadataReaderExtensions.IsConstructor(ref method, reader)) continue; yield return RuntimeNamedMethodInfo.GetRuntimeNamedMethodInfo(methodHandle, definingType, this); } } foreach (RuntimeMethodInfo syntheticMethod in SyntheticMethods) { if (optionalNameFilter == null || optionalNameFilter == syntheticMethod.Name) { yield return syntheticMethod; } } }