Improve C# compatibility