Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

I need some advice, please!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paula - 22 Aug 2005 16:55 GMT
I'm working with .net framework 1.1 in C# for a windows application

I have 2 classes - A and B.
I have a function in B that is called by many functions in A.
I want to be able to detect in class B the parameters(data type and value)
of the calling function in class A.

Is this possible?  If so, can anyone point me in the right direction?

Thanks in advance!
Paula
Gerrit H - 22 Aug 2005 17:25 GMT
Hmmz.. if I read this, you have something like

classA
   functionA(string name, int age)
       classB.functionB()

   functionA2(real amount, string city)
       classB.functionB()

classB
   functionB()

and you want code in B to access the parameters name and age you got in the
calling function A? (amount and city from calling A2...)

Do not know about accessing the callingstack @ runtime, but that seems to be
a hack and not really object oriënted. What you could do is create a
intermediate class like 'customParameter', which contains a few internal
variables (collections) that are set by functionA and functionA2.

Other approach is create overloaded functions of functionB that (offcourse)
have different signatures. Call a different functionB from all calling
functions. Create a base (generic) functionBBase that is called from the
overloaded functionB's for generic data processing.

Not knowing the exact situation this is all I solutions I can think off just
now. Is it possible to re-design this part aplication? Any more information?

> I'm working with .net framework 1.1 in C# for a windows application
>
[quoted text clipped - 7 lines]
> Thanks in advance!
> Paula
Paula - 22 Aug 2005 18:34 GMT
Gerrit,

Thanks for the response - the situation you described is exactly what I need
to do.  I had thought about the container idea and the overloaded functions
and either solution will work.  I was wondering if there was a better way!

And the good news is I haven't written anything for the application yet so
redesign isn't an issue.

Thanks again!

> Hmmz.. if I read this, you have something like
>
[quoted text clipped - 35 lines]
> > Thanks in advance!
> > Paula
Lloyd Dupont - 23 Aug 2005 01:24 GMT
I would say it's a bad idea as it only work with A & B.
what if a class C about which B knows nothing call B?

otherwise look at System.Diagnostic.StackTrace

> Gerrit,
>
[quoted text clipped - 54 lines]
>> > Thanks in advance!
>> > Paula

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.