C
C#2y ago
n8ta

[resolved] Cs equivalent of (0..10).map [Answered]

In rust I'd write smoething like (0..10).map( to iterate over a range of numbers. Obviously I can do it with a for loop but I'd prefer an IEnumerable that I can select on.
12 Replies
n8ta
n8ta2y ago
I really just want to call a function 10 times and make an IEnumerable out of the results
333fred
333fred2y ago
Enumerable.Range(0, 10).Select(...)
n8ta
n8ta2y ago
That'll do it Thanks
333fred
333fred2y ago
There's a /close command
Accord
Accord2y ago
✅ This post has been marked as answered!
n8ta
n8ta2y ago
Got it, next time
mtreit
mtreit2y ago
You do Rust programming Nathaniel?
n8ta
n8ta2y ago
@mtreit Yes outside work most of what I write is rust.
mtreit
mtreit2y ago
Nice. I have dabbled with it and think it has a lot of potential if it matures well.
n8ta
n8ta2y ago
I enjoy it quite a bit. Much more difficult learning curve than c# but really let's you dive into the details which I love. Definitely not the right tool for every project but a joy in the right niche.
mtreit
mtreit2y ago
I've been trying to find an excuse to use it at work 🙂
n8ta
n8ta2y ago
Haha someone snuck some f# into our codebase and they've never heard the end of it So I will learn from their mistake xD Definitely recommend if you have a chance to use it I've been pleasently surprised by c# (only used it here) and other than null handling I'm quite happy.