UtilReflectionGetAllMethods(Object, Boolean, BindingFlags) Method
Gets all the methods declared in the specified object.
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 IEnumerable<MethodInfo> GetAllMethods(
Object obj,
bool includeBaseTypes,
BindingFlags bindingFlags = BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic
)
Public Shared Function GetAllMethods (
obj As Object,
includeBaseTypes As Boolean,
Optional bindingFlags As BindingFlags = BindingFlags.DeclaredOnly Or BindingFlags.Instance Or BindingFlags.Static Or BindingFlags.Public Or BindingFlags.NonPublic
) As IEnumerable(Of MethodInfo)
Dim obj As Object
Dim includeBaseTypes As Boolean
Dim bindingFlags As BindingFlags
Dim returnValue As IEnumerable(Of MethodInfo)
returnValue = UtilReflection.GetAllMethods(obj,
includeBaseTypes, bindingFlags)
public:
static IEnumerable<MethodInfo^>^ GetAllMethods(
Object^ obj,
bool includeBaseTypes,
BindingFlags bindingFlags = BindingFlags::DeclaredOnly|BindingFlags::Instance|BindingFlags::Static|BindingFlags::Public|BindingFlags::NonPublic
)
static member GetAllMethods :
obj : Object *
includeBaseTypes : bool *
?bindingFlags : BindingFlags
(* Defaults:
let _bindingFlags = defaultArg bindingFlags BindingFlags.DeclaredOnly|BindingFlags.Instance|BindingFlags.Static|BindingFlags.Public|BindingFlags.NonPublic
*)
-> IEnumerable<MethodInfo>
No code example is currently available or this language may not be supported.
- obj Object
-
The source object from which to retrieve the methods.
- includeBaseTypes Boolean
-
If , the search include methods declared in base types too.
- bindingFlags BindingFlags (Optional)
-
Flags that controls binding and the way in which the search for members and types is conducted by Reflection.
IEnumerableMethodInfo
A
IEnumerableT collection with all the methods found.
This is a code example.
No code example is currently available or this language may not be supported.
Dim methods As IEnumerable(Of MethodInfo) = GetAllMethods(Me,
includeBaseTypes:=False,
bindingFlags:=BindingFlags.Public Or
BindingFlags.Static Or
BindingFlags.Instance)
For Each method As MethodInfo In methods
Dim params As ParameterInfo() = method.GetParameters()
Dim paramTypes As IEnumerable(Of Type) = params.Select(Function(param As ParameterInfo) param.ParameterType)
Dim genericTypes As IEnumerable(Of Type) = method.GetGenericArguments()
Dim returnType As Type = method.ReturnType
Dim methodSignature As String = String.Format("{0}{1}({2}){3}",
method.Name,
If(genericTypes.Count <> 0, String.Format("(Of {0})", String.Join(", ", genericTypes)), Nothing),
String.Join(", ", paramTypes),
If(returnType IsNot GetType(System.Void), String.Format(" As {0}", returnType.ToString()), Nothing))
Console.WriteLine(methodSignature)
Next method
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.