/// <summary> /// Returns a <see cref="System.String"/> that represents this instance. /// </summary> /// <returns>A <see cref="System.String"/> that represents this instance.</returns> public override string ToString() { if (!Equals(Response, typeof(T).GetDefault())) { return(Response.ToString()); } if (TedsNonResponse != null) { return(TedsNonResponse.ToString()); } return("-"); }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { int hash = 0; if (!Equals(Response, typeof(T).GetDefault())) { hash ^= Response.GetHashCode(); } else if (TedsNonResponse != null) { hash ^= TedsNonResponse.GetHashCode(); } return(hash); }
/// <summary> /// Initializes a new instance of the <see cref="TedsAnswer<T>"/> class. /// </summary> /// <param name="tedsNonResponse">The teds non response.</param> public TedsAnswer(TedsNonResponse tedsNonResponse) { Check.IsNotNull(tedsNonResponse, "TedsNonResponse cannot equal null."); _tedsNonResponse = tedsNonResponse; _response = (T)typeof(T).GetDefault(); }
/// <summary> /// Initializes a new instance of the <see cref="TedsAnswer<T>"/> class. /// </summary> /// <param name="response">The response.</param> public TedsAnswer(T response) { Check.IsNotNull(response, "Response cannot be null."); _response = response; _tedsNonResponse = null; }