What's __PostIncrement in decompiled VB (by ILSpy)

I was just perusing the decompiled code for System.Collections.Generic.List(Of T).Add(item As T) using ILSpy and I found a call to __PostIncrement. I've never heard of such a thing in VB, so I did some digging and found:

  1. In VB, the code is Me._items(__PostIncrement(Me._size)) = item.
  2. In C#, the code is this._items[this._size++] = item; using the actual post-increment operator in that language
  3. In MSIL, there is not a function call. It appears to work like a C# post-increment would (the comments are mine, but I'm no expert at MSIL,so I could be wrong).

The code is:

IL_001e: ldarg.0
IL_001f: ldfld !0[] class System.Collections.Generic.List`1<!T>::_items
IL_0024: ldarg.0
IL_0025: dup
IL_0026: ldfld int32 class System.Collections.Generic.List`1<!T>::_size
IL_002b: dup
IL_002c: stloc.0           // store the size pre incrementing
IL_002d: ldc.i4.1
IL_002e: add               // do the increment
IL_002f: stfld int32 class System.Collections.Generic.List`1<!T>::_size
IL_0034: ldloc.0           // reload the stored size to use as index in stelem
IL_0035: ldarg.1
IL_0036: stelem.any !T

What exactly is this __PostIncrement? Is it a SharpDevelop invention to symbolize post-increment IL code in VB? Or is it actually some kind of definition I could use in my own VB code?

Answers


__PostIncrement is the equivalent of the C# operator++. It is a quick way to increment (add one) to a number. Unfortunately, according to the list of operators in Visual Basic, there is no equivalent.


Need Your Help

LINQ: Order By Count of most common value

c# linq lambda

I'm trying to create an "ordered" List of objects in c#, where the list will be ordered by the most common occurrences of values in ImdbId property.

Exporting my android app to iphone?

java android iphone c

Ive made an app on Android and I want to be able to sell the app for iphone and android. I dont want to have to learn objective C. Is there any possible way I can do this?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.