Interviews8 answers
Is DateTime in C#, Value type, or Reference Type?
8 Answers
Value type
Ratnajit SinghPosted Mar 18, 2025, 2:57 AM EDT
Value Type
MehranPosted Nov 17, 2024, 9:59 AM EST
In C#,Datetime is a value type.
Md Nasir UddinPosted Jun 4, 2024, 7:40 AM EDT
In C#, the DateTime type is Value Type.
Diptiranjan SutarPosted May 28, 2024, 8:18 AM EDT
Value Type
Bhagyashri Balasaheb BhusePosted Apr 16, 2024, 2:42 AM EDT
value
vendharasiPosted Apr 8, 2024, 5:51 AM EDT
DateTime is a value type. Value types directly contain their data, and instances of value types are stored on the stack.
This means that when you work with DateTime variables, you are dealing with the actual value rather than a reference to it. Value types are copied when passed as arguments or assigned to other variables, ensuring that modifications to one instance do not affect others.
Therefore, DateTime in C# behaves like other value types such as int, float, and struct.
Jayraj ChhayaPosted Apr 8, 2024, 5:14 AM EDT
In C#, DateTime is a value type. This means that when you declare a DateTime variable, it directly contains the data of the date and time. It's not a reference to a memory location containing the data.
Alpesh ManiyaPosted Apr 8, 2024, 4:19 AM EDT




