Click here to Skip to main content
15,921,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
foreach(string s in Array)
{
    if (file.exists(s))
    {
        count++;
    }
}

Now i want to get the HIGHEST VALUE reached in my "COUNT"? to put it into Global variable.
Posted
Updated 22-Apr-13 4:31am
v4
Comments
ZurdoDev 22-Apr-13 10:25am    
What? You only have one count variable so whatever it is, that's the highest.
Friendsaa 22-Apr-13 10:30am    
My foreach loop is executing till my array items finished

i want to get programmatically how many files it counted. and i want to put that value in global variable.

1 solution

I don't exactly get what you mean by "global variable" as everything you can define in C# is part of a class. So I'll just presume you have a class called Global with a static field or property called NumberOfExistingFiles the type of which matches the type of variable count.

C#
foreach(string s in Array)
{
    if (file.exists(s))
    {
        count++;
    }
}
Global.NumberOfExistingFiles = count;


That's all!

Regards,
— Manfred
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900