.NET Fiddle

CSharp · Console

/Program.cs

using System;
using System.Collections.Generic;	
using System.Linq;

public class Program
{
	public static void Main()
	{
		Console.WriteLine("Two Sum");
		var res = TwoSum(new int[] { 2, 7, 11, 15 }, 9);
		
		Console.WriteLine("Resultado:" + res[0] + "," + res[1]);
	}
	
    public static int[] TwoSum(int[] nums, int target) 
    {
        for(int x = 0; x < nums.Length; x++)
        {
            for(int y = x + 1; y < nums.Length; y++)
            {
                if(nums[x] + nums[y] == target)
                    return new int[] { x, y };
            }
        }

        return null;   
    }
}
;