79562574

Date: 2025-04-08 16:22:19
Score: 3
Natty:
Report link

I have the exact same problems

        Dim somedata = jsonHelper.GetPostorDeleteBasedOnPostAndRealBodyData(payLoadString)
        Dim getdeleteorpost = somedata.Item1
        Dim usedPayloadString = somedata.Item2

works fine

but

Dim (getdeleteorpost, usedPayloadString) = jsonHelper.GetPostorDeleteBasedOnPostAndRealBodyData(payLoadString) 

doesn't work

I tried to look around and find this question.

According to chatGPT. VB.net simply doesn't support this.

So your solution for now is to just use this syntax

        Dim somedata = jsonHelper.GetPostorDeleteBasedOnPostAndRealBodyData(payLoadString)
        Dim getdeleteorpost = somedata.Item1
        Dim usedPayloadString = somedata.Item2

Excerpts from my ChatGPT conversation. I am sure it insists it works for VB 15.3+. But now it changes it's mind.

So noone can do VB.NET tuple deconstruction syntax yet

ChatGPT said:

Correct — VB.NET does not support tuple deconstruction syntax like:

vb.net

CopyEdit

Dim (x, y) = GetTuple()

Even in the latest .NET versions (including .NET 9), VB.NET’s language features have remained mostly frozen, and that syntax has never been added.


✅ What's Supported in VB.NET

You can still use tuples — just not with deconstruction:

vb.net

CopyEdit

Dim result = GetStuff() Dim x = result.Item1 Dim y = result.Item2

Or, for better clarity:

vb.net

CopyEdit

Public Function GetStuff() As (name As String, age As Integer) Return ("Alice", 30) End Function

Then access with:

vb.net

CopyEdit

Dim person = GetStuff() Console.WriteLine(person.name) Console.WriteLine(person.age)

✔️ Named tuple fields work.
❌ Deconstruction doesn’t.


⚠️ Why?

Microsoft has shifted VB.NET into maintenance mode. That means:


If you ever switch to C#, you can do tuple deconstruction — but for now, in VB.NET, you’re stuck with Item1, or named fields only. Let me know if you'd like the C# equivalent or tips on making VB.NET cleaner.

Reasons:
  • Blacklisted phrase (0.5): Why?
  • Long answer (-1):
  • Has code block (-0.5):
  • Me too answer (2.5): I have the exact same problem
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: Andri Timur