Struct ID
- Namespace
- Tripous
- Assembly
- Tripous.dll
A type to be used with Ids when the exact type is not known.
[JsonConverter(typeof(IDJsonConverter))]
public struct ID
- Inherited Members
- Extension Methods
Constructors
ID()
Constructor.
public ID()
ID(object)
Constructor.
public ID(object Source)
Parameters
Sourceobject
Methods
AreEqual(object, object)
Returns true if two specified Ids are equal.
The specified Ids can be of any integer type or string.
String Ids are compared case-sensitively.
public static bool AreEqual(object A, object B)
Parameters
Returns
AsInt()
Returns the internal value as integer, if the internal value is a number or looks like a number.
public int AsInt()
Returns
AsString()
Returns the internal value as string.
public string AsString()
Returns
Equals(object)
Determines whether a specified object is equal to this object.
public override bool Equals(object obj)
Parameters
objobject
Returns
GenId()
Creates and returns a new Guid string WITHOUT surrounding brackets, i.e. {}
public static string GenId()
Returns
GenId(bool)
Creates and returns a new Guid string.
If UseBrackets is true, the new guid is surrounded by {}
public static string GenId(bool UseBrackets)
Parameters
UseBracketsbool
Returns
Get()
Returns the internal value.
public object Get()
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
IsEmpty()
True when is null or empty string.
public bool IsEmpty()
Returns
IsEmpty(object)
Returns true when a specified Id is null or empty string.
public static bool IsEmpty(object Id)
Parameters
Idobject
Returns
IsEmptyOrValue(object, object)
Returns true if a specified object Id is null, empty string, or equals to a value, such as the -
public static bool IsEmptyOrValue(object Id, object Value)
Parameters
Returns
IsInt()
True when the internal value is int or short.
public bool IsInt()
Returns
IsNull()
True when the internal value is null.
public bool IsNull()
Returns
IsNumber(string)
True when a specified string value consists of digits.
public static bool IsNumber(string Value)
Parameters
Valuestring
Returns
IsString()
True when the internal value is string.
public bool IsString()
Returns
Set(object)
Sets the internal value. The source should be string, integer or short integer.
public void Set(object Source)
Parameters
Sourceobject
ToString()
Returns a string representation of this instance.
public override string ToString()
Returns
Operators
operator ==(ID, ID)
Operator ==
public static bool operator ==(ID left, ID right)
Parameters
Returns
implicit operator ID(short)
Implicit conversion from short and int to ID.
public static implicit operator ID(short Source)
Parameters
Sourceshort
Returns
implicit operator ID(int)
Implicit conversion from short and int to ID.
public static implicit operator ID(int Source)
Parameters
Sourceint
Returns
implicit operator ID(string)
Implicit conversion from string, short and int to ID.
public static implicit operator ID(string Source)
Parameters
Sourcestring
Returns
implicit operator short(ID)
Implicit conversion from ID to short and int.
public static implicit operator short(ID Source)
Parameters
SourceID
Returns
implicit operator int(ID)
Implicit conversion from ID to short and int.
public static implicit operator int(ID Source)
Parameters
SourceID
Returns
implicit operator string(ID)
Implicit conversion from ID to string, short and int.
public static implicit operator string(ID Source)
Parameters
SourceID
Returns
operator !=(ID, ID)
Operator !=
public static bool operator !=(ID left, ID right)