Click here to Skip to main content
15,891,905 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralMessage Removed Pin
2-Jun-10 8:33
professionalN_tro_P2-Jun-10 8:33 
GeneralRe: Loading Objects with reflection Pin
Luc Pattyn2-Jun-10 8:36
sitebuilderLuc Pattyn2-Jun-10 8:36 
GeneralMessage Removed Pin
2-Jun-10 9:16
professionalN_tro_P2-Jun-10 9:16 
GeneralRe: Loading Objects with reflection Pin
Luc Pattyn2-Jun-10 9:25
sitebuilderLuc Pattyn2-Jun-10 9:25 
GeneralMessage Removed Pin
2-Jun-10 9:32
professionalN_tro_P2-Jun-10 9:32 
GeneralRe: Loading Objects with reflection Pin
Luc Pattyn2-Jun-10 9:40
sitebuilderLuc Pattyn2-Jun-10 9:40 
QuestionHow to retrieve the parameter values from MethodInfo? Pin
anand kumar m2-Jun-10 0:32
anand kumar m2-Jun-10 0:32 
AnswerRe: How to retrieve the parameter values from MethodInfo? Pin
Peace ON2-Jun-10 1:18
Peace ON2-Jun-10 1:18 
In most of the forum I found it is not possible
to retrieve parameter value, however it is possible
to retrieve parameter name and type.

Try following code for the same...

C#
class Program
{
        static void Main(string[] args)
        {
                A a = new A();
                a.Go(1);
        }
}

public class A
{
        internal void Go(int x)
        {
                B b = new B();
                b.Go(4);
        }
}


public class B
{

        internal void Go(int y)
        {
                Console.WriteLine(GetStackTrace());

        }
        public static string GetStackTrace()
        {
                StringBuilder sb = new StringBuilder();
                StackTrace st = new StackTrace(true);
                StackFrame[] frames = st.GetFrames();

                foreach (StackFrame frame in frames)
                {
                        MethodBase method = frame.GetMethod();

                        sb.AppendFormat("{0} - {1}",method.DeclaringType, method.Name);
                        ParameterInfo[] paramaters = method.GetParameters();
                        foreach (ParameterInfo paramater in paramaters)
                        {
                                sb.AppendFormat("{0}: {1}", paramater.Name, paramater.ToString());
                        }
                        sb.AppendLine();
                }


                return sb.ToString();
        }

}


For more info. try following links...

http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/1169ad05-8711-4607-98e6-aa6d380bd0ea/[^]

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/fdab69c6-f3b6-440d-a6d9-13d5d059f16f/[^]

http://stackoverflow.com/questions/75076/obtain-parameter-values-from-stackframe-in-net[^]

http://tdanecker.blogspot.com/2007/09/interception-with-proxies.html[^]


HTH
Jinal Desai - LIVE
Experience is mother of sage....

QuestionSession cookie problem with HttpWebRequest Pin
garageoffice1-Jun-10 21:56
garageoffice1-Jun-10 21:56 
QuestionFtp over ssl Pin
mon***z1-Jun-10 0:11
mon***z1-Jun-10 0:11 
AnswerRe: Ftp over ssl Pin
Peace ON1-Jun-10 4:26
Peace ON1-Jun-10 4:26 
QuestionExploding .NET solution Pin
Baconbutty31-May-10 23:30
Baconbutty31-May-10 23:30 
AnswerRe: Exploding .NET solution Pin
Pete O'Hanlon31-May-10 23:40
mvePete O'Hanlon31-May-10 23:40 
GeneralRe: Exploding .NET solution Pin
Baconbutty1-Jun-10 0:00
Baconbutty1-Jun-10 0:00 
GeneralRe: Exploding .NET solution Pin
Pete O'Hanlon1-Jun-10 0:37
mvePete O'Hanlon1-Jun-10 0:37 
Questionproblem with messagebox's in a windows service thread Pin
Kalyan_A31-May-10 3:57
professionalKalyan_A31-May-10 3:57 
AnswerRe: problem with messagebox's in a windows service thread Pin
Ray Cassick31-May-10 5:46
Ray Cassick31-May-10 5:46 
GeneralRe: problem with messagebox's in a windows service thread Pin
Kalyan_A6-Jun-10 22:56
professionalKalyan_A6-Jun-10 22:56 
Questionexceeding the maximum capacity of value types Pin
prasadbuddhika31-May-10 1:35
prasadbuddhika31-May-10 1:35 
AnswerRe: exceeding the maximum capacity of value types Pin
Luc Pattyn31-May-10 2:11
sitebuilderLuc Pattyn31-May-10 2:11 
GeneralRe: exceeding the maximum capacity of value types Pin
prasadbuddhika31-May-10 2:32
prasadbuddhika31-May-10 2:32 
GeneralRe: exceeding the maximum capacity of value types Pin
Luc Pattyn31-May-10 2:41
sitebuilderLuc Pattyn31-May-10 2:41 
GeneralRe: exceeding the maximum capacity of value types Pin
prasadbuddhika31-May-10 17:52
prasadbuddhika31-May-10 17:52 
GeneralRe: exceeding the maximum capacity of value types Pin
Luc Pattyn31-May-10 17:57
sitebuilderLuc Pattyn31-May-10 17:57 
Questionpassing information Pin
kolisa31-May-10 0:14
kolisa31-May-10 0:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.