3

The first time I'm seeing this syntax:

public static IEnumerable<(string firstPath, string secondPath)> Load() {}

What's with the <()>? In this case, what would the Type for IEnumerable be? Googling for this symbol is hard.

VillageTech
  • 1,968
  • 8
  • 18
Farid
  • 872
  • 1
  • 13
  • 30
  • 4
    Google [C# Tuples](https://learn.microsoft.com/en-us/dotnet/csharp/tuples). This is the combination of the generic syntax `<...>` and the tuple syntax `(...)`. – madreflection Dec 10 '19 at 23:49
  • Ahhh, it's the new Tuple syntax. Thanks! – Farid Dec 10 '19 at 23:53
  • Tuples are like anonymous types now... It does reduce verbosity, which is great, but can cause this kind of confusion... I think we should upvote this question to the Heavens until this is not an issue any more. My humble opinion. – Davi Dec 10 '19 at 23:56
  • @madreflection I don't think it's a duplicate. Even though the answer to both questions is **new Tuple syntax**, the problem each question proposes is entirely different. The person who posted the link to the supposed clone of this one even removed it from the comments, it seems. if I recall correctly, that other question was asking if there was a better way to initialize Tuples, and the answer went all the way into the new syntax. This question is asking what the heck is this type parameter supposed to mean, because from an outsider point of view it looks like no Type parameter has been given – Davi Dec 11 '19 at 00:42
  • 1
    You're absolutely right... nevertheless, it was marked as a duplicate so answers won't be accepted now, and I've since discarded the answer I started. – madreflection Dec 11 '19 at 00:44
  • 1
    @Davi: As an aside, sometimes people delete the automatic comment to gain a measure of anonymity. That doesn't necessarily mean a lack of confidence in the flag that was raised and the flag doesn't get retracted just by deleting the comment. – madreflection Dec 11 '19 at 00:48
  • @madreflection thanks for the insights into SO's rules and user behaviour, and it's ok... Someone will eventually ask this question again (it's inevitable) and we try to get it a lot of votes then, so this tricky issue is finally over, when people know the exact name of what's going on here, and the exact piece of documentation they have to read to understand this once and for all. – Davi Dec 11 '19 at 01:06
  • 1
    @Davi: Upvoting isn't going to help here. As the OP pointed out, googling symbols is difficult. The corollary to that is that they're seeing the symbols without knowing the terminology for it, so *inevitably*, it's going to be asked again with the same inability to connect symbol to terminology, and no amount of upvotes will make that connection for someone. That's why I commented at the start, to make that connection. It was intended to open that door for the OP. Ideally, such questions are self-deleted. – madreflection Dec 11 '19 at 01:15
  • @madreflection are you sure google doesn't eventually catches up? cause I think it does. It's an AI controlled environment... the right amount of determined 4channers can make the AI relate anything to any other thing, bunches of numbers related to some cold crime case... anything, the AI is supposed to catch up with trends. They've done it many times. I think it can also happen naturally... the moment it becomes a completion option it's when it's done. – Davi Dec 11 '19 at 01:25
  • Yes, I'm quite certain. Google can't account for something it ignores in its input. Plain and simple. Try searching for "??"... I just did and I got no results, and yet the syntax has existed in C# since 2005. 14 years and Google can't tell you that it's the null-coalescing operator. Now search for "null-coalescing operator" and you'll get results. That's the kind of connection that search engines are not making and comments like mine on questions like this will still have to make for certain people time and time again. – madreflection Dec 11 '19 at 04:59

0 Answers0