Coffeehouse Post

Single Post Permalink

View Thread: How are you using Tuple in code?
  • User profile image


    , Dr Herbie wrote

    I have decided that the Tuple<> class is ugly (having to remember which type is 'Item1' and which is 'Item2') and that it should only be used within a class and never used as a result passed out of a public class method or property;


    how else do you return multiple values from a method? out arguments are a bit clunky in that they require the "out" modifier and all the out arguments have to be declared and specified on the call. Declaring a class to be returned is probably ideal, but takes time to code and is another class you have to add to the project.