471,596 Members | 1,154 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

Allows CLR more than 2 accessors for a property?

Does the clr allow more than one set and one get method for a property? Is
it possible to use overloading for example set_Color(int c), set_Color(Color
c)?

from msdn:

PropertyInfo.GetAccessors Method ()

Return Value
An array of MethodInfo objects that reflect the public get, set, *and other
accessors* of the property reflected by the current instance, if found;
otherwise, this method returns an array with zero (0) elements.

what is meant with "other accessors" here?
Jul 21 '05 #1
2 1630
> Does the clr allow more than one set and one get method for a property? Is
it possible to use overloading for example set_Color(int c),
set_Color(Color
c)? Not possible, there will always be only one setter for the same property
with one argument this is because when you overload a property you need two
different signatures (does not include return type).

what is meant with "other accessors" here? No idea but if you look at the documentation for C# there are not other
modifiers.

Gabriel Lozano-Morán
"cody" <de********@gmx.de> wrote in message
news:e%****************@TK2MSFTNGP14.phx.gbl... Does the clr allow more than one set and one get method for a property? Is
it possible to use overloading for example set_Color(int c),
set_Color(Color
c)?

from msdn:

PropertyInfo.GetAccessors Method ()

Return Value
An array of MethodInfo objects that reflect the public get, set, *and
other
accessors* of the property reflected by the current instance, if found;
otherwise, this method returns an array with zero (0) elements.

what is meant with "other accessors" here?

Jul 21 '05 #2
Does the clr allow more than one set and one get method for a property?
No

Is
it possible to use overloading for example set_Color(int c), set_Color(Color
c)?
Yes, but only one of those method can be the setter.

what is meant with "other accessors" here?


In languages that allow it, such as ILAsm, you can associate an
arbitrary number of other methods to a property. But there's still at
most one getter and one setter.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Mike P | last post: by
6 posts views Thread by steveevets | last post: by
5 posts views Thread by Ahmad Jalil Qarshi | last post: by
112 posts views Thread by mystilleef | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.