private static bool CheckForExistenceAndExtractIndex(ref string property, out int index)
{
bool isIndexed = property.IndexOf('[') != -1;
index = -1;
if (isIndexed)
{
int start = property.IndexOf('[') + 1;
int len = property.IndexOf(']', start) - start;
string indexStr = property.Substring(start, len);
try
{
index = Convert.ToInt32(indexStr);
}
catch(Exception)
{
throw new RailsException("Could not convert (param {0}) index to Int32. Value is {1}",
property, indexStr);
}
property = property.Substring(0, start - 1);
}
return isIndexed;
}