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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top