diff --git a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj index ab0a4b06a96bbb..01374000ff463a 100644 --- a/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj +++ b/src/libraries/System.Reflection.Context/src/System.Reflection.Context.csproj @@ -2,7 +2,6 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.1;netstandard2.0 - false true true true diff --git a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs index eee744a706b38f..29c939e7821743 100644 --- a/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs +++ b/src/libraries/System.Reflection.Context/src/System/Reflection/Context/CustomReflectionContext.cs @@ -14,12 +14,25 @@ internal sealed class IdentityReflectionContext : ReflectionContext public override TypeInfo MapType(TypeInfo type) { return type; } } + /// + /// Represents a customizable reflection context. + /// + /// + /// For more information about this API, see CustomReflectionContext. + /// public abstract partial class CustomReflectionContext : ReflectionContext { private readonly ReflectionContextProjector _projector; + /// + /// Initializes a new instance of the class. + /// protected CustomReflectionContext() : this(new IdentityReflectionContext()) { } + /// + /// Initializes a new instance of the class with the specified reflection context as a base. + /// + /// The reflection context to use as a base. protected CustomReflectionContext(ReflectionContext source) { ArgumentNullException.ThrowIfNull(source); @@ -28,6 +41,11 @@ protected CustomReflectionContext(ReflectionContext source) _projector = new ReflectionContextProjector(this); } + /// + /// Gets the representation, in this reflection context, of an assembly that is represented by an object from another reflection context. + /// + /// The external representation of the assembly to represent in this context. + /// The representation of the assembly in this reflection context. public override Assembly MapAssembly(Assembly assembly) { ArgumentNullException.ThrowIfNull(assembly); @@ -35,6 +53,11 @@ public override Assembly MapAssembly(Assembly assembly) return _projector.ProjectAssemblyIfNeeded(assembly); } + /// + /// Gets the representation, in this reflection context, of a type represented by an object from another reflection context. + /// + /// The external representation of the type to represent in this context. + /// The representation of the type in this reflection context. public override TypeInfo MapType(TypeInfo type) { ArgumentNullException.ThrowIfNull(type); @@ -42,23 +65,54 @@ public override TypeInfo MapType(TypeInfo type) return _projector.ProjectTypeIfNeeded(type); } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified member, as represented in this reflection context. + /// + /// The member whose custom attributes will be returned. + /// A collection of the member's attributes in its current context. + /// A collection that represents the custom attributes of the specified member in this reflection context. protected virtual IEnumerable GetCustomAttributes(MemberInfo member, IEnumerable declaredAttributes) { return declaredAttributes; } + /// + /// When overridden in a derived class, provides a list of custom attributes for the specified parameter, as represented in this reflection context. + /// + /// The parameter whose custom attributes will be returned. + /// A collection of the parameter's attributes in its current context. + /// A collection that represents the custom attributes of the specified parameter in this reflection context. protected virtual IEnumerable GetCustomAttributes(ParameterInfo parameter, IEnumerable declaredAttributes) { return declaredAttributes; } // The default implementation of GetProperties: just return an empty list. + /// + /// When overridden in a derived class, provides a collection of additional properties for the specified type, as represented in this reflection context. + /// + /// The type to add properties to. + /// A collection of additional properties for the specified type. + /// + /// Override this method to specify which properties should be added to a given type. To create the properties, use the method. + /// protected virtual IEnumerable AddProperties(Type type) { // return an empty enumeration yield break; } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name, @@ -76,6 +130,20 @@ protected PropertyInfo CreateProperty( this); } + /// + /// Creates an object that represents a property to be added to a type, to be used with the method and using the specified custom attributes. + /// + /// The type of the property to create. + /// The name of the property to create. + /// An object that represents the property's accessor. + /// An object that represents the property's accessor. + /// A collection of custom attributes to apply to the property. + /// A collection of custom attributes to apply to the property's accessor. + /// A collection of custom attributes to apply to the property's accessor. + /// An object that represents the property. + /// + /// Objects that are returned by this method are not complete objects, and should be used only in the context of the method. + /// protected PropertyInfo CreateProperty( Type propertyType, string name,