L
lavu
I have a struct that I am creating an object for but not initializing
it. Later on under certain conditions it gets
set to the values of another struct. However I have to check this
struct for an valid instance and sometimes it is
not a valid instance and gives an exception. Since I cannot use a null
for a value type how would I check for the
validity of the object.
For example:
one.cs contains
------------------------
in a loop :
{
myObject firstInstance;
if firstInstance is valid then
do...something.
setvals ();
}
second.cs contains:
------------------------------
setvals()
{
firstInstance = validInstance;
}
it. Later on under certain conditions it gets
set to the values of another struct. However I have to check this
struct for an valid instance and sometimes it is
not a valid instance and gives an exception. Since I cannot use a null
for a value type how would I check for the
validity of the object.
For example:
one.cs contains
------------------------
in a loop :
{
myObject firstInstance;
if firstInstance is valid then
do...something.
setvals ();
}
second.cs contains:
------------------------------
setvals()
{
firstInstance = validInstance;
}