How to copy datetime content from System.ValueType to DateTimevariable

  • Thread starter Thread starter Veeranna Ronad
  • Start date Start date
V

Veeranna Ronad

Hello,

Our application gets datetime from an interface function. This
function returns "ValueType". How to copy datetime content from this
"ValueType" to DateTime variable?

Thanks in advance and regards,
Veeranna Ronad.
 
Veeranna Ronad said:
Hello,

Our application gets datetime from an interface function. This
function returns "ValueType". How to copy datetime content from this
"ValueType" to DateTime variable?

Thanks in advance and regards,
Veeranna Ronad.

Hi Veeranna,

A direct cast should work, although I can't imagine why you would return a
the date as "ValueType".

public ValueType GetDate()
{
return DateTime.Now;
}

....

DateTime dt = (DateTime)GetDate();
 
Our application gets datetime from an interface function. This
function returns "ValueType".

Okay, now I'm curious. Can anyone give me a good example of when you would
actually want to return ValueType from a function?
 
Back
Top