-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make ParameterBuilder abstract #83831
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsWith Abstract System.Reflection.Emit public types we have abstracted other The type also needs to be abstracted same as others because:
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) { }
}
}
|
How about we seize the opportunity and make |
Internal implementation currently works with byte[], of course we could refactor that, I think that is better handled by #63419 with all other types custom attributes handling (looks all of them handled similarly). |
namespace System.Reflection.Emit;
-public class ParameterBuilder
+public abstract class ParameterBuilder
{
- internal ParameterBuilder();
+ protected ParameterBuilder();
public virtual int Attributes { get; }
public bool IsIn { get; }
public bool IsOptional { get; }
public bool IsOut { get; }
public virtual string? Name { get; }
public virtual int Position { get; }
public virtual void SetConstant(object? defaultValue);
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute);
+ protected abstract void SetCustomAttributeCore(ConstructorInfo con, ReadOnlySpan<byte> binaryAttribute);
public void SetCustomAttribute(CustomAttributeBuilder customBuilder);
} |
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:
AsemblyBuilder
implementation will be added outside of CoreLib)CustomAttributes
info set to theParameterBuilder
instance, same for the default value.Suggested API change:
The text was updated successfully, but these errors were encountered: