Hi, I cannot use the following syntax with is operator type pattern matching. It is just annoyance, but I would like to know official plans, if it will be supported:
public override void _Input(InputEvent event0){
if(event0 is InputEventMouseButton mbe){ //HERE
if(mbe.Pressed && mbe.ButtonIndex == (int)ButtonList.Left){
GD.Print("Click!");
}}}
Errors:
Scripts\Paddle.cs(16,44): error CS1026: ) expected
Scripts\Paddle.cs(16,47): error CS1002: ; expected
Scripts\Paddle.cs(16,47): error CS1513: } expected
Env:
Windows 10 x64
Godotv3.1.1-stablemono
Microsoft (R) Build Engine version 14.0.23107.0
Mono version 5.20.1.19
This works:
if(event0 is InputEventMouseButton){
var mbe = event0 as InputEventMouseButton;
This too:
var mbe = event0 as InputEventMouseButton;
if(mbe != null){
C# style guide says I need to stick with C# 6.0
But in official docs it is used type pattern matching