Class ColumnIdentifier
Identifies a particular column, either by index or index and name.
A ColumnIdentifier is only valid for as long as the values used to construct it. Accordingly, you should be careful when storing ColumnIdentifiers that you did not create yourself as they may have been created with ReadOnlyMemory(char)s whose lifetime you do not control.
Inheritance
Implements
Namespace: Cesil
Assembly: Cesil.dll
Syntax
public sealed class ColumnIdentifier : ValueType, IEquatable<ColumnIdentifier>
Properties
HasName
Whether this column has a known name.
Declaration
public bool HasName { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Index
Index of the column, base-0.
Declaration
public int Index { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Name
The name of the column, as a string.
Easier to work with than NameMemory, but this may allocate.
If HasName is false, this will throw an exception.
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
NameMemory
The name of the column, as a block of memory.
More awkward to work with than Name, but will not allocate.
If HasName is false, this will throw an exception.
Declaration
public ReadOnlyMemory<char> NameMemory { get; }
Property Value
Type | Description |
---|---|
System.ReadOnlyMemory<System.Char> |
Methods
Create(Int32)
Create a ColumnIdentifier for the given index.
Declaration
public static ColumnIdentifier Create(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type | Description |
---|---|
ColumnIdentifier |
Create(Int32, ReadOnlyMemory<Char>)
Create a ColumnIdentifier for the given index and name.
Declaration
public static ColumnIdentifier Create(int index, ReadOnlyMemory<char> name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.ReadOnlyMemory<System.Char> | name |
Returns
Type | Description |
---|---|
ColumnIdentifier |
Create(Int32, String)
Create a ColumnIdentifier for the given index and name.
Declaration
public static ColumnIdentifier Create(int index, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | |
System.String | name |
Returns
Type | Description |
---|---|
ColumnIdentifier |
Equals(ColumnIdentifier)
Returns true if the given object is equivalent to this one
Declaration
public bool Equals(ColumnIdentifier column)
Parameters
Type | Name | Description |
---|---|---|
ColumnIdentifier | column |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Returns true if the given object is equivalent to this one
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
GetHashCode()
Returns a stable hash for this ColumnIdentifier.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
ToString()
Describes this ColumnIdentifier.
This is provided for debugging purposes, and the format is not guaranteed to be stable between releases.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Operators
Equality(ColumnIdentifier, ColumnIdentifier)
Compare two ColumnIdentifiers for equality
Declaration
public static bool operator ==(ColumnIdentifier a, ColumnIdentifier b)
Parameters
Type | Name | Description |
---|---|---|
ColumnIdentifier | a | |
ColumnIdentifier | b |
Returns
Type | Description |
---|---|
System.Boolean |
Explicit(ColumnIdentifier to Int32)
Paired operator for the int-to-ColumnIdentifier cast.
Equivalent to Index property.
Declaration
public static explicit operator int (ColumnIdentifier col)
Parameters
Type | Name | Description |
---|---|---|
ColumnIdentifier | col |
Returns
Type | Description |
---|---|
System.Int32 |
Explicit(Int32 to ColumnIdentifier)
Convenience operator for converting an index to a ColumnIdentifier.
Equivalent to calling Create.
Declaration
public static explicit operator ColumnIdentifier(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type | Description |
---|---|
ColumnIdentifier |
Inequality(ColumnIdentifier, ColumnIdentifier)
Compare two ColumnIdentifiers for inequality
Declaration
public static bool operator !=(ColumnIdentifier a, ColumnIdentifier b)
Parameters
Type | Name | Description |
---|---|---|
ColumnIdentifier | a | |
ColumnIdentifier | b |
Returns
Type | Description |
---|---|
System.Boolean |