Jump to content
Tuts 4 You

MSIL : Endfilter Opcode


Recommended Posts

The version lower than C#6 compiler can produce the Endfilter Opcode? What C# code?

Version higher than C#6 can produce the Endfilter Opcode.

   throw new ApplicationException("Error");
catch (ApplicationException ex) when (ex.Message == "Error")


Edited by Perplex
Link to comment

Exception filters were added to C# in v6, so you need to use a compiler and such that supports it. VS2015 was the main IDE that included and supported it first, then any edition afterward. However, you can manually use the Roslyn compiler to support it in any version as well: https://github.com/dotnet/roslyn

But if you are looking to target C# 5 or lower, then you will not be able to use the feature. (The .NET framework and it's various libs are open source now so you can technically manually go add the features you want to a lower version of the framework but it would be non-standard and unsupported on others systems.)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...