tags:

views:

741

answers:

3

Hi how to use foreach loop in managed code c++ using vs2003.

A: 

I don't think that VC++ has foreach

hkhalifa
well, there is std::for_each, and Boost.Foreach, and normal for loops, so I really don't think you are quite right there
1800 INFORMATION
I don't believe any of those apply automatically to IEnumerable.
Matthew Flaschen
They certainly won't take care of disposing the IEnumerable.
marklam
+3  A: 

I've never used it, but this MSDN article indicates the general syntax is just:

for each(Type t in IEnumerable)
{

}
Matthew Flaschen
It's the same as C# but with a space between for and each.
Skizz
in VS2005 it is ok bur in VS2003 it gives erroe.i dont know y it behaves like that.
Cute
Cute, because it's new in Visual C++ (http://msdn.microsoft.com/en-us/library/xey702bw(VS.80).aspx), not to be confused with Managed Extensions for C++.
Matthew Flaschen
A: 
Aamir
Cite your sources.
Matthew Flaschen