UtilReflectionGetPropertyValueT(Object, String, T, BindingFlags) Method
Searches for the specified property in the specified object, and returns the property value.
Namespace: DevCase.Core.Diagnostics.Assembly.ReflectionAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
public static T GetPropertyValue<T>(
Object obj,
string propName,
T defaultIfEmpty,
BindingFlags bindingFlags = BindingFlags.Instance|BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.FlattenHierarchy|BindingFlags.GetProperty
)
Public Shared Function GetPropertyValue(Of T) (
obj As Object,
propName As String,
defaultIfEmpty As T,
Optional bindingFlags As BindingFlags = BindingFlags.Instance Or BindingFlags.Static Or BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.FlattenHierarchy Or BindingFlags.GetProperty
) As T
Dim obj As Object
Dim propName As String
Dim defaultIfEmpty As T
Dim bindingFlags As BindingFlags
Dim returnValue As T
returnValue = UtilReflection.GetPropertyValue(obj,
propName, defaultIfEmpty, bindingFlags)
public:
generic<typename T>
static T GetPropertyValue(
Object^ obj,
String^ propName,
T defaultIfEmpty,
BindingFlags bindingFlags = BindingFlags::Instance|BindingFlags::Static|BindingFlags::Public|BindingFlags::NonPublic|BindingFlags::FlattenHierarchy|BindingFlags::GetProperty
)
static member GetPropertyValue :
obj : Object *
propName : string *
defaultIfEmpty : 'T *
?bindingFlags : BindingFlags
(* Defaults:
let _bindingFlags = defaultArg bindingFlags BindingFlags.Instance|BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.FlattenHierarchy|BindingFlags.GetProperty
*)
-> 'T
No code example is currently available or this language may not be supported.
- obj Object
-
The source object from which to retrieve the property.
- propName String
-
The name of the property to search for.
- defaultIfEmpty T
-
The default value to return in case of the property value is .
- bindingFlags BindingFlags (Optional)
-
Flags that controls binding and the way in which the search for members and types is conducted by Reflection.
- T
-
The type of the property to be returned.
T
The property value.
This is a code example.
No code example is currently available or this language may not be supported.
Dim text As String = GetPropertyValue(Of String)(Me, "Text", String.Empty)
Console.WriteLine(text)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
ArgumentNullException
|
|
ArgumentException
|
Property not found using the current flags.
|