Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 999353c

Browse files
committed
Exposing ISerializable implementation in System.DateTime
1 parent 519d7d6 commit 999353c

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/mscorlib/src/System/DateTime.cs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,8 @@ namespace System {
5252
//
5353
//
5454
[StructLayout(LayoutKind.Auto)]
55-
#if FEATURE_SERIALIZATION
5655
[Serializable]
57-
#endif
58-
public struct DateTime : IComparable, IFormattable, IConvertible, IComparable<DateTime>, IEquatable<DateTime>
59-
#if FEATURE_SERIALIZATION
60-
, ISerializable
61-
#endif
56+
public struct DateTime : IComparable, IFormattable, IConvertible, IComparable<DateTime>, IEquatable<DateTime>, ISerializable
6257
{
6358

6459
// Number of 100ns ticks per time unit
@@ -676,8 +671,7 @@ public static DateTime FromFileTimeUtc(long fileTime) {
676671
public static DateTime FromOADate(double d) {
677672
return new DateTime(DoubleDateToTicks(d), DateTimeKind.Unspecified);
678673
}
679-
680-
#if FEATURE_SERIALIZATION
674+
681675
[System.Security.SecurityCritical /*auto-generated_required*/]
682676
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
683677
if (info==null) {
@@ -688,8 +682,7 @@ void ISerializable.GetObjectData(SerializationInfo info, StreamingContext contex
688682
// Serialize both the old and the new format
689683
info.AddValue(TicksField, InternalTicks);
690684
info.AddValue(DateDataField, dateData);
691-
}
692-
#endif
685+
}
693686

694687
public Boolean IsDaylightSavingTime() {
695688
if (Kind == DateTimeKind.Utc) {

0 commit comments

Comments
 (0)