Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decrement operator
Message
From
02/09/2008 08:27:13
 
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01344042
Message ID:
01344061
Views:
12
Viv,

I've had a look with ildasm
class Test
	{
		static private int scaleFactor = 1;
		static public int ScaleFactor
		{
			get { return scaleFactor; }
			set
			{
				if (value == 0)
				{
					scaleFactor = scaleFactor == 1 ? -1 : 1;
				}
				else
					scaleFactor = value;
			}
		}

		static void Main(string[] args)
		{

			//--ScaleFactor;
			int i = --ScaleFactor;
			Console.WriteLine(i);
			Console.ReadLine();
			
		}
		
	}
Ild output of main()

>>>>>>>>>>> = my comments
[ ] = stack
.method private hidebysig static void  Main(string[] args) cil managed
{
  .entrypoint
  // Code size       27 (0x1b)
  .maxstack  2
  .locals init ([0] int32 i)
  IL_0000:  call       int32 Test::get_ScaleFactor()  >>>>>> get value of ScaleFactor
                                 [ 1 ]
  IL_0005:  ldc.i4.1  >>>>>>>>> load constant 1 on the stack
                                [ 1 1 ]
  IL_0006:  sub                           >>>>>>>>>>> subtract constant 1
                               [ 0 ]
  IL_0007:  dup                           >>>>>>>>>>> duplicate the top value of the stack
                              [ 0 0 ]
  IL_0008:  call       void Test::set_ScaleFactor(int32)   >>>>>>>>>>> call the Set
                             [ 0 ]
  IL_000d:  stloc.0   >>>>>>>>>>  store in i
                             [ ]
  IL_000e:  ldloc.0  >>>>>>>>>>> push i on top of the Stack
                            [ 0 ] 
  IL_000f:  call       void [mscorlib]System.Console::WriteLine(int32)   >>>>>>> call WriteLIne
  IL_0014:  call       string [mscorlib]System.Console::ReadLine()
  IL_0019:  pop
  IL_001a:  ret
} // end of method Test::Main
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform