Details needed

R

Raj

using System.Runtime.CompilerServices;

namespace System
{
// Summary:
// Represents an object whose underlying type is a value type, but
can also
// be assigned null like a reference type.
[Serializable]
public struct Nullable<T> where T : struct
{
//
// Summary:
// Initializes a new instance of the System.Nullable<T>
structure to the specified
// value.
//
// Parameters:
// value:
// A value type.
public Nullable(T value);

public static explicit operator T(T? value);
public static implicit operator T?(T value);

// Summary:
// Gets a value indicating whether the current
System.Nullable<T> object has
// a value.
//
// Returns:
// true if the current System.Nullable<T> object has a value;
false if the current
// System.Nullable<T> object has no value.
public bool HasValue { get; }
//
// Summary:
// Gets the value of the current System.Nullable<T> value.
//
// Returns:
// The value of the current System.Nullable<T> object if the
System.Nullable<T>.HasValue
// property is true. An exception is thrown if the
System.Nullable<T>.HasValue
// property is false.
//
// Exceptions:
// System.InvalidOperationException:
// The System.Nullable<T>.HasValue property is false.
public T Value { get; }

// Summary:
// Indicates whether the current System.Nullable<T> value is
equal to a specified
// object.
//
// Parameters:
// other:
// An object.
//
// Returns:
// true if the other parameter is equal to the current
System.Nullable<T> value;
// otherwise, false.This table describes how equality is defined
for the compared
// values: Return ValueDescriptiontrueThe other parameter is a
System.Nullable<T>
// value, and the System.Nullable<T>.HasValue properties for the
compared values
// are false. -or-The other parameter is a System.Nullable<T>
value, the System.Nullable<T>.HasValue
// properties for the compared values are true, and the
System.Nullable<T>.Value
// properties of the compared values are equal.falseThe other
parameter is not
// a System.Nullable<T> value. -or-The other parameter is a
System.Nullable<T>
// value, and the System.Nullable<T>.HasValue property is true
for one compared
// value and false for the other compared value. -or-The other
parameter is
// a System.Nullable<T> value, the System.Nullable<T>.HasValue
properties for
// the two compared values are true, and the
System.Nullable<T>.Value properties
// of the compared values are unequal.
public override bool Equals(object other);
//
// Summary:
// Retrieves the hash code of the object returned by the
System.Nullable<T>.Value
// property.
//
// Returns:
// The hash code of the object returned by the
System.Nullable<T>.Value property
// if the System.Nullable<T>.HasValue property is true, or zero
if the System.Nullable<T>.HasValue
// property is false.
public override int GetHashCode();
//
// Summary:
// Retrieves the value of the current System.Nullable<T> object,
or the object's
// default value.
//
// Returns:
// The value of the System.Nullable<T>.Value property if the
System.Nullable<T>.HasValue
// property is true; otherwise, the default value of the current
System.Nullable<T>
// object. The type of the default value is the type argument of
the current
// System.Nullable<T> object, and the value of the default value
consists solely
// of binary zeroes.
public T GetValueOrDefault();
//
// Summary:
// Retrieves the value of the current System.Nullable<T> object,
or the specified
// default value.
//
// Parameters:
// defaultValue:
// A value to return if the System.Nullable<T>.HasValue property
is false.
//
// Returns:
// The value of the System.Nullable<T>.Value property if the
System.Nullable<T>.HasValue
// property is true; otherwise, the defaultValue parameter.
public T GetValueOrDefault(T defaultValue);
//
// Summary:
// Returns the text representation of the value of the current
System.Nullable<T>
// object.
//
// Returns:
// The text representation of the value of the current
System.Nullable<T> object
// if the System.Nullable<T>.HasValue property is true, or an
empty string ("")
// if the System.Nullable<T>.HasValue property is false.
public override string ToString();
}
}

Need details on these two particularly:
public static explicit operator T(T? value);
public static implicit operator T?(T value);

Thank you

Regards
Raj
 
F

Family Tree Mike

Need details on these two particularly:
public static explicit operator T(T? value);
public static implicit operator T?(T value);

Thank you

Regards
Raj

This is actually a case where it appears the question did _not_ need all
the code you posted. See my answer in the post titled "Difference
between nullable class and nullable<> structure".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top