DoWhile in C# - OK - I need some help here bacause
... I admit, I only use DoWhile once in say 5 to 10 years, but when I need it, wow it's perfect, and now I have a great case for it on a personal project. Simple in c, c++ but have not tried it in c# until tonight. Yea I can get around it, but want to understand what is wrong with my environment/load/something better.
[MSDN says][1]
:
"DoWhile Class
A looping activity that executes contained activities at least once, until a condition is no longer true.
Namespace: System.Activities.Statements Assembly: System.Activities (in System.Activities.dll)"
I can't find the System.Activities.dll in the .Net references. I've unloaded all m开发者_StackOverflowy previous vs loads so only have vs2010.
Anyone out there tried this? I'm probably missing something simple.
Thanks - Old Man
Just use the do/while block:
int i = 0;
do
{
i++;
} while (i < 10);
System.Activities.DoWhile
is for Windows Workflow Foundation workflows.
I assume you're trying to make a simple do
loop.
You need to use the do
and while
keywords, like this:
do {
things;
} while(condition);
The DoWhile
class is a completely unrelated class that is used to make loops in Workflows.
精彩评论