MrKWatkins.Ast Help

Properties.GetOrThrow Method

Overloads

Name

Description

GetOrThrow<T>(String)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

GetOrThrow<T>(String, T)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String, T?)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

GetOrThrow<T>(String, T, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String, T?, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

GetOrThrow<T>(String, T, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String, T?, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

GetOrThrow<T>(String)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

public T GetOrThrow<T>(string key);

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

Returns

T

The value of the property.

GetOrThrow<T>(String, T)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T? cached) where T : class;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T

The key of the property.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

GetOrThrow<T>(String, T?)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T?? cached) where T : struct;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T?

The key of the property.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

GetOrThrow<T>(String, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

public T GetOrThrow<T>(string key, Func<Exception> exceptionCreator);

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

exceptionCreator

Func<Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

GetOrThrow<T>(String, T, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T? cached, Func<Exception> exceptionCreator) where T : class;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T

The key of the property.

exceptionCreator

Func<Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

GetOrThrow<T>(String, T?, Func<Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T?? cached, Func<Exception> exceptionCreator) where T : struct;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T?

The key of the property.

exceptionCreator

Func<Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

GetOrThrow<T>(String, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist.

public T GetOrThrow<T>(string key, Func<string, Exception> exceptionCreator);

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

exceptionCreator

Func<String, Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

GetOrThrow<T>(String, T, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T? cached, Func<string, Exception> exceptionCreator) where T : class;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T

The key of the property.

exceptionCreator

Func<String, Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

GetOrThrow<T>(String, T?, Func<String, Exception>)

Gets the value of a single valued property with the specified key or throws an exception if the property does not exist. Uses a field to cache the value for better performance.

public T GetOrThrow<T>(string key, ref T?? cached, Func<string, Exception> exceptionCreator) where T : struct;

Type Parameters

Name

Description

T

The type of the property.

Parameters

Name

Type

Description

key

String

The key of the property.

cached

T?

The key of the property.

exceptionCreator

Func<String, Exception>

Function to create an exception to throw if the no property with the specified key exists.

Returns

T

The value of the property.

Remarks

Properties are stored in a dictionary which might not have enough performance in some situations. Use this overload to get higher performance as the value will be taken from the field if it exists. Make sure to use Set<T>(String, T, T) to update the cached field.

Last modified: 22 November 2024