how can i use for(var i:x..y) in C# 8.0 ranges #3939
-
like this: for(var i:1..10)
{
do some thing with i
}
//or
for(var i=1..10)
{
do some thing with i
}
//or
for(var i in 1..10)
{
do some thing with i
}
//or
foreach(var i in 1..10)
{
do some thing with i
} how can i do one of any like that ? |
Beta Was this translation helpful? Give feedback.
Answered by
YairHalberstadt
Sep 25, 2020
Replies: 1 comment 9 replies
-
In c# 9.0 you can reference https://www.nuget.org/packages/RangeForeach/0.0.1 which uses extension foreach, allowing you to do: foreach(var i in 1..10)
{
do some thing with i
} |
Beta Was this translation helpful? Give feedback.
9 replies
Answer selected by
sgf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In c# 9.0 you can reference https://www.nuget.org/packages/RangeForeach/0.0.1 which uses extension foreach, allowing you to do: