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
DateTimeThe 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
TypeThe 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
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
stringThe property.
Returns
GetPropertyType(Type, string)
Gets the type of the property.
public static Type GetPropertyType(Type type, string property)
Parameters
Returns
- Type
Type.
GetValue(object, string)
Gets the value of the specified expression via reflection.
public static object GetValue(object value, string path)
Parameters
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
Returns
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
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
TypeThe 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
TypeThe 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
TypeThe 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
TypeThe 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
TypeThe 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
TypeThe 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
Returns
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
Returns
- bool
true
if successful,false
otherwise.
Type Parameters
T
The target type