/// <summary> /// Method for taking input from user /// </summary> /// <returns>returns class object</returns> private static IntegerSet inputset() { Char ch; IntegerSet set1 = new IntegerSet(); //Instance of class List <int> lis = new List <int>(); //for storing input values //for taking input do //Loop for continuing { Console.WriteLine("Enter the number to Set"); int A = Convert.ToInt32(Console.ReadLine()); if (A > 0 && A < 101) //to check the input is withini valid range { lis.Add(A); //Adding input to the list set1 = new IntegerSet(lis.ToArray()); //Assigning list elements to the class instance } //statement for asking to add another element into set Console.WriteLine("Do you want to add element (Y/N)?"); ch = Convert.ToChar(Console.ReadLine().ToUpper()); } while (ch.Equals(Char.Parse("Y"))); //condition for continuing the loop return(set1); }