Longest common substring

Given two strings find the longest common substring

-- If more than two common substring? -- return the first occuring one (of first string??/other?)
private string findthecommon(string string1, string string2)
{
string answer = "";
//Start char i
for (int i = 0; i < string1.Length; i++)
{
// end char j
for (int j = i+1; j < (string1.Length +1); j++)
{
if (answer.Length < (j - i))
{
string tocompare = string1.Substring(i, j - i);

if (string2.IndexOf(tocompare) >= 0)
{
//if (answer.Length < tocompare.Length)
answer = tocompare;
}
}

}
}
return answer ;
}

tested code है क्या?
This is not an optimal code,What is the complexityof this solution?
We can try using more basic 2 dimensional arrays.