Struct ReleaseDate
Represents game release date.
[Serializable]
public struct ReleaseDate : IComparable, IComparable<ReleaseDate>, IEquatable<ReleaseDate>, ISerializable
- Implements
- Inherited Members
Constructors
ReleaseDate(DateTime)
Creates new instance of ReleaseDate.
public ReleaseDate(DateTime dateTime)
Parameters
dateTimeDateTime
ReleaseDate(int)
Creates new instance of ReleaseDate.
public ReleaseDate(int year)
Parameters
yearint
ReleaseDate(int, int)
Creates new instance of ReleaseDate.
public ReleaseDate(int year, int month)
Parameters
ReleaseDate(int, int, int)
Creates new instance of ReleaseDate.
public ReleaseDate(int year, int month, int day)
Parameters
ReleaseDate(SerializationInfo, StreamingContext)
Creates new instance of ReleaseDate.
public ReleaseDate(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfocontextStreamingContext
Fields
Date
Gets DateTime representation of release date.
public readonly DateTime Date
Field Value
Empty
Gets empty representation of release date.
public static readonly ReleaseDate Empty
Field Value
Properties
Day
Gets release day.
public int? Day { get; }
Property Value
- int?
Month
Gets release month.
public int? Month { get; }
Property Value
- int?
Year
Gets release year.
public int Year { get; }
Property Value
Methods
CompareTo(ReleaseDate)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(ReleaseDate other)
Parameters
otherReleaseDateAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes
otherin the sort order. Zero This instance occurs in the same position in the sort order asother. Greater than zero This instance followsotherin the sort order.
CompareTo(object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object obj)
Parameters
objobjectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance precedes
objin the sort order. Zero This instance occurs in the same position in the sort order asobj. Greater than zero This instance followsobjin the sort order.
Exceptions
- ArgumentException
objis not the same type as this instance.
Deserialize(string)
Deserialize string to release date.
public static ReleaseDate Deserialize(string stringDate)
Parameters
stringDatestring
Returns
Equals(ReleaseDate)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ReleaseDate other)
Parameters
otherReleaseDateAn object to compare with this object.
Returns
- bool
true if the current object is equal to the
otherparameter; otherwise, false.
Equals(object)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo with the data needed to serialize the target object.
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoThe SerializationInfo to populate with data.
contextStreamingContextThe destination (see StreamingContext) for this serialization.
Exceptions
- SecurityException
The caller does not have the required permission.
Serialize()
Gets release date serialized to a string.
public string Serialize()
Returns
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.
TryDeserialize(string, out ReleaseDate)
Try to deserialize string to a release date.
public static bool TryDeserialize(string stringDate, out ReleaseDate date)
Parameters
stringDatestringdateReleaseDate
Returns
Operators
operator ==(ReleaseDate, ReleaseDate)
public static bool operator ==(ReleaseDate obj1, ReleaseDate obj2)
Parameters
obj1ReleaseDateobj2ReleaseDate
Returns
operator !=(ReleaseDate, ReleaseDate)
public static bool operator !=(ReleaseDate obj1, ReleaseDate obj2)
Parameters
obj1ReleaseDateobj2ReleaseDate