KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
All code written in .NET languages compiles to MSIL, but are there specific tasks / operations that you can do only using MSIL directly? Let us also have things done easier in MSIL than C#, VB.NET, F#, j# or any other .NET language. So far we have this: Tail recursion Generic Co/Contravariance (allowed in C# 4 and VB 10) Overloads which differ only in return types Override access modifiers Have a class which cannot inherit from System.Object Filtered exceptions (allowed in VB, and C# 6) Calling a virtual method of the current static class type. Get a handle on the boxed version of a value type. Do a try/fault. Usage of forbidden names. Define your own parameterless constructors for value types . Define events with a raise element. Some conversions allowed by the CLR but not by C#. Make a non main() method as the .entrypoint . work with the native int and native unsigned int types directly. Play with transient pointers emitbyte directive in MethodBodyItem Throw and catch non System.Exception types Inherit Enums (Unverified) You can treat an array of bytes as a (4x smaller) array of ints. You can have a field/method/property/event all have the same name(Unverified). You can branch back into a try block from its own catch block. You have access to the famandassem access specifier ( protected internal is fam or assem, but now allowed in C# 7.2 and VB 15.5) Direct access to the <Module> class for defining global functions, or a module initializer. Create and use non-zero-bound 1-based arrays<
Tags (comma-separated)
Save Edits
Cancel