hi i want to remove a file extension from a string how can i do this ?

DirectoryInfo di = new DirectoryInfo(@"threads/");
FileInfo[] threads = di.GetFiles("*.aspx");

foreach (FileInfo file in threads)
{
string x = file.Name;
char[] y = x.ToCharArray();
int i = x.Length;
char[] j;
int t = 0;

while (t < (i - 4))
{
j[t] = y[t];
t++;
}

Literal1.Text = "<a href=" + x +">" + x + "</a>";
}