-
-
Save SriramSakthivel/66ac5c63a369732672ec to your computer and use it in GitHub Desktop.
Snippet to show that C# compiler emits call for instance methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
SomeClass sc = new SomeClass(); | |
sc.DoSomething();//callvirt is emitted | |
new SomeClass().DoSomething();//call is emitted | |
} | |
public class SomeClass | |
{ | |
public void DoSomething() | |
{ | |
Console.WriteLine("I'm doing something"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment