I am trying to optimize some code that searches out a single xref layer, and wanted to know if there is a better way than what I put together. It works just fine, but I wanted to make it better.
LayerTableRecord tempLayTR;
tempLayTR = tr.GetObject(tempLayId, OpenMode.ForWrite) as LayerTableRecord;
if (tempLayTR.Name.Contains("|SITE-FNDN"))
{
if (tempLayTR.Name.Substring(tempLayTR.Name.Length - 4) == "FNDN")
{
tempLayTR.Color = Color.FromColorIndex(ColorMethod.ByAci,1);
}
}
There could be multiple layers in the xref that contain the "|SITE-FNDN" ie XREFNAME|SITE-FNDN-TEXT as example.
Thoughts, ideas, etc.