Show / Hide Table of Contents

Struct Union<T1, T2>

Represents a union of two types

Implements
System.IEquatable<Union<T1, T2>>
System.IComparable
System.IComparable<Union<T1, T2>>
System.ICloneable
System.IFormattable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: ClingoSharp
Assembly: ClingoSharp.dll
Syntax
public struct Union<T1, T2> : IEquatable<Union<T1, T2>>, IComparable, IComparable<Union<T1, T2>>, ICloneable, IFormattable
Type Parameters
Name Description
T1
T2

Constructors

| Improve this Doc View Source

Union(T1)

Creates a union with T1 value.

Declaration
public Union(T1 value)
Parameters
Type Name Description
T1 value

A T1 value

| Improve this Doc View Source

Union(T2)

Creates a union with T2 value.

Declaration
public Union(T2 value)
Parameters
Type Name Description
T2 value

A T2 value

Methods

| Improve this Doc View Source

Clone()

Declaration
public object Clone()
Returns
Type Description
System.Object
| Improve this Doc View Source

CompareTo(Union<T1, T2>)

Declaration
public int CompareTo(Union<T1, T2> other)
Parameters
Type Name Description
Union<T1, T2> other
Returns
Type Description
System.Int32
Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

| Improve this Doc View Source

CompareTo(Object)

Declaration
public int CompareTo(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Int32
Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

| Improve this Doc View Source

Equals(Union<T1, T2>)

Indicates whether the current Union<T1, T2> is equal to another Union<T1, T2>.

Declaration
public bool Equals(Union<T1, T2> other)
Parameters
Type Name Description
Union<T1, T2> other

A Union<T1, T2> to compare with this object

Returns
Type Description
System.Boolean

true if the current Union<T1, T2> is equal to the other Union<T1, T2>; otherwise, false.

| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj
Returns
Type Description
System.Boolean
Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

Get(Type)

Gets a value.

Declaration
public object Get(Type type)
Parameters
Type Name Description
System.Type type

The type of the value

Returns
Type Description
System.Object

The result value

Exceptions
Type Condition
System.FieldAccessException

The union is not the type setted

| Improve this Doc View Source

Get<T>()

Gets a value.

Declaration
public T Get<T>()
Returns
Type Description
T

The result value

Type Parameters
Name Description
T

The type of the value

Exceptions
Type Condition
System.FieldAccessException

The union have not a T value

| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.ValueType.GetHashCode()
| Improve this Doc View Source

IsType(Type)

Checks if the union has the type setted.

Declaration
public bool IsType(Type type)
Parameters
Type Name Description
System.Type type

The type of the union

Returns
Type Description
System.Boolean

True if the union has the type setted, false otherwise

| Improve this Doc View Source

IsType<T>()

Checks if the union has the type setted.

Declaration
public bool IsType<T>()
Returns
Type Description
System.Boolean

True if the union has the type setted, false otherwise

Type Parameters
Name Description
T

The type of the union

| Improve this Doc View Source

Set(T1)

Sets the union as T1 value.

Declaration
public void Set(T1 value)
Parameters
Type Name Description
T1 value

A T1 value

| Improve this Doc View Source

Set(T2)

Sets the union as T2 value.

Declaration
public void Set(T2 value)
Parameters
Type Name Description
T2 value

A T2 value

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.ValueType.ToString()
| Improve this Doc View Source

ToString(String, IFormatProvider)

Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
System.String format
System.IFormatProvider formatProvider
Returns
Type Description
System.String
| Improve this Doc View Source

TryGet(Type, out Object)

Tries to get a value.

Declaration
public bool TryGet(Type type, out object value)
Parameters
Type Name Description
System.Type type

The type of the value

System.Object value

The result value

Returns
Type Description
System.Boolean

True if the union has setted the value with type type, false otherwise

| Improve this Doc View Source

TryGet<T>(out T)

Tries to get a value.

Declaration
public bool TryGet<T>(out T value)
Parameters
Type Name Description
T value

The result value

Returns
Type Description
System.Boolean

True if the union has setted the value with type type, false otherwise

Type Parameters
Name Description
T

The type of the value

Operators

| Improve this Doc View Source

Equality(Union<T1, T2>, Object)

Indicates whether the current Union<T1, T2> is equal to another Union<T1, T2>.

Declaration
public static bool operator ==(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

true if the current Union<T1, T2> is equal to the other Union<T1, T2>; otherwise, false.

| Improve this Doc View Source

GreaterThan(Union<T1, T2>, Object)

Compares the current instance with another object of the same type.

Declaration
public static bool operator>(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

true if the current instance follows the other parameter; otherwise, false

Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

| Improve this Doc View Source

GreaterThanOrEqual(Union<T1, T2>, Object)

Compares the current instance with another object of the same type.

Declaration
public static bool operator >=(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

true if the current instance follows or is equals to the other parameter; otherwise, false

Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

| Improve this Doc View Source

Implicit(T1 to Union<T1, T2>)

Converts a T1 value in a Union<T1, T2>

Declaration
public static implicit operator Union<T1, T2>(T1 value)
Parameters
Type Name Description
T1 value

The T1 value to convert in a Union<T1, T2>

Returns
Type Description
Union<T1, T2>
| Improve this Doc View Source

Implicit(T2 to Union<T1, T2>)

Converts a T2 value in a Union<T1, T2>

Declaration
public static implicit operator Union<T1, T2>(T2 value)
Parameters
Type Name Description
T2 value

The T2 value to convert in a Union<T1, T2>

Returns
Type Description
Union<T1, T2>
| Improve this Doc View Source

Implicit(Union<T1, T2> to T1)

Gets the T1 value

Declaration
public static implicit operator T1(Union<T1, T2> union)
Parameters
Type Name Description
Union<T1, T2> union

A Union<T1, T2> value

Returns
Type Description
T1
Exceptions
Type Condition
System.FieldAccessException

The union have not a T1 value

| Improve this Doc View Source

Implicit(Union<T1, T2> to T2)

Gets the T2 value

Declaration
public static implicit operator T2(Union<T1, T2> union)
Parameters
Type Name Description
Union<T1, T2> union

A Union<T1, T2> value

Returns
Type Description
T2
Exceptions
Type Condition
System.FieldAccessException

The union have not a T2 value

| Improve this Doc View Source

Inequality(Union<T1, T2>, Object)

Indicates whether the current object is not equal to another object of the same type.

Declaration
public static bool operator !=(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

false if the current object is equal to the other parameter; otherwise, true.

| Improve this Doc View Source

LessThan(Union<T1, T2>, Object)

Compares the current instance with another object of the same type.

Declaration
public static bool operator <(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

true if the current instance precedes the other parameter; otherwise, false

Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

| Improve this Doc View Source

LessThanOrEqual(Union<T1, T2>, Object)

Compares the current instance with another object of the same type.

Declaration
public static bool operator <=(Union<T1, T2> union, object other)
Parameters
Type Name Description
Union<T1, T2> union

The Union<T1, T2> value

System.Object other

An object to compare with

Returns
Type Description
System.Boolean

true if the current instance precedes or is equals to the other parameter; otherwise, false

Exceptions
Type Condition
System.InvalidOperationException

if the Union<T1, T2> is not comparable

Implements

System.IEquatable<T>
System.IComparable
System.IComparable<T>
System.ICloneable
System.IFormattable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX