Why do I lose the milliseconds of a DateTime when it is passed to a method that takes a Nullable DateTime?

I have a constructor method similar to this:

public class Foo
{
 public Foo (DateTime? startFrom)
        {
            _startFrom = startFrom;
        }
}

And I call this constructor method as follows:

   var context = new Foo(new DateTime(2012, 7, 15, 11, 2, 10, 2)); // 2 miliseconds

But when I debug it, I found that 002 milliseconds was set to 000 when passed to the default constructor, which is the Nullable DateTime parameter.

Is it normal that I lose milliseconds of DateTime when I pass it as a parameter to a method that takes a Nullable DateTime value?

+5
source share
3 answers

No, this is not normal - and I strongly suspect that this is a diagnostic problem.

, , , . , , , .

( , , , , , , .)

+4

, . ?

context._startFrom.Millisecond, 2.

ToString()? .

+1

, , , Debug , .

VS2010 , . 2!

0
source

All Articles