What is the difference between anonymous type and tuple?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Anonymous types have property names which carry more information, for tuples you don’t have this. You can’t use anonymous types as return values and parameters though and you can with tuples.
An example of when a tuple is nice is when you want to return multiple values. @Petar Minchev mentions this link which gives a good example.
You may want a
Find()method that returns both an index and the value. Another example would be the position in a 2d or 3d plane.