When trying to perform the following cast
DateTime issueDate = Convert.ToDateTime(binfile.ReadByte());
(reading .dat files by the way) I get a run time error saying, “Invalid cast from byte to DateTime”
Not sure why I am getting this error, nor how to fix it.
When I use the same approach with a string it works fine,
string firstName = Convert.ToString(binfile.ReadByte());
Thanks for any help.
You can’t convert the byte to DateTime. If the dt value is stored as ticks then the code should be