Click here to Skip to main content
15,917,709 members
Home / Discussions / C#
   

C#

 
Questionhow to zip and unzip folder through c# Pin
mkani23-Aug-05 1:58
mkani23-Aug-05 1:58 
AnswerRe: how to zip and unzip folder through c# Pin
Frank Kerrigan23-Aug-05 2:09
Frank Kerrigan23-Aug-05 2:09 
AnswerRe: how to zip and unzip folder through c# Pin
Bojan Rajkovic23-Aug-05 8:45
Bojan Rajkovic23-Aug-05 8:45 
AnswerRe: how to zip and unzip folder through c# Pin
Anonymous26-Aug-05 7:21
Anonymous26-Aug-05 7:21 
QuestionWhat type of project in c# .net Pin
dabuskol23-Aug-05 0:50
dabuskol23-Aug-05 0:50 
AnswerRe: What type of project in c# .net Pin
Frank Kerrigan23-Aug-05 0:56
Frank Kerrigan23-Aug-05 0:56 
GeneralRe: What type of project in c# .net Pin
dabuskol23-Aug-05 1:24
dabuskol23-Aug-05 1:24 
GeneralRe: What type of project in c# .net Pin
Frank Kerrigan23-Aug-05 1:43
Frank Kerrigan23-Aug-05 1:43 
GeneralMeasuringString with complete accuracy Pin
Anonymous23-Aug-05 0:31
Anonymous23-Aug-05 0:31 
GeneralRe: MeasuringString with complete accuracy Pin
Guffa23-Aug-05 0:46
Guffa23-Aug-05 0:46 
GeneralWindows Event Log Pin
afterdeath22-Aug-05 22:31
afterdeath22-Aug-05 22:31 
GeneralRe: Windows Event Log Pin
leppie22-Aug-05 23:21
leppie22-Aug-05 23:21 
GeneralRe: Windows Event Log Pin
afterdeath22-Aug-05 23:45
afterdeath22-Aug-05 23:45 
GeneralRe: Windows Event Log Pin
leppie22-Aug-05 23:53
leppie22-Aug-05 23:53 
GeneralRe: Windows Event Log Pin
afterdeath23-Aug-05 1:26
afterdeath23-Aug-05 1:26 
Generalc# Word Addin - sinking events Pin
tartancli22-Aug-05 22:00
tartancli22-Aug-05 22:00 
GeneralSendKeys problem Pin
nc3b22-Aug-05 21:54
nc3b22-Aug-05 21:54 
Generalstatic Method And Thread Safety Pin
M.Waseem Chishti22-Aug-05 21:22
M.Waseem Chishti22-Aug-05 21:22 
GeneralRe: static Method And Thread Safety Pin
leppie22-Aug-05 23:25
leppie22-Aug-05 23:25 
GeneralRe: static Method And Thread Safety Pin
M.Waseem Chishti23-Aug-05 0:13
M.Waseem Chishti23-Aug-05 0:13 
GeneralRe: static Method And Thread Safety Pin
Guffa23-Aug-05 0:40
Guffa23-Aug-05 0:40 
GeneralRe: static Method And Thread Safety Pin
HumanOsc22-Aug-05 23:58
HumanOsc22-Aug-05 23:58 
GeneralRe: static Method And Thread Safety Pin
M.Waseem Chishti23-Aug-05 0:15
M.Waseem Chishti23-Aug-05 0:15 
GeneralRe: static Method And Thread Safety Pin
Guffa23-Aug-05 0:06
Guffa23-Aug-05 0:06 
Here is how the IL code looks like:

.method public hidebysig static void HelpMePlease() cil managed
{
      // Code Size: 107 byte(s)
      .maxstack 2
      .locals (
            int32 num1)
      L_0000: ldc.i4.0 
      L_0001: stloc.0 
      L_0002: ldloc.0 
      L_0003: ldc.i4.1 
      L_0004: add 
      L_0005: stloc.0 
      L_0006: ldstr "A must be 1  a :"
      L_000b: ldloca.s num1
      L_000d: call instance string int32::ToString()
      L_0012: call string string::Concat(string, string)
      L_0017: call void [mscorlib]System.Console::WriteLine(string)
      L_001c: ldloc.0 
      L_001d: ldc.i4.1 
      L_001e: add 
      L_001f: stloc.0 
      L_0020: ldstr "A must be 2  a :"
      L_0025: ldloca.s num1
      L_0027: call instance string int32::ToString()
      L_002c: call string string::Concat(string, string)
      L_0031: call void [mscorlib]System.Console::WriteLine(string)
      L_0036: ldloc.0 
      L_0037: ldc.i4.1 
      L_0038: add 
      L_0039: stloc.0 
      L_003a: ldstr "A must be 3  a :"
      L_003f: ldloca.s num1
      L_0041: call instance string int32::ToString()
      L_0046: call string string::Concat(string, string)
      L_004b: call void [mscorlib]System.Console::WriteLine(string)
      L_0050: ldloc.0 
      L_0051: ldc.i4.1 
      L_0052: add 
      L_0053: stloc.0 
      L_0054: ldstr "A must be 4  a :"
      L_0059: ldloca.s num1
      L_005b: call instance string int32::ToString()
      L_0060: call string string::Concat(string, string)
      L_0065: call void [mscorlib]System.Console::WriteLine(string)
      L_006a: ret 
}


.maxstack 2 -- this allocates space for your variable on the stack.

As the local variables are allocated on the stack, every call to the method has it's own set of variables.

Your function is thread safe. (As the Console class is also thread safe, even the writing to the console is thread safe. It might look awful if you have several threads writing to it at the same time, but it's safe.)

---
b { font-weight: normal; }

GeneralRe: static Method And Thread Safety Pin
M.Waseem Chishti23-Aug-05 0:29
M.Waseem Chishti23-Aug-05 0:29 

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.