ValueTuple naming conventions [closed]
When naming ValueTuple elements is there a convention if they should be capitalized or not ?
(string Name, int Index) rec;
or
(string name, int index) rec;
thanks
c# naming-conventions c#-7.0
closed as primarily opinion-based by TylerH, Hans Kesting, EdChum, James Coyle, Pac0 Nov 16 '18 at 11:33
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
|
show 2 more comments
When naming ValueTuple elements is there a convention if they should be capitalized or not ?
(string Name, int Index) rec;
or
(string name, int index) rec;
thanks
c# naming-conventions c#-7.0
closed as primarily opinion-based by TylerH, Hans Kesting, EdChum, James Coyle, Pac0 Nov 16 '18 at 11:33
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
1
To be consistent withTuple
propertiesItem1
andItem2
, it would be capitalized.
– Jasen
Nov 16 '18 at 3:29
1
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt(string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.
– David Arno
Nov 17 '18 at 7:22
2
@Jasen, the fact that tuples areTuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.
– David Arno
Nov 17 '18 at 7:23
2
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32
|
show 2 more comments
When naming ValueTuple elements is there a convention if they should be capitalized or not ?
(string Name, int Index) rec;
or
(string name, int index) rec;
thanks
c# naming-conventions c#-7.0
When naming ValueTuple elements is there a convention if they should be capitalized or not ?
(string Name, int Index) rec;
or
(string name, int index) rec;
thanks
c# naming-conventions c#-7.0
c# naming-conventions c#-7.0
edited Nov 16 '18 at 2:36
JohnB
1,94511320
1,94511320
asked Nov 16 '18 at 0:22
kofifuskofifus
3,70033459
3,70033459
closed as primarily opinion-based by TylerH, Hans Kesting, EdChum, James Coyle, Pac0 Nov 16 '18 at 11:33
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as primarily opinion-based by TylerH, Hans Kesting, EdChum, James Coyle, Pac0 Nov 16 '18 at 11:33
Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.
1
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
1
To be consistent withTuple
propertiesItem1
andItem2
, it would be capitalized.
– Jasen
Nov 16 '18 at 3:29
1
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt(string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.
– David Arno
Nov 17 '18 at 7:22
2
@Jasen, the fact that tuples areTuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.
– David Arno
Nov 17 '18 at 7:23
2
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32
|
show 2 more comments
1
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
1
To be consistent withTuple
propertiesItem1
andItem2
, it would be capitalized.
– Jasen
Nov 16 '18 at 3:29
1
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt(string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.
– David Arno
Nov 17 '18 at 7:22
2
@Jasen, the fact that tuples areTuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.
– David Arno
Nov 17 '18 at 7:23
2
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32
1
1
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
1
1
To be consistent with
Tuple
properties Item1
and Item2
, it would be capitalized.– Jasen
Nov 16 '18 at 3:29
To be consistent with
Tuple
properties Item1
and Item2
, it would be capitalized.– Jasen
Nov 16 '18 at 3:29
1
1
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured
(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt (string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.– David Arno
Nov 17 '18 at 7:22
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured
(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt (string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.– David Arno
Nov 17 '18 at 7:22
2
2
@Jasen, the fact that tuples are
Tuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.– David Arno
Nov 17 '18 at 7:23
@Jasen, the fact that tuples are
Tuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.– David Arno
Nov 17 '18 at 7:23
2
2
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32
|
show 2 more comments
1 Answer
1
active
oldest
votes
Look at tuple as bags of variables and, as such, the convention is to use camel case.
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
A tuple is a bag of values/variables.List<(int index, string name)>
is a list of bags of variables.
– Paulo Morgado
Nov 16 '18 at 7:13
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Look at tuple as bags of variables and, as such, the convention is to use camel case.
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
A tuple is a bag of values/variables.List<(int index, string name)>
is a list of bags of variables.
– Paulo Morgado
Nov 16 '18 at 7:13
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
add a comment |
Look at tuple as bags of variables and, as such, the convention is to use camel case.
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
A tuple is a bag of values/variables.List<(int index, string name)>
is a list of bags of variables.
– Paulo Morgado
Nov 16 '18 at 7:13
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
add a comment |
Look at tuple as bags of variables and, as such, the convention is to use camel case.
Look at tuple as bags of variables and, as such, the convention is to use camel case.
answered Nov 16 '18 at 1:01
Paulo MorgadoPaulo Morgado
6,11811533
6,11811533
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
A tuple is a bag of values/variables.List<(int index, string name)>
is a list of bags of variables.
– Paulo Morgado
Nov 16 '18 at 7:13
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
add a comment |
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
A tuple is a bag of values/variables.List<(int index, string name)>
is a list of bags of variables.
– Paulo Morgado
Nov 16 '18 at 7:13
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
1
1
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
would that still hold for ie: List<(int index, string name)> ? here it feels more of a struct than a bag of vars ?
– kofifus
Nov 16 '18 at 2:17
3
3
A tuple is a bag of values/variables.
List<(int index, string name)>
is a list of bags of variables.– Paulo Morgado
Nov 16 '18 at 7:13
A tuple is a bag of values/variables.
List<(int index, string name)>
is a list of bags of variables.– Paulo Morgado
Nov 16 '18 at 7:13
1
1
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
+1 One of the design principles of tuples was that they should mirror argument lists—again, a bag of variables.
– jnm2
Nov 17 '18 at 13:20
add a comment |
1
hmm, this is hard, i found online example that uses the lowercase one but it uses PascalCase on some.. but really, coding convention is depend on where you put the code..
– Bagus Tesa
Nov 16 '18 at 0:41
1
To be consistent with
Tuple
propertiesItem1
andItem2
, it would be capitalized.– Jasen
Nov 16 '18 at 3:29
1
Sadly, this looks set to become a source of conflicting advice. The C# language team have always favoured
(string name, int index)
in all the code examples I've seen from them. Unfortunately, the BCL team look set to adopt(string Name, int Index)
though. Hopefully they'll reconsider and we can all agree on the former being the "right" choice.– David Arno
Nov 17 '18 at 7:22
2
@Jasen, the fact that tuples are
Tuple
structs under the hood is just an implementation detail. To my mind, that isn't a valid reason for using CamelCase with the tuple syntax, which hides away that implementation detail.– David Arno
Nov 17 '18 at 7:23
2
@kofifus even Microsoft's core developers can't agree on naming conventions. The only thing they agree on is that ValueTuple should probably not be used in public APIs. Everywhere else, the name doesn't really matter
– Panagiotis Kanavos
Nov 27 '18 at 9:32