using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
try
{
string url = "www.website.net";
string[] extensions = { ".com", ".net", ".org" };
foreach (string ext in extensions)
{
if (url.EndsWith(ext))
{
Console.WriteLine(ext); // .net
return;
}
}
Console.WriteLine("extension not found");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}
/*
run:
.net
*/