Volume Control
Application-specific hotkeys for Windows
VolumeControl.TypeExtensions.ReflectionExtensions Class Reference

Extension methods that use C#'s reflection capabilities. More...

Collaboration diagram for VolumeControl.TypeExtensions.ReflectionExtensions:

Static Public Member Functions

static void RaisePropertyChanged (this INotifyPropertyChanged bindableObject, string propertyName, object? sender, PropertyChangedEventArgs e)
 Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged. More...
 
static void RaisePropertyChanged (this INotifyPropertyChanged bindableObject, string propertyName, object? sender)
 Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged. More...
 
static void RaisePropertyChanged (this INotifyPropertyChanged bindableObject, string propertyName, PropertyChangedEventArgs e)
 Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged. More...
 
static void RaisePropertyChanged (this INotifyPropertyChanged bindableObject, string propertyName)
 Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged. More...
 
static void RaiseEvent (this object source, string eventName, object[] args)
 Raises the event specified by eventName on the given source object by invoking all of its bound handler delegates. More...
 
static void RaiseEvent< TEventArgs > (this object source, string eventName, object? sender, TEventArgs eventArgs)
 Raises the event named eventName on the object source with the given sender & eventArgs parameters. Src: More...
 
static void RaiseEvent< TEventArgs > (this object source, string eventName, TEventArgs eventArgs)
 Raises the event named eventName on the object source with the given eventArgs parameters. Src: More...
 
static void RaiseEvent (this object source, string eventName, object? sender, object eventArgs)
 Raises the event named eventName on the object source with the given sender & eventArgs parameters. Src: More...
 
static void RaiseEvent (this object source, string eventName, object eventArgs)
 Raises the event named eventName on the object source with the given eventArgs parameters. Src: More...
 
static ? object GetValue (this MemberInfo mInfo, object? objectInstance)
 Gets the value of the member represented by mInfo from objectInstance . More...
 
static bool SetValue (this MemberInfo mInfo, object? objectInstance, object? value)
 Sets the value of the member represented by mInfo in objectInstance to value . More...
 
static bool IsPublic (this PropertyInfo pInfo)
 Checks if both the getter and setter of a property are public. More...
 
static bool IsAwaitable (this MethodInfo methodInfo)
 Checks if the method returns a type that has a GetAwaiter() method, and thus can be awaited. More...
 

Detailed Description

Extension methods that use C#'s reflection capabilities.

Member Function Documentation

◆ GetValue()

static ? object VolumeControl.TypeExtensions.ReflectionExtensions.GetValue ( this MemberInfo  mInfo,
object?  objectInstance 
)
static

Gets the value of the member represented by mInfo from objectInstance .

Parameters
mInfoMemberInfo
objectInstanceAn instance of the object that contains the member represented by mInfo , or null if the object is static.
Returns
The value of the member, or null if mInfo isn't associated with a field or property.

Referenced by VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent().

Here is the caller graph for this function:

◆ IsAwaitable()

static bool VolumeControl.TypeExtensions.ReflectionExtensions.IsAwaitable ( this MethodInfo  methodInfo)
static

Checks if the method returns a type that has a GetAwaiter() method, and thus can be awaited.

Parameters
methodInfo(implicit) The MethodInfo instance representing the method to check.
Returns
true when the method is awaitable; otherwise, false.

◆ IsPublic()

static bool VolumeControl.TypeExtensions.ReflectionExtensions.IsPublic ( this PropertyInfo  pInfo)
static

Checks if both the getter and setter of a property are public.

Parameters
pInfoPropertyInfo
Returns
true when the getter and setter methods are public; otherwise false.

◆ RaiseEvent() [1/3]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent ( this object  source,
string  eventName,
object  eventArgs 
)
static

Raises the event named eventName on the object source with the given eventArgs parameters. Src:

Parameters
sourceThe object instance (or Type for static events/objects) on which to raise an event.
eventNameThe name of the event property in the source type.
eventArgsThe EventArgs-derived instance to use for the event args parameter when invoking the event handlers.

◆ RaiseEvent() [2/3]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent ( this object  source,
string  eventName,
object?  sender,
object  eventArgs 
)
static

Raises the event named eventName on the object source with the given sender & eventArgs parameters. Src:

