Is it ok to create my object entities with this type of?
Public category patients {public datetime? Admission Date {Received; Set; } Public double? Get Entrance {Get; Set} public int? RoomNumber {Receive; Set}}
If I implement it in all my entities, then recently, I always face a situation where I really have to set zero value, special Form date time My existing solution was put in a datetime.minval when the database records empty data, and when I display the results to u, I see it like this.
if (Patient.AdmissionDate == Datetime.MinValue) {DisplayAdmissionDate (string.empty)} Other {DisplayAdmissionDate (patient.AdmissionDate)}
Yes, in Gridview, I have to put it into a databound event, so when I have one million data displayed, I think every loop of each datame could not be seen in the most appealing way, for this problem , I know it? Type where I can put empty values, and I'm planning to make all of my properties, so in the future, in the future, the types of values will not be problem in putting zero values. Anyone have advice? TIA
This is one of the situations where any single, hardcore answer covers all cases does not do. / Strong>
You can not always participate by using faucet types (or always avoiding them) You should think about each case and use what is actually needed.
You mentioned that you often need a null qualified date of time
So in those cases, DateTime? Why can not I use
? This should be independent ideas from all other areas, especially int
s.
The value of null
in the tapable types means that the value is something like unspecified, unavailable or unknown, where there are many situations where this concept exists (for example, any website But whether the user can specify his or her date of birth, so it should be a DateTime?
), but there are also many situations where this concept is not of any meaning (for example the number of items in the list - If The list itself is not zero, then clearly it is the number of fixed objects, so it must be int
, not int?
).
Comments
Post a Comment