Show / Hide Table of Contents

Struct NamedObject<T>

Structure that allows labeling any object.

Implements
INameable
Inherited Members
ValueType.ToString()
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: TheXDS.MCART.Types
Assembly: MCART.dll
Syntax
public readonly struct NamedObject<T> : INameable
Type Parameters
Name Description
T

Object type.

Constructors

| Edit this page View Source

NamedObject(string, T)

Structure that allows labeling any object.

Declaration
public NamedObject(string name, T value)
Parameters
Type Name Description
string name

Object's label.

T value

Object to label.

| Edit this page View Source

NamedObject(T)

Initializes a new instance of the structure NamedObject<T> by setting a value along with an auto-generated label based on ToString().

Declaration
public NamedObject(T value)
Parameters
Type Name Description
T value

Object to label.

| Edit this page View Source

NamedObject(T, string)

Initialies a new instance of the structure NamedObject<T>

Declaration
[Obsolete("The recommended signature for this constructor has changed. Please use NamedObject<T>(string, T) instead.")]
public NamedObject(T value, string name)
Parameters
Type Name Description
T value

Object to label.

string name

Object's label.

Properties

| Edit this page View Source

Name

Object's label.

Declaration
public string Name { get; }
Property Value
Type Description
string
| Edit this page View Source

Value

Object's value.

Declaration
public T Value { get; }
Property Value
Type Description
T

Methods

| Edit this page View Source

Equals(object?)

Compares equality between this NamedObject<T> and another object.

Declaration
public override bool Equals(object? obj)
Parameters
Type Name Description
object obj

Object to compare against this instance.

Returns
Type Description
bool

true if both instances are considered equal, false otherwise.

Overrides
ValueType.Equals(object)
| Edit this page View Source

GetHashCode()

Gets the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

The hash code for this instance.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Infer(T)

Infers the label for an object.

Declaration
public static string Infer(T obj)
Parameters
Type Name Description
T obj

Object to infer a label for.

Returns
Type Description
string

The inferred name of the object or ToString() if no appropriate label can be inferred.

Operators

| Edit this page View Source

operator ==(NamedObject<T>, NamedObject<T>)

Compares equality between two instances of NamedObject<T>.

Declaration
public static bool operator ==(NamedObject<T> left, NamedObject<T> right)
Parameters
Type Name Description
NamedObject<T> left

Object to compare.

NamedObject<T> right

Object to compare against.

Returns
Type Description
bool

true if both instances are considered equal, false otherwise.

| Edit this page View Source

implicit operator NamedObject<T>(KeyValuePair<string, T>)

Implicitly converts a KeyValuePair<TKey, TValue> into a NamedObject<T>.

Declaration
public static implicit operator NamedObject<T>(KeyValuePair<string, T> keyValuePair)
Parameters
Type Name Description
KeyValuePair<string, T> keyValuePair

Object to convert.

Returns
Type Description
NamedObject<T>
| Edit this page View Source

implicit operator NamedObject<T>((string, T))

Implicitly converts a (T1, T2) into a NamedObject<T>.

Declaration
public static implicit operator NamedObject<T>((string, T) tuple)
Parameters
Type Name Description
(string, T) tuple

Object to convert.

Returns
Type Description
NamedObject<T>
| Edit this page View Source

implicit operator NamedObject<T>((T, string))

Implicitly converts a (T1, T2) into a NamedObject<T>.

Declaration
public static implicit operator NamedObject<T>((T, string) tuple)
Parameters
Type Name Description
(T, string) tuple

Object to convert.

Returns
Type Description
NamedObject<T>
| Edit this page View Source

implicit operator KeyValuePair<string, T>(NamedObject<T>)

Implicitly converts a NamedObject<T> into a KeyValuePair<TKey, TValue>.

Declaration
public static implicit operator KeyValuePair<string, T>(NamedObject<T> namedObj)
Parameters
Type Name Description
NamedObject<T> namedObj

Object to convert.

Returns
Type Description
KeyValuePair<string, T>
| Edit this page View Source

implicit operator string(NamedObject<T>)

Implicitly converts a NamedObject<T> into a string.

Declaration
public static implicit operator string(NamedObject<T> namedObj)
Parameters
Type Name Description
NamedObject<T> namedObj

Object to convert.

Returns
Type Description
string
| Edit this page View Source

implicit operator (string, T)(NamedObject<T>)

Implicitly converts a (T1, T2) into a NamedObject<T>.

Declaration
public static implicit operator (string, T)(NamedObject<T> value)
Parameters
Type Name Description
NamedObject<T> value

Object to convert.

Returns
Type Description
(string, T)
| Edit this page View Source

implicit operator (T, string)(NamedObject<T>)

Implicitly converts a (T1, T2) into a NamedObject<T>.

Declaration
public static implicit operator (T, string)(NamedObject<T> value)
Parameters
Type Name Description
NamedObject<T> value

Object to convert.

Returns
Type Description
(T, string)
| Edit this page View Source

implicit operator T(NamedObject<T>)

Implicitly converts a NamedObject<T> into a T.

Declaration
public static implicit operator T(NamedObject<T> namedObj)
Parameters
Type Name Description
NamedObject<T> namedObj

Object to convert.

Returns
Type Description
T
| Edit this page View Source

implicit operator NamedObject<T>(T)

Implicitly converts a T into a NamedObject<T>.

Declaration
public static implicit operator NamedObject<T>(T obj)
Parameters
Type Name Description
T obj

Object to convert.

Returns
Type Description
NamedObject<T>
| Edit this page View Source

operator !=(NamedObject<T>, NamedObject<T>)

Checks if two instances of NamedObject<T> are considered different.

Declaration
public static bool operator !=(NamedObject<T> left, NamedObject<T> right)
Parameters
Type Name Description
NamedObject<T> left

Object to compare.

NamedObject<T> right

Object to compare against.

Returns
Type Description
bool

true if both instances are considered different, false otherwise.

Implements

INameable

Extension Methods

Objects.ShallowCopyTo(object, object, Type)
ObjectExtensions.FieldsOf<T>(object)
ObjectExtensions.GetAttribute<T>(object)
ObjectExtensions.GetAttributes<T>(object)
ObjectExtensions.HasAttrValue<TAttribute, TValue>(object, out TValue)
ObjectExtensions.HasAttribute<T>(object)
ObjectExtensions.HasAttribute<T>(object, out T?)
ObjectExtensions.HasAttributes<T>(object, out IEnumerable<T>?)
ObjectExtensions.Is(object?, object?)
ObjectExtensions.IsEither(object, IEnumerable)
ObjectExtensions.IsEither(object, params object[])
ObjectExtensions.IsNeither(object, IEnumerable)
ObjectExtensions.IsNeither(object, params object[])
ObjectExtensions.IsNot(object?, object?)
ObjectExtensions.PropertiesOf<T>(object)
ObjectExtensions.WhichAre(object, IEnumerable<object>)
ObjectExtensions.WhichAre(object, params object[])
Objects.Itself<T>(T)
Objects.ShallowClone<T>(T)
Objects.ShallowCopyTo<T>(T, T)
CollectionExtensions.PushInto<TItem, TCollection>(TItem, ICollection<TCollection>)
DictionaryExtensions.PushInto<TKey, TValue>(TValue, TKey, IDictionary<TKey, TValue>)
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX