Table of Contents

Class PropertyAccess

Namespace
Radzen
Assembly
Radzen.Blazor.dll

Utility class that provides property access based on strings.

public static class PropertyAccess
Inheritance
PropertyAccess
Inherited Members

Methods

DateOnlyFromDateTime(DateTime)

Determines whether the specified type is a DateOnly.

public static object DateOnlyFromDateTime(DateTime source)

Parameters

source DateTime

The source.

Returns

object

true if the specified type is a DateOnly instance or nullable DateOnly; otherwise, false.

GetElementType(Type)

Gets the type of the element of a collection time.

public static Type GetElementType(Type type)

Parameters

type Type

The type.

Returns

Type

The type of the collection element.

GetItemOrValueFromProperty(object, string)

Gets the item or value from property.

public static object GetItemOrValueFromProperty(object item, string property)

Parameters

item object

The item.

property string

The property.

Returns

object

System.Object.

GetProperty(string)

Converts the property to a value that can be used by Dynamic LINQ.

public static string GetProperty(string property)

Parameters

property string

The property.

Returns

string

GetPropertyType(Type, string)

Gets the type of the property.

public static Type GetPropertyType(Type type, string property)

Parameters

type Type

The type.

property string

The property.

Returns

Type

Type.

GetValue(object, string)

Gets the value of the specified expression via reflection.

public static object GetValue(object value, string path)

Parameters

value object

The value.

path string

The path.

Returns

object

The value of the specified expression or value if not found.

Getter<T>(object, string)

Creates a function that returns the specified property.

public static Func<object, T> Getter<T>(object data, string propertyName)

Parameters

data object

The value.

propertyName string

The name of the property to return.

Returns

Func<object, T>

A function that returns the specified property.

Type Parameters

T

The value type

Getter<TItem, TValue>(string, Type)

Creates a function that will return the specified property.

public static Func<TItem, TValue> Getter<TItem, TValue>(string propertyName, Type type = null)

Parameters

propertyName string

Name of the property to return.

type Type

Type of the object.

Returns

Func<TItem, TValue>

A function which return the specified property by its name.

Type Parameters

TItem

The owner type.

TValue

The value type.

IsAnonymous(Type)

Determines whether the specified type is anonymous.

public static bool IsAnonymous(this Type type)

Parameters

type Type

The type.

Returns

bool

true if the specified type is anonymous; otherwise, false.

IsDate(Type)

Determines whether the specified type is a DateTime.

public static bool IsDate(Type source)

Parameters

source Type

The source.

Returns

bool

true if the specified type is a DateTime instance or nullable DateTime; otherwise, false.

IsDateOnly(Type)

Determines whether the specified type is a DateOnly.

public static bool IsDateOnly(Type source)

Parameters

source Type

The source.

Returns

bool

true if the specified type is a DateOnly instance or nullable DateOnly; otherwise, false.

IsEnum(Type)

Determines whether the specified type is an enum.

public static bool IsEnum(Type source)

Parameters

source Type

The type.

Returns

bool

true if the specified source is an enum; otherwise, false.

IsNullableEnum(Type)

Determines whether the specified type is a Nullable enum.

public static bool IsNullableEnum(Type source)

Parameters

source Type

The type.

Returns

bool

true if the specified source is an enum; otherwise, false.

IsNumeric(Type)

Determines whether the specified type is numeric.

public static bool IsNumeric(Type source)

Parameters

source Type

The type.

Returns

bool

true if the specified source is numeric; otherwise, false.

ReplaceFirst(string, string, string)

Method to only replace first occurence of a substring in a string

public static string ReplaceFirst(this string text, string search, string replace)

Parameters

text string
search string
replace string

Returns

string

TryGetItemOrValueFromProperty<T>(object, string, out T)

Tries to get a property by its name.

public static bool TryGetItemOrValueFromProperty<T>(object item, string property, out T result)

Parameters

item object

The item.

property string

The property.

result T

The property value.

Returns

bool

true if successful, false otherwise.

Type Parameters

T

The target type