I had read about Tuples, which was presented at the output of the new .NET Framework features, and yet I wonder how it can be useful in enterprise applications of the real world.
Tuples
Can anyone give me a brief explanation along with a simple real-world code example?
Thank! =)
Tuples are currently not as significant in C # because there is no clear syntax for them. However, the concept is very common in functional languages โโsuch as F # (new to .NET 4.0).
, F # , F #, . #, , . , Item1 ItemX, . .
Item1
ItemX
, ( ) , , , - .
- .
, . .
:
return new Tuple<int, string, char>(1, "some string", 10.00);
-
public class ReturnMany { public int intValue { get; set; } public string strValue { get; set; } public decimal decValue { get; set; } } return new ReturnMany() { intValue = 1, strValue = "some string", decValue = 10.00 }
Tuples in .NET are immutable, so they are also an easy way to pass a bunch of values โโaround threads. I am currently using tuples with Retlang, and they are great for use with this type of library.
Source: https://habr.com/ru/post/1747421/More articles:What is equivalent to "UIImageView" for sprite animations on OSX? - iphoneSkip HTML output in special label_tag helper in Rail 3 - ruby โโ| fooobar.comCancel button for System.Drawing? - c #HQL to JPQL Question - hibernateWhat is the most polished OSS ticketing system? - emailIPhone application and programming updates - iphoneHow to check SQLite3 syntax? - syntax-checkingWhat does a basic C code dump mean? - cHelp with a simple query - why not using an index? - sql-serverHow can I clear the content without fear, "stop working with this script?" dialogue? - javascriptAll Articles