Parameters
sourceThe object instance (or Type for static events/objects) on which to raise an event.
eventNameThe name of the event property in the source type.
senderThe sender parameter to use when invoking the event handlers.
eventArgsThe EventArgs-derived instance to use for the event args parameter when invoking the event handlers.

◆ RaiseEvent() [3/3]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent ( this object  source,
string  eventName,
object[]  args 
)
static

Raises the event specified by eventName on the given source object by invoking all of its bound handler delegates.

Parameters
sourceThe object instance (or Type for static events/objects) on which to raise an event.
eventNameThe name of the event property in the source type.
argsThe arguments to invoke the event handlers with.

References VolumeControl.TypeExtensions.ReflectionExtensions.GetValue().

Here is the call graph for this function:

◆ RaiseEvent< TEventArgs >() [1/2]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent< TEventArgs > ( this object  source,
string  eventName,
object?  sender,
TEventArgs  eventArgs 
)
static

Raises the event named eventName on the object source with the given sender & eventArgs parameters. Src:

Template Parameters
TEventArgsAny type derived from EventArgs
Parameters
sourceThe object instance (or Type for static events/objects) on which to raise an event.
eventNameThe name of the event property in the source type.
senderThe sender parameter to use when invoking the event handlers.
eventArgsThe EventArgs-derived instance to use for the event args parameter when invoking the event handlers.
Type Constraints
TEventArgs :EventArgs 

◆ RaiseEvent< TEventArgs >() [2/2]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaiseEvent< TEventArgs > ( this object  source,
string  eventName,
TEventArgs  eventArgs 
)
static

Raises the event named eventName on the object source with the given eventArgs parameters. Src:

Template Parameters
TEventArgsAny type derived from EventArgs
Parameters
sourceThe object instance (or Type for static events/objects) on which to raise an event.
eventNameThe name of the event property in the source type.
eventArgsThe EventArgs-derived instance to use for the event args parameter when invoking the event handlers.
Type Constraints
TEventArgs :EventArgs 

◆ RaisePropertyChanged() [1/4]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaisePropertyChanged ( this INotifyPropertyChanged  bindableObject,
string  propertyName 
)
static

Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged.

Parameters
bindableObjectAn object instance that implements INotifyPropertyChanged.
propertyNameThe name of the property on bindableObject to raise an event for.

◆ RaisePropertyChanged() [2/4]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaisePropertyChanged ( this INotifyPropertyChanged  bindableObject,
string  propertyName,
object?  sender 
)
static

Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged.

Parameters
bindableObjectAn object instance that implements INotifyPropertyChanged.
propertyNameThe name of the property on bindableObject to raise an event for.
senderThe value to pass as the sender parameter to all attached PropertyChangedEventHandler instances.

◆ RaisePropertyChanged() [3/4]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaisePropertyChanged ( this INotifyPropertyChanged  bindableObject,
string  propertyName,
object?  sender,
PropertyChangedEventArgs  e 
)
static

Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged.

Parameters
bindableObjectAn object instance that implements INotifyPropertyChanged.
propertyNameThe name of the property on bindableObject to raise an event for.
senderThe value to pass as the sender parameter to all attached PropertyChangedEventHandler instances.
eThe PropertyChangedEventArgs instance to pass as the event args parameter to all attached PropertyChangedEventHandler instances.

◆ RaisePropertyChanged() [4/4]

static void VolumeControl.TypeExtensions.ReflectionExtensions.RaisePropertyChanged ( this INotifyPropertyChanged  bindableObject,
string  propertyName,
PropertyChangedEventArgs  e 
)
static

Raises the PropertyChanged event on the given object that implements INotifyPropertyChanged.

Parameters
bindableObjectAn object instance that implements INotifyPropertyChanged.
propertyNameThe name of the property on bindableObject to raise an event for.
eThe PropertyChangedEventArgs instance to pass as the event args parameter to all attached PropertyChangedEventHandler instances.

◆ SetValue()

static bool VolumeControl.TypeExtensions.ReflectionExtensions.SetValue ( this MemberInfo  mInfo,
object?  objectInstance,
object?  value 
)
static

Sets the value of the member represented by mInfo in objectInstance to value .

Parameters
mInfoMemberInfo
objectInstanceAn instance of the object that contains the member represented by mInfo , or null if the object is static.
valueThe value to set this member to.
Returns
true when the value of this member was set successfully; false when mInfo doesn't represent a field or property.

The documentation for this class was generated from the following file: