Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

Default Property from a .NET object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kevin_g_frey@hotmail.com - 10 Mar 2005 03:23 GMT
Hello All,

I have an MC++ class named "Person" which encapsulates access to a
database entity and it contains a number of field properties eg. Code,
Name, Address, Suburb etc.

Each of the field properties is of type "Field", so we have eg.

__property Field* get_Code( );
__property Field* get_Name( );

etc

The Field class itself has a number of properties such as:

__property String* get_Value( );
__property bool get_IsMandatory( );

etc

My question is this:

To store a value into the "Code" field of a "Person" object I have to
write (from eg. C#):

person.Code.Value = "MyValue";

Under COM I believe it was possible to designate one property in an
object as being the "default property" and therefore the need to
reference that property explicitly disappeared. So the above example
becomes:

person.Code = "MyValue"; // NOTE: "Value" is the default property

Can someone tell me if this possible in .NET? Or perhaps more
importantly is whether this is even an accepted idiom in .NET?

I know there is the "DefaultProperty" attribute that can assigned to a
class, but that is only useful for Indexable properties (eg. an Items
container).

Thanks

Kevin
kevin_g_frey@hotmail.com - 21 Mar 2005 01:01 GMT
*Bump*. Anyone got any ideas on this?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.