Table of Contents

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

Source object

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

A object
B object

Returns

bool

AsInt()

Returns the internal value as integer, if the internal value is a number or looks like a number.

public int AsInt()

Returns

int

AsString()

Returns the internal value as string.

public string AsString()

Returns

string

Equals(object)

Determines whether a specified object is equal to this object.

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

GenId()

Creates and returns a new Guid string WITHOUT surrounding brackets, i.e. {}

public static string GenId()

Returns

string

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

UseBrackets bool

Returns

string

Get()

Returns the internal value.

public object Get()

Returns

object

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

IsEmpty()

True when is null or empty string.

public bool IsEmpty()

Returns

bool

IsEmpty(object)

Returns true when a specified Id is null or empty string.

public static bool IsEmpty(object Id)

Parameters

Id object

Returns

bool

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

Id object
Value object

Returns

bool

IsInt()

True when the internal value is int or short.

public bool IsInt()

Returns

bool

IsNull()

True when the internal value is null.

public bool IsNull()

Returns

bool

IsNumber(string)

True when a specified string value consists of digits.

public static bool IsNumber(string Value)

Parameters

Value string

Returns

bool

IsString()

True when the internal value is string.

public bool IsString()

Returns

bool

Set(object)

Sets the internal value. The source should be string, integer or short integer.

public void Set(object Source)

Parameters

Source object

ToString()

Returns a string representation of this instance.

public override string ToString()

Returns

string

Operators

operator ==(ID, ID)

Operator ==

public static bool operator ==(ID left, ID right)

Parameters

left ID
right ID

Returns

bool

implicit operator ID(short)

Implicit conversion from short and int to ID.

public static implicit operator ID(short Source)

Parameters

Source short

Returns

ID

implicit operator ID(int)

Implicit conversion from short and int to ID.

public static implicit operator ID(int Source)

Parameters

Source int

Returns

ID

implicit operator ID(string)

Implicit conversion from string, short and int to ID.

public static implicit operator ID(string Source)

Parameters

Source string

Returns

ID

implicit operator short(ID)

Implicit conversion from ID to short and int.

public static implicit operator short(ID Source)

Parameters

Source ID

Returns

short

implicit operator int(ID)

Implicit conversion from ID to short and int.

public static implicit operator int(ID Source)

Parameters

Source ID

Returns

int

implicit operator string(ID)

Implicit conversion from ID to string, short and int.

public static implicit operator string(ID Source)

Parameters

Source ID

Returns

string

operator !=(ID, ID)

Operator !=

public static bool operator !=(ID left, ID right)

Parameters

left ID
right ID

Returns

bool