Closed
Description
With Abstract System.Reflection.Emit public types we have abstracted other System.Reflection.Emit.XyzBuilder
types, ParameterBuilder
type left out from this effort (probably because it lives in different ref file).
The type also needs to be abstracted same as others because:
- Because of internal constructor could not create an instance of it outside of CoreLib. (The new
AsemblyBuilder
implementation will be added outside of CoreLib) - Even if we workaround the internal constructor we could not get
CustomAttributes
info set to theParameterBuilder
instance, same for the default value.
Suggested API change:
namespace System.Reflection.Emit
{
- public class ParameterBuilder
+ public abstract class ParameterBuilder
{
- internal ParameterBuilder() { }
+ protected ParameterBuilder() { }
public virtual int Attributes { get { throw null; } }
public bool IsIn { get { throw null; } }
public bool IsOptional { get { throw null; } }
public bool IsOut { get { throw null; } }
public virtual string? Name { get { throw null; } }
public virtual int Position { get { throw null; } }
public virtual void SetConstant(object? defaultValue) { }
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute) { }
+ protected abstract void SetCustomAttributeCore(ConstructorInfo con, byte[] binaryAttribute);
public void SetCustomAttribute(CustomAttributeBuilder customBuilder) { }
}
}