المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : i need help



C# Programming
11-03-2009, 04:24 AM
hi

i read file its extention cs

and i read it line by line
i want to knwo if this line is a header of method or not

how can i know if this line is a header of method or just a line of code

i try with this but not valid



private bool validLine(string s)
{
string[] spliter = s.Split('(');
string check = spliter[0];

string check2=check.Replace(" ","");

if (check2.StartsWith("if")
||check2.StartsWith("//")
||check2.StartsWith("for")
||check2.StartsWith("foreach")
||check2=="using"
|| s.StartsWith("if")
||s.StartsWith("///")
||s.StartsWith("for")
||s.StartsWith("using")
||s.StartsWith("foreach")
|| s.EndsWith(";")
|| s.EndsWith("}")
|| s.EndsWith("{")
|| !s.EndsWith(")")
||string.IsNullOrEmpty(s))

return false;

else

return true;
}



but i think this is not cover all cases