I recently read some text indicating the reasons that C# doesn't support overloaded properties. I also tried this in Whidbey Beta 1 and it remains the case. However, i am a little more interested in why this is and what people think about it. To be specific, the following will not compile :
public string Author
{
set {_author = value;}
get {return _author;}
}
public AuthorEntity Author
{
set {_authorEntity = value;}
get {return _authorEntity;}
}
Why would you ever want to do this? Well, in my case, there are occassions in the "Book" class where the user may wish to define the author as a primitive string such as "Steven Livingstone". However, there are other cases where people want to declare that the author is the *Author* (derived from Person) who has the name "Steven Livingstone" - allowing them to further populate the Author class.
So i would like to say:
MyBook.Author = "Steven Livingstone"
or
MyBook.Author = MyPerson;
... and let the compiler figure out which it is using, in much the same way as overloaded methods work.
The ability to overload properties is pretty fundamental to the way of thinking i have for a project i am working on just now and so further suggestions would be appreciated. I could just always use the Author class, but that is an overkill for times when only the name of the author is to be set. I guess i could use SetAuthor() and GetAuthor() and overload these methods to accept the string and Author parameters - just not as nice as using properties directly.
steven