public static string RemoveComment(String str, String startComment,
String endComment) {
StringBuilder result = new StringBuilder();
int pos = 0;
int end = endComment.Length;
int start = str.IndexOf(startComment, pos);
while (start > -1) {
result.Append(str.Substring(pos, start - pos));
pos = str.IndexOf(endComment, start) + end;
start = str.IndexOf(startComment, pos);
}
result.Append(str.Substring(pos));
return result.ToString();
}
}