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.
foreach(string s in Array)
{
if (file.exists(s))
{
count++;
}
}
Global.NumberOfExistingFiles = count;
That's all!
Regards,
— Manfred