C# Needs Seqs(www.kodefuguru.com)
submitted by KodefuGuru(2818) 3 months, 18 days ago
A proposition for a new keyword in C# to support IEnumberable<T>.
3 comments |category: C# |Views: 376 Tweet
tags: C# another
Add a live kick counter to your blog >>
You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:
Simply copy and paste this HTML into your blog post.
posted by dpeterson(4397) 3 months, 17 days ago 0
So rather than writing IEnumerable(t) we write seq(t), or is seq(t) in addition to IEnumerable(t)? Sequence implies that there's an order, but being IEnumerable(t) means that there isn't a particular order unless we specify how it's sorted (being that the types are generic). A set, however, doesn't imply order, so maybe it could be set(t)?
Reply
posted by KodefuGuru(2818) 3 months, 17 days ago 0
I propose seq as an alias keyword, like string is an alias for System.String. I'm going to write an article on sequences versus sets, because I was thrown when someone else brought it up. In a sequence, order matters. This means a sequence is unique if an element differs from the comparison sequence at any position. In a set, order doesn't matter. A lottery ticket is a set. The konami code is a sequence. Here's another way to look at it a = 1, 2, 3 b = 3, 2, 1 If a and b are sets, they are identical. If a and b are sequences, they are different. So, the difference between a set and a sequence is that order matters for the latter. But there's more! Sets must contain unique values. {1, 1, 2, 3} is the same as {1, 2, 3}, because 1 is merely repeated in the former's definition. I think it's pretty clear that we're referring to a sequence with IEnumerable<T>. Using that term would maintain consistency with other languages as well.
posted by dpeterson(4397) replied to KodefuGuru(2818), 3 months, 17 days ago 0
Thanks for following up, that makes sense. I didn't think about the issue of uniqueness with sets.
All tags Your tags
Suggest a new category
dpeterson(1273)
Telerik(409)
fdub(381)
amit.jain(268)
BlackWasp(259)
RobertTheGrey(259)
jalpesh(252)
bsenoff(240)
KMillerr(226)
vijayst(223)