|
-
Feb 7th, 2011, 02:50 AM
#1
Thread Starter
Hyperactive Member
DefaultValue Attribute
Thought I found a very usefull attribute this morning that would eliminate the need to set class member defaults in the constructor, nl. the DefaultValueAttribute Class
However when using it I found that my booleans still are set to "false" when I create a class instance, even though I decorated the member with a # [DefaultValue(true)]
Someone pointed out the following in the documentation, which explains that:
A DefaultValueAttribute will not cause a member to be automatically initialized with the attribute's value. You must set the initial value in your code.
Don't make sense...what is the use of this attribute then?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|