473,395 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get fields in method using Reflection

djp
Hi,

I'm trying to access fields that are local to a method using reflection.
What BindingFlags value should I use and is this possible at all. So far I
was able to retreive class fields only.

Thanks
Nov 22 '05 #1
2 1522
I don't think that is possible. You can get fields of a class, but not fields local to a method

Tu-Thac

----- djp wrote: ----

Hi

I'm trying to access fields that are local to a method using reflection
What BindingFlags value should I use and is this possible at all. So far
was able to retreive class fields only

Thank

Nov 22 '05 #2
Unfortunately that's not possible with current releases of the framework. "Fields" in a method aren't really fields at all, but rather just space
reserved on the stack for local variables. You need to access the IL of the method in question to find these.

-Shawn
http://blogs.msdn.com/shawnfa

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.
--------------------
From: "djp" <a@b.com>
Newsgroups: microsoft.public.dotnet.general
Subject: How to get fields in method using Reflection
Lines: 9
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <8k*******************@wagner.videotron.net>
Date: Wed, 4 Feb 2004 21:58:51 -0500
NNTP-Posting-Host: 24.202.62.229
X-Complaints-To: ab***@videotron.ca
X-Trace: wagner.videotron.net 1075949956 24.202.62.229 (Wed, 04 Feb 2004 21:59:16 EST)
NNTP-Posting-Date: Wed, 04 Feb 2004 21:59:16 EST
Path: cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!newsfeed00.sul.t-online.de!t-online.de!newsfeed.gamma.ru! Gamma.RU!newsfeed.icl.net!newsfeed.fjserv.net!news hosting.com!news-xfer1.atl.newshosting.com!diablo.voicenet.com!wesl ey.videotron.net!
wagner.videotron.net.POSTED!not-for-mailXref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:123724
X-Tomcat-NG: microsoft.public.dotnet.general

Hi,

I'm trying to access fields that are local to a method using reflection.
What BindingFlags value should I use and is this possible at all. So far I
was able to retreive class fields only.

Thanks

Nov 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: djp | last post by:
Hi, I'm trying to access fields that are local to a method using reflection. What BindingFlags value should I use and is this possible at all. So far I was able to retreive class fields only. ...
1
by: MIchael McDowell | last post by:
Anyidea how this might be done using and XML Web Service and the XMLSerialzation class? A pointer to an online example would be deeply appreciated. Thankyou in advance, Michael McD
3
by: J E E | last post by:
Hi! Is it possible to access fields in a derived class using reflection? Code below works fine when I access it as a private member in the Page class, but not when accessing base class member...
1
by: djp | last post by:
Hi, I'm trying to access fields that are local to a method using reflection. What BindingFlags value should I use and is this possible at all. So far I was able to retreive class fields only. ...
3
by: Mike | last post by:
Hello I am trying to read information from the GAL using C# .NET. I am able to return a list of all the addresses and names, however, when I walk through each address I cannot access the...
3
by: Mark | last post by:
Is there a field 'type' that differentiates between a method field and a class field, or are "method fields" and "class fields" as good as I'm going to get? Thanks in advance. Mark
4
by: glenn | last post by:
Is there a way to loop through a classes fields without first knowing what fields are there? Trying to write a generic class that could build a query based on a classes fields and types. This...
4
by: =?Utf-8?B?QWJoaQ==?= | last post by:
I am using Reflection to invoke methods dynamically. I have got a special requirement where I need to pass a value to method by setting the custom method attribute. As I cannot change the...
9
by: AAaron123 | last post by:
DataFormat is a class who's fields are static strings. I'd like a foreach loop that loops over those strings. Actually any way to get a copy of all those strings into an array would work. Can...
6
by: DaveL | last post by:
How Can i Determine if a class Contains a Particular Field Variable Example public class AbastractClass { public int Field1 public int Field2 } public Class Class1:AbstractClass
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.