input: Write a function to convert a given Python program to a C# program. The function should take a Python function as input and return its equivalent C# function.
  
  assert convert_to_csharp("def power(x, y):\n    if y == 0:\n        return 1\n    else:\n        return x * power(x, y - 1)") == "public int Power(int x, int y)\n{\n    if (y == 0)\n    {\n        return 1;\n    }\n    else\n    {\n        return x * Power(x, y - 1);\n    }\n}"
  assert convert_to_csharp("def greet(name):\n    return 'Hello, ' + name") == "public string Greet(string name)\n{\n    return 'Hello, ' + name;\n}"
  assert convert_to_csharp("def add(a, b):\n    return a + b") == "public int Add(int a, int b)\n{\n    return a + b;\n}"
  assert convert_to_csharp("def square(x):\n    return x * x") == "public int Square(int x)\n{\n    return x * x;\n}"
  assert convert_to_csharp("def is_even(n):\n    return n % 2 == 0") == "public bool IsEven(int n)\n{\n    return n % 2 == 0;\n}"
output: def convert_to_csharp(python_code):
      lines = python_code.strip().split('\n')
      function_def = lines[0]
      function_name = function_def.split('(')[0].split()[-1]
      params = function_def.split('(')[1].split(')')[0].split(', ')
      param_types = ['int' if p.isdigit() else 'string' for p in params]
      return_type = 'int' if 'return' in python_code and python_code.split('return')[1].strip().isdigit() else 'string' if 'return' in python_code and "'" in python_code.split('return')[1] else 'bool'
      
      csharp_function = f"public {return_type} {function_name.capitalize()}({', '.join([f'{t} {p}' for t, p in zip(param_types, params)])})\n{{\n"
      
      for line in lines[1:]:
          if line.strip().startswith('return'):
              return_statement = line.strip().replace('return', '').strip()
              if return_type == 'string':
                  return_statement = return_statement.replace("'", '"')
              csharp_function += f"    return {return_statement};\n"
          elif line.strip().startswith('if'):
              condition = line.strip().replace('if', '').strip()
              csharp_function += f"    if ({condition})\n    {{\n"
          elif line.strip().startswith('else'):
              csharp_function += "    }\n    else\n    {\n"
          elif line.strip().startswith('return'):
              return_statement = line.strip().replace('return', '').strip()
              if return_type == 'string':
                  return_statement = return_statement.replace("'", '"')
              csharp_function += f"    return {return_statement};\n"
      
      csharp_function += "}"
      return csharp_function