private static void FixAccessor(PropertyAccessor accessor, string textToInsert, int insertionIndex) { if (accessor != null) { // Need to set the text range of the get {} var accessorText = accessor.ToString().Trim(); int startIndex = textToInsert.IndexOf(accessorText) + insertionIndex; int endIndex = startIndex + accessorText.Length; accessor.TextRange.StartOffset = startIndex; accessor.TextRange.EndOffset = endIndex; } }