Skip to content

[Proposal] Introduce Dim tuple syntax, discards, and inline Dim for out variables #636

@Pac-Dessert1436

Description

@Pac-Dessert1436

Summary

VB.NET does not yet support Dim tuple deconstruction syntax, despite consistent community requests dating back to 2018 (see: dotnet/vblang#346). As of 2026, modern coding tools and third-party extensions have begun emulating this syntax, highlighting strong demand for first-class support.

This feature would bring VB.NET parity with modern tuple patterns, improve code brevity, and simplify common patterns like deconstruction, inline out variables, and value discards.

Proposed Syntax & Examples

1. Tuple Deconstruction with Dim (Type Inference & Explicit Typing)

Support direct tuple deconstruction using the Dim statement, with both inferred and explicit type support:

' Dim tuple syntax with local type inference
Dim (a, b) = (3, 5)

' Explicit type annotation for tuple elements
Dim (a As Integer, b As Integer) = (3, 5)

2. Discard Slots (Empty Deconstruction Slots)

Allow empty slots in tuple deconstruction to discard unused values (a common and useful pattern in modern .NET languages):

' Discard the first value; assign only the second and third elements
Dim (, a, b) = (3, 5, 7)
' Result: a = 5, b = 7; first value (3) is ignored

3. Inline Dim for C#'s out Variables

Simplify the usage of C#'s out parameters in VB.NET with inline Dim syntax (automatic type inference, no pre-declaration required):

Dim input = Console.ReadLine()

' Inline Dim for out variable - type is inferred automatically
If Integer.TryParse(input, Dim x) Then
    ' x is strongly typed as Integer
    Dim y = 3 * x - 2
    Console.WriteLine("x = {0}, y = {1}", x, y)
End If

' Discard the out variable entirely using an empty slot
If Integer.TryParse(input, ) Then Console.WriteLine("Input is a valid integer.")

Motivation & Benefits

  1. Modernize VB.NET: Align with contemporary .NET language patterns for tuples and discards.
  2. Reduce Boilerplate: Eliminate redundant variable declarations for out parameters and tuple unpacking.
  3. Community Demand: Long-requested feature with widespread support from VB.NET developers.
  4. Tooling Consistency: Match the behavior already being emulated by popular coding tools.

In conclusion, as both a C# and VB.NET developer, I strongly encourage the VB.NET language team to prioritize implementing this critical productivity feature. Many thanks for your consideration!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions