Click here to Skip to main content
15,914,416 members
Home / Discussions / C#
   

C#

 
GeneralRe: SQL Server Express connection problems Pin
mav.northwind8-Jul-07 2:45
mav.northwind8-Jul-07 2:45 
QuestionHow to Get Current Type from within a Static Method Pin
Waleed Eissa7-Jul-07 22:42
Waleed Eissa7-Jul-07 22:42 
AnswerRe: How to Get Current Type from within a Static Method Pin
mav.northwind7-Jul-07 23:00
mav.northwind7-Jul-07 23:00 
GeneralRe: How to Get Current Type from within a Static Method Pin
Waleed Eissa7-Jul-07 23:28
Waleed Eissa7-Jul-07 23:28 
GeneralRe: How to Get Current Type from within a Static Method Pin
Daniel Grunwald8-Jul-07 5:41
Daniel Grunwald8-Jul-07 5:41 
GeneralRe: How to Get Current Type from within a Static Method Pin
mav.northwind8-Jul-07 6:22
mav.northwind8-Jul-07 6:22 
GeneralRe: How to Get Current Type from within a Static Method Pin
Daniel Grunwald8-Jul-07 6:33
Daniel Grunwald8-Jul-07 6:33 
GeneralRe: How to Get Current Type from within a Static Method Pin
mav.northwind8-Jul-07 6:59
mav.northwind8-Jul-07 6:59 
OMG | :OMG: that's not what I expected...
Fortunately, there's an attribute to keep the JIT from inlining if you have to rely on the correct information from StackFrame: System.Runtime.CompilerServices.MethodImplAttribute
If you write
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;

namespace StackFrameTest
{
	class Program
	{
		public static void Main(string[] args)
		{
			if (Debugger.IsAttached) {
				Console.WriteLine("Inlining might be disabled when using the debugger");
			}
			#if DEBUG
			Console.WriteLine("Inlining might be disabled in debug builds");
			#endif
			Test();
			Console.ReadKey();
		}
		
		[MethodImpl(MethodImplOptions.NoInlining)]
		static void Test()
		{
			Console.WriteLine(new StackFrame().GetMethod().Name);
		}
	}
}
then the output will be as one would expect.


Regards,
mav

--
Black holes are the places where God divided by 0...

AnswerRe: How to Get Current Type from within a Static Method Pin
Robert Rohde8-Jul-07 0:10
Robert Rohde8-Jul-07 0:10 
GeneralRe: How to Get Current Type from within a Static Method Pin
Urs Enzler8-Jul-07 2:56
Urs Enzler8-Jul-07 2:56 
GeneralRe: How to Get Current Type from within a Static Method Pin
Robert Rohde8-Jul-07 5:57
Robert Rohde8-Jul-07 5:57 
QuestionUpdate Query in MS Access Pin
DKalepu7-Jul-07 21:45
DKalepu7-Jul-07 21:45 
AnswerRe: Update Query in MS Access Pin
Robert Rohde8-Jul-07 0:08
Robert Rohde8-Jul-07 0:08 
GeneralRe: Update Query in MS Access Pin
DKalepu8-Jul-07 2:31
DKalepu8-Jul-07 2:31 
AnswerRe: Update Query in MS Access Pin
Muhammad Gouda8-Jul-07 1:09
Muhammad Gouda8-Jul-07 1:09 
GeneralRe: Update Query in MS Access Pin
DKalepu8-Jul-07 2:38
DKalepu8-Jul-07 2:38 
GeneralRe: Update Query in MS Access Pin
Muhammad Gouda8-Jul-07 2:47
Muhammad Gouda8-Jul-07 2:47 
GeneralRe: Update Query in MS Access Pin
DKalepu8-Jul-07 2:55
DKalepu8-Jul-07 2:55 
GeneralRe: Update Query in MS Access Pin
Muhammad Gouda8-Jul-07 3:02
Muhammad Gouda8-Jul-07 3:02 
GeneralRe: Update Query in MS Access Pin
DKalepu8-Jul-07 3:38
DKalepu8-Jul-07 3:38 
GeneralRe: Update Query in MS Access Pin
Robert Rohde8-Jul-07 6:00
Robert Rohde8-Jul-07 6:00 
GeneralRe: Update Query in MS Access Pin
DKalepu8-Jul-07 19:17
DKalepu8-Jul-07 19:17 
Questioninteresting Pin
sarvenaz847-Jul-07 21:27
sarvenaz847-Jul-07 21:27 
AnswerRe: interesting Pin
mav.northwind7-Jul-07 22:11
mav.northwind7-Jul-07 22:11 
QuestionDrive Info Pin
shir17-Jul-07 20:28
shir17-Jul-07 20:28 

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.