About 1,560,000 results
Open links in new tab
  1. c# - What and When to use Tuple? - Stack Overflow

    Nov 30, 2012 · A tuple allows you to combine multiple values of possibly different types into a single object without having to create a custom class. This can be useful if you want to write a …

  2. c# - How to name tuple properties? - Stack Overflow

    How and "could be" organized return from the method which returns tuple type with the name of parameters, as an example private static Tuple<string, string> methodTuple() { return new …

  3. c# - What's the difference between System.ValueTuple and …

    The difference between Tuple and ValueTuple is that Tuple is a reference type and ValueTuple is a value type. The latter is desirable because changes to the language in C# 7 have tuples …

  4. c# - Return multiple values to a method caller - Stack Overflow

    @Jakob isn't out the closest thing C# has to native multiple return? The tuple probably is the best option for readability. Personally, I'm not keen on having anonymous types or property names …

  5. c# - How to easily initialize a list of Tuples? - Stack Overflow

    C# 7 will be adding in support for tuples built into the language, though they will be of a different type (System.ValueTuple instead). So to it would be good to add overloads for value tuples so …

  6. How to use c# tuple value types in a switch statement

    Jun 4, 2017 · I'm using the new tuple value types in .net 4.7. In this example I am trying to make a switch statement for one or more cases of a tuple: using System; namespace ValueTupleTest …

  7. c# - Tuple.Create () vs new Tuple - Stack Overflow

    Dec 13, 2014 · new Tuple<int,int>(1,2); Tuple.Create(1,2); Is there any difference between these two methods of Tuple creation? From my reading it seems to be more a convenient shorthand …

  8. When to use: Tuple vs Class in C# 7.0 - Stack Overflow

    Jun 20, 2017 · Tuple is a great option when you want to combine multiple values (can be different types) into one object without creating a custom class. In this case, Tuple would be a fast and …

  9. C# Define a tuple as type - Stack Overflow

    Jul 31, 2022 · protected virtual IEnumerable<(string, string)> GetConfigs() that will be overridden by each child class. I'm looking for a way to define that tuple as type to declare the return type …

  10. C#7 Out Variables with Tuples - Stack Overflow

    C# Tuple deconstruction is only allowed on the left hand side of an assignment statement. Assign the tuple to a temporary variable first: TryGetValue(number, out var t) then deconstruct: var …