<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Modify the given C# program to count all the vowels in a given string.
string str = "This is a sample string.";<|im_end|>
<|im_start|>assistant
string str = "This is a sample string.";
int count = 0; 
 
foreach (char ch in str) 
{ 
    switch (ch) 
    { 
        case 'a': 
        case 'e': 
        case 'i': 
        case 'o': 
        case 'u': 
            count++; 
            break; 
    } 
} 

Console.WriteLine("Number of vowels in the given string: " + count);<|im_end|>
