コード例 #1
0
        public static int GetNextRootId(this HierarchyId element)
        {
            string stringId = element.ToString();

            //provjeri da li je element root
            //root primjer -> /3/
            if (stringId.Count(opt => opt == '/') != 2)
            {
                throw new ArgumentException("Element nije root");
            }

            string cleanId = stringId.Substring(1, stringId.Length - 2);

            if (int.TryParse(cleanId, out int finalId))
            {
                return(finalId + 1);
            }

            throw new ArgumentException("Element nije root");
        }
コード例 #2
0
 public override string ToString() => _imp.ToString();