Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

Odd construct in IL (private & virtual method)?

$
0
0

I was looking at some IL recently, and noticed a number of odd signatures.  There is a "My" namespace, which suggests that the source language might have been VB.NET.  However, I have worked exclusively with C# in my managed code.

The relevant IL (approx.), followed by my two questions:

.method private
    newslot specialname strictvirtual
    instance class Alpha.Class get_Foo() 

cil managed {
    .maxstack 1
    .locals init (class Alpha.Class V_0)
    IL_0000: ldarg.0
    IL_0001: ldfld class Alpha.Class Alpha.Bravo::_Foo
    IL_0006: ret
}

As you can see, the IL shows a method with both private and virtual attributes.

  1. What source language(s) would, in typical compilation, result in this IL?
  2. What functional differences, if any, between that IL and IL resulting from the use of the "protected" keyword on the method in C#?

I ask because, as far as I can tell, this is a nonsensical combination, yet the IL loads/runs without complaint.

Thanks!


10 years Windows storage drivers | Microsoft Patent Lawyer | LCA - Patents | Microsoft (not giving legal advice)


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>