public static string GetProperty(string line)
{
// (Note, by doing it in two steps, we are assured that even in strange cases like:
// code ; property # comment ; comment
// it will stll work
// Grab from the ; to the #, or the end of the line
//If a comment is not on the line
var propertyWithValue = line.IndexOf('#') == -1 ?
line.Substring(line.IndexOf(';') + 1).Trim() :
line.Substring(line.IndexOf(';') + 1, line.IndexOf('#') - line.IndexOf(';') - 1).Trim();
// Return only from the first ';' to the second ';'
return propertyWithValue.IndexOf(';') != -1 ?
propertyWithValue.Substring(0, propertyWithValue.IndexOf(';')).Trim() :
propertyWithValue;
}