Skip to content

Support DeclarationExpression for method calls with out parameters #43

Open
@ArcanoxDragon

Description

@ArcanoxDragon

Feature Description:
If it's possible to implement, it would be nice for UdonSharp to support C#'s DeclarationExpression for methods with out parameters, such as int.TryParse. This would allow the following code:

int someValue;

if (int.TryParse(inputField.text, out someValue))
{
    // do something with someValue
}

to be condensed into:

if (int.TryParse(inputField.text, out var someValue))
{
    // do something with someValue
}

Should probably also support the discard syntax:

var isNumberValid = int.TryParse(inputField.text, out _);

I know it's only a minor improvement to convenience, but it'd be nice to have if it's an easy addition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions