diff --git a/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs b/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs index a2b21e7cb..6a6dc31e0 100644 --- a/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs +++ b/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs @@ -392,7 +392,11 @@ namespace Antlr4.Runtime.Atn Collections.EmptyList(); List result = collection.OfType().ToList(); +#if NET_4_0 collection.ExceptWith(result); +#else + collection.ExceptWith(result.Cast()); +#endif return result; } }