예제 #1
0
        public static int Replace <T>(this HashSet <T> source, int p, T value)
        {
            var result = ((p < source.Count()) && (p >= 0) &&
                          source.Remove(source.ElementAt(p))) ? 1 : 0;
            var resultInsert = source.Insert(p, value, true);

            return(result | (resultInsert & 2));
        }