Hi there,
I am not sure what you asking or suggesting. The Bug class *does* instantiate new NameVaulue objects in its Private Variables region:
...
Private _frequency As NameValue = New NameValue
Private _status As NameValue = New NameValue
Private _createdDateAndTime As DateTime = DateTime.MinValue
...
So, whenever you New up a Bug, fields like _status already contain a valid NameValue instance and you can directly set the Name and Value properties if you want to.
When I load the data, I do this:
theBug.Status = New NameValue(myReader.GetInt32(myReader.GetOrdinal("S tatusId")), _
myReader.GetString(myReader.GetOrdinal("StatusDesc ription")))
I effectively overwrite the existing Status NameValue instance. IMO, this is easier to read and code than setting individual fields on the Status instance (which would work fine as the Bug already has valid NameValue instances:
theBug.Status.Value = myReader.GetInt32(myReader.GetOrdinal("StatusId"))
theBug.Status.Name = myReader.GetString(myReader.GetOrdinal("StatusDesc ription"))
Both code examples would result in the same Status instance.
Does that help?
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
Beginning ASP.NET 3.5 : in C# and VB,
ASP.NET 2.0 Instant Results and
Dreamweaver MX 2004
Want to be my colleague? Then check out this post.