Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

See current method.


  • Please log in to reply
2 replies to this topic

#1 magarcan

magarcan

    Advanced Member

  • Members
  • PipPipPip
  • 43 posts

Posted 10 January 2012 - 05:16 PM

Do you know any way to see current method name?

I know this two options, but they are for Framework:

1)
MethodBase method = (new StackTrace(true)).GetFrame(0).GetMethod();
string methodname = method.DeclaringType.FullName + "." + method.Name;

2)
MethodBase method = MethodInfo.GetCurrentMethod();
string methodname = method.DeclaringType.FullName + "." + method.Name;
Any idea about how to do it in Micro Framework?

#2 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 10 January 2012 - 09:53 PM

I can't replie with a ready answer, but I would suggest you to have a look at Reflection on MSDN. Probably you'll find something: http://msdn.microsof...y/cc544889.aspx Greets, Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#3 magarcan

magarcan

    Advanced Member

  • Members
  • PipPipPip
  • 43 posts

Posted 11 January 2012 - 09:48 AM

There is another way, but neither works in Micro Framework:
3)
using System.Diagnostics;
// get call stack
StackTrace stackTrace = new StackTrace();
// get calling method name
Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.