G
Guest
Hi.
How does one assign a custom parameter attribute to the implicit "value" parameter of the set accessor method of a property? For example, I can assign a custom attribute to the return parameter of the get accessor as follows:
public string Foo
{
[return: MyAttribute]
get
{
return "foo";
}
set
{
m_foo = value;
}
}
Likewise, I can assign attributes to method parameters, as follows:
public void set_Foo([MyAttribute] string value)
{
m_foo = value;
}
I know how to do this with Reflection.Emit by explicitly assigning the attribute to the set_Foo(string value) method. But how can I do it directly in the C# source? Thank you for your help.
Regards,
- Ben Blair
{my name} {at} acm.org
How does one assign a custom parameter attribute to the implicit "value" parameter of the set accessor method of a property? For example, I can assign a custom attribute to the return parameter of the get accessor as follows:
public string Foo
{
[return: MyAttribute]
get
{
return "foo";
}
set
{
m_foo = value;
}
}
Likewise, I can assign attributes to method parameters, as follows:
public void set_Foo([MyAttribute] string value)
{
m_foo = value;
}
I know how to do this with Reflection.Emit by explicitly assigning the attribute to the set_Foo(string value) method. But how can I do it directly in the C# source? Thank you for your help.
Regards,
- Ben Blair
{my name} {at} acm.org