¡@

Home 

c# Programming Glossary: methodbase

How performant is StackFrame?

http://stackoverflow.com/questions/1348643/how-performant-is-stackframe

using an approach like public void DoSomething TraceCall MethodBase.GetCurrentMethod .Name Do Something public void TraceCall string.. methodName if loggingEnabled return Log... TraceCall MethodBase.GetCurrentMethod .Name It was simple but regardless of whether.. A public void DoSomething if loggingEnabled TraceCall MethodBase.GetCurrentMethod .Name Do Something public void TraceCall string..

Generic logging of function parameters in exception handling

http://stackoverflow.com/questions/135782/generic-logging-of-function-parameters-in-exception-handling

new NotImplementedException catch Exception ex LogError MethodBase.GetCurrentMethod ex s x y private static void LogError MethodBase.. ex s x y private static void LogError MethodBase method Exception ex params object values ParameterInfo parms..

How do I get the member to which my custom attribute was applied?

http://stackoverflow.com/questions/2168942/how-do-i-get-the-member-to-which-my-custom-attribute-was-applied

was applied to a property Would GetMethod return a MethodBase instance for that property Is there a different way of getting.. st new StackTrace StackFrame currentFrame st.GetFrame 1 MethodBase method currentFrame.GetMethod Console.WriteLine method.Name..

C# how to get the name of the current method from code [duplicate]

http://stackoverflow.com/questions/2652460/c-sharp-how-to-get-the-name-of-the-current-method-from-code

StackTrace st new StackTrace StackFrame sf st.GetFrame 0 MethodBase currentMethodName sf.GetMethod Or if you'd like to have a helper..

How do I create an expression tree calling IEnumerable<TSource>.Any(…)?

http://stackoverflow.com/questions/326321/how-do-i-create-an-expression-tree-calling-ienumerabletsource-any

Any . Here's a utility function that does that static MethodBase GetGenericMethod Type type string name Type typeArgs Type argTypes..

GetEntryAssembly for web applications

http://stackoverflow.com/questions/4277692/getentryassembly-for-web-applications

if none ex web application if result null current method MethodBase methodCurrent null number of frames to skip int framestoSkip..

Using reflection to get method name and parameters

http://stackoverflow.com/questions/471693/using-reflection-to-get-method-name-and-parameters

would return string key GetName 1 2 I know you can get the MethodBase using reflection but how do I get the parameters values in the..

C# reflection and finding all references

http://stackoverflow.com/questions/5490025/c-sharp-reflection-and-finding-all-references

to print out all the methods used within TestClass.Test MethodBase methodBase typeof TestClass .GetMethod Test var instructions..

Retrieving the calling method name from within a method [duplicate]

http://stackoverflow.com/questions/615940/retrieving-the-calling-method-name-from-within-a-method

from ButtonClick I was looking at the System.Reflection.MethodBase.GetCurrentMethod but that won't get me the calling method. I've.. simple to do that StackTrace stackTrace new StackTrace MethodBase methodBase stackTrace.GetFrame 1 .GetMethod Console.WriteLine..

Obtain parameter values from a stack frame in .NET?

http://stackoverflow.com/questions/75076/obtain-parameter-values-from-a-stack-frame-in-net

frames st.GetFrames foreach StackFrame frame in frames MethodBase method frame.GetMethod sb.AppendFormat 0 1 method.DeclaringType..

How can I determine which exceptions can be thrown by a given method?

http://stackoverflow.com/questions/986180/how-can-i-determine-which-exceptions-can-be-thrown-by-a-given-method

code in full. You simply want to use the GetAllExceptions MethodBase method either as an extension or static method. using System.. static ReadOnlyCollection Type GetAllExceptions this MethodBase method var exceptionTypes new HashSet Type var visitedMethods.. new HashSet Type var visitedMethods new HashSet MethodBase var localVars new Type ushort.MaxValue var stack new Stack Type..