Click here to Skip to main content
15,896,606 members
Home / Discussions / C#
   

C#

 
Questionbehavior of Value Tuples in .NET 4.7 Pin
BillWoodruff19-Jun-17 6:24
professionalBillWoodruff19-Jun-17 6:24 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Nathan Minier19-Jun-17 7:05
professionalNathan Minier19-Jun-17 7:05 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:36
professionalBillWoodruff20-Jun-17 6:36 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
Nathan Minier20-Jun-17 7:34
professionalNathan Minier20-Jun-17 7:34 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Eddy Vluggen19-Jun-17 21:55
professionalEddy Vluggen19-Jun-17 21:55 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:34
professionalBillWoodruff20-Jun-17 6:34 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
Eddy Vluggen20-Jun-17 8:37
professionalEddy Vluggen20-Jun-17 8:37 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 15:39
professionalBillWoodruff20-Jun-17 15:39 
Hi, Eddy, Skepticism is good fertilizer for the growth of judgement Smile | :)

I, too, see the downsides of using this feature, particularly in a team setting where everyone is not "on the same page."

I think you might find Mads Torgensen's comments on the mutability of ValueTuple interesting: quoted in InfoQ article by Jonathan Allen: [^]
Quote:
An interesting note about ValueTuple is that it is mutable. Mads Torgersen explains why,

The reasons why mutable structs are often bad, don't apply to tuples.

If you write a mutable struct in the usual encapsulated way, with private state and public, mutator properties and methods, then you are in for some bad surprises. The reason is that whenever those structs are held in a readonly variable, the mutators will silently work on a copy of the struct!

Tuples, however, simply have public, mutable fields. By design there are no mutators, and hence no risk of the above phenomenon.

Also, again because they are structs, they are copied whenever they are passed around. They aren't directly shared between threads, and don't suffer the risks of "shared mutable state" either. This is in contrast to the System.Tuple family of types, which are classes and therefore need to be immutable to be thread safe."

GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
Eddy Vluggen21-Jun-17 3:45
professionalEddy Vluggen21-Jun-17 3:45 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Bernhard Hiller19-Jun-17 22:46
Bernhard Hiller19-Jun-17 22:46 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:44
professionalBillWoodruff20-Jun-17 6:44 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Richard Deeming20-Jun-17 0:50
mveRichard Deeming20-Jun-17 0:50 
GeneralRe: behavior of Value Tuples in .NET 4.7 Pin
BillWoodruff20-Jun-17 6:50
professionalBillWoodruff20-Jun-17 6:50 
AnswerRe: behavior of Value Tuples in .NET 4.7 Pin
Gerry Schmitz21-Jun-17 3:15
mveGerry Schmitz21-Jun-17 3:15 
QuestionRemoving an element from the content of a string value which is HTML code Pin
Farhad Eft19-Jun-17 1:55
Farhad Eft19-Jun-17 1:55 
AnswerRe: Removing an element from the content of a string value which is HTML code Pin
OriginalGriff19-Jun-17 2:12
mveOriginalGriff19-Jun-17 2:12 
GeneralRe: Removing an element from the content of a string value which is HTML code Pin
Farhad Eft19-Jun-17 2:46
Farhad Eft19-Jun-17 2:46 
GeneralRe: Removing an element from the content of a string value which is HTML code Pin
OriginalGriff19-Jun-17 2:55
mveOriginalGriff19-Jun-17 2:55 
QuestionWindows media player issue Pin
Member 1326418716-Jun-17 20:37
Member 1326418716-Jun-17 20:37 
AnswerRe: Windows media player issue Pin
OriginalGriff16-Jun-17 21:34
mveOriginalGriff16-Jun-17 21:34 
QuestionChanging an Image during runtime from resources Pin
Member 1319657416-Jun-17 5:10
Member 1319657416-Jun-17 5:10 
AnswerRe: Changing an Image during runtime from resources Pin
BillWoodruff17-Jun-17 13:12
professionalBillWoodruff17-Jun-17 13:12 
QuestionSystem.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 21:46
joost.versteegen14-Jun-17 21:46 
AnswerRe: System.IndexOutOfRangeException Pin
OriginalGriff14-Jun-17 22:19
mveOriginalGriff14-Jun-17 22:19 
GeneralRe: System.IndexOutOfRangeException Pin
joost.versteegen14-Jun-17 22:26
joost.versteegen14-Jun-17 22:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.