public static bool EndsWith(this StringReference s, string text) { if (text.Length > s.Length) { return(false); } char[] chars = s.Chars; int num = s.StartIndex + s.Length - text.Length; for (int index = 0; index < text.Length; ++index) { if ((int)text[index] != (int)chars[index + num]) { return(false); } } return(true); }