Click here to Skip to main content
15,881,248 members
Home / Discussions / C#
   

C#

 
GeneralRe: Extracting numeric from string Pin
OriginalGriff25-Jan-11 1:09
mveOriginalGriff25-Jan-11 1:09 
AnswerRe: Extracting numeric from string Pin
musefan25-Jan-11 3:06
musefan25-Jan-11 3:06 
Questionjavascript: opener.document Pin
fififlowertot24-Jan-11 10:19
fififlowertot24-Jan-11 10:19 
AnswerRe: javascript: opener.document Pin
dan!sh 24-Jan-11 10:25
professional dan!sh 24-Jan-11 10:25 
GeneralRe: javascript: opener.document Pin
fififlowertot24-Jan-11 10:36
fififlowertot24-Jan-11 10:36 
GeneralRe: javascript: opener.document Pin
GenJerDan24-Jan-11 11:29
GenJerDan24-Jan-11 11:29 
GeneralRe: javascript: opener.document Pin
fififlowertot24-Jan-11 22:05
fififlowertot24-Jan-11 22:05 
QuestionHow do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 10:14
DaleDaleM24-Jan-11 10:14 
See the code below, specifically the following line:

// ??? How do I access the TestProperty of oTest1, and instance of the Test1 class, which is a subclass of TestBase ???

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace TreadStackMemberAccess
{
    public class Program
    {
        static void Main(string[] args)
        {
            Test1 oTest1 = new Test1();
            oTest1.Method1();
        }
    }

    public class TestBase
    {
        public string TestProperty { get; set; }
    }

    public class Test1 : TestBase
    {
        public void Method1()
        {
            TestProperty = "Test1";
            Test2 oTest2 = new Test2();
            oTest2.Method2();
        }
    }

    public class Test2
    {
        public void Method2()
        {
            Test3 oTest3 = new Test3();
            oTest3.Method3();
        }
    }
    
    public class Test3
    {
        public void Method3()
        {
            System.Diagnostics.StackFrame[] oStackFrames = (new System.Diagnostics.StackTrace()).GetFrames();

            for (int i = 0; i < oStackFrames.Length; i++)
            {
                System.Diagnostics.StackFrame oStackFrame = (System.Diagnostics.StackFrame)(oStackFrames[i]);

                if (oStackFrame.GetMethod().ReflectedType.IsSubclassOf(typeof(TestBase)))
                {
                    // ??? How do I access the TestProperty of oTest1, and instance of the Test1 class, which is a subclass of TestBase ???
                }
            }
        }
    }
}

AnswerRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 10:36
professional dan!sh 24-Jan-11 10:36 
GeneralRe: How do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 10:40
DaleDaleM24-Jan-11 10:40 
GeneralRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 10:51
professional dan!sh 24-Jan-11 10:51 
GeneralRe: How do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 10:56
DaleDaleM24-Jan-11 10:56 
GeneralRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 11:01
professional dan!sh 24-Jan-11 11:01 
GeneralRe: How do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 11:17
DaleDaleM24-Jan-11 11:17 
GeneralRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 11:24
professional dan!sh 24-Jan-11 11:24 
GeneralRe: How do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 11:26
DaleDaleM24-Jan-11 11:26 
GeneralRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 11:43
professional dan!sh 24-Jan-11 11:43 
GeneralRe: How do I access object properties using stack frames? Pin
Pete O'Hanlon24-Jan-11 11:54
mvePete O'Hanlon24-Jan-11 11:54 
GeneralRe: How do I access object properties using stack frames? Pin
DaleDaleM24-Jan-11 11:56
DaleDaleM24-Jan-11 11:56 
GeneralRe: How do I access object properties using stack frames? Pin
dan!sh 24-Jan-11 12:03
professional dan!sh 24-Jan-11 12:03 
Questionjavascript Pin
fififlowertot24-Jan-11 5:57
fififlowertot24-Jan-11 5:57 
AnswerRe: javascript Pin
KarlRhodes24-Jan-11 6:40
KarlRhodes24-Jan-11 6:40 
GeneralRe: javascript Pin
fififlowertot24-Jan-11 10:12
fififlowertot24-Jan-11 10:12 
AnswerRe: javascript Pin
OriginalGriff24-Jan-11 8:37
mveOriginalGriff24-Jan-11 8:37 
QuestionCreating an ADO.Net Datasource from existing data Pin
kevinnicol24-Jan-11 4:15
kevinnicol24-Jan-11 4:15 

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.