How to initialize a DateTime field?

前端 未结 9 1232
Happy的楠姐
Happy的楠姐 2020-12-06 04:01

I am absolutly new in C# (I came from Java) and I have a very stupid problem

I have to initialize some DateTime fields into an object but I have som

9条回答
  •  春和景丽
    2020-12-06 04:59

    Both are same....

    1

    mySmallVuln.Published = new DateTime(1998,04,30,0,0,0);
    mySmallVuln.LastUpdated = new DateTime(2007,11,05,0,0,0);
    

    2

    mySmallVuln.Published = new DateTime(1998,04,30);
    mySmallVuln.LastUpdated = new DateTime(2007,11,05);
    

    in the first method you can assign hour minute and second respectively in parameter at the last three parameter.

提交回复
热议问题