public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj.GetType() != this.GetType()) { return(false); } SuperString stud = (SuperString)obj; return(this.Name == stud.Name); }
static void Main(string[] args) { string newStr = "hi"; WriteLine("Enter string: "); string userString = ReadLine(); int kr; SuperString a = new SuperString(userString); WriteLine("Length of your string is " + a.LengthOfString(out kr)); WriteLine("Which letter do you want to check?"); char letterForChecking = Char.Parse(ReadLine()); WriteLine(a.IsContain(letterForChecking)); WriteLine("Which letter do you want to replace?"); char letterForReplace = Char.Parse(ReadLine()); WriteLine("Which letter do you want to substitute?"); char letterForSubstitute = Char.Parse(ReadLine()); a.ReplaceSymbols(ref letterForReplace, letterForSubstitute); WriteLine(a.GetType()); a.PrivateString = newStr; WriteLine("Введите строки "); string po = ReadLine(); string pa = ReadLine(); string pe = ReadLine(); SuperString[] Array = new SuperString[3]; Array[0] = new SuperString(po); Array[1] = new SuperString(pa); Array[2] = new SuperString(pe); WriteLine("Какую длину строк хотите вывести?"); int ab = int.Parse(ReadLine()); for (int i = 0; i < 3; i++) { if (Array[i].LengthOfString(out kr) == ab) { Array[i].Output(); } } WriteLine("Введите слово"); string nt = ReadLine(); string[] arr0 = Array[0].str.Split(' '); string[] arr1 = Array[1].str.Split(' '); string[] arr2 = Array[2].str.Split(' '); foreach (var t in arr0) { if (t == nt) { WriteLine(Array[0].str); } } foreach (var t in arr1) { if (t == nt) { WriteLine(Array[1].str); } } foreach (var t in arr2) { if (t == nt) { WriteLine(Array[2].str); } } var user = new { name = "Oleg", age = "19" }; WriteLine("Имя " + user.name + " возраст " + user.age); }