static void Main(string[] args) { CustomStringFromDLL customString = new CustomStringFromDLL("This string working from DLL"); Console.WriteLine(customString.ToString()); CustomString customString1 = new CustomString("This string working from class"); Console.WriteLine(customString1.ToString()); }
public override bool Equals(object obj) { if (obj.GetType() != this.GetType()) { return(false); } CustomStringFromDLL cs = (CustomStringFromDLL)obj; return(this.customString == cs.customString); }
public static int GetPositionCharInCustomString(char find, CustomStringFromDLL input) { for (int i = 0; i < input.Length; i++) { if (input[i] == find) { return(i); } } return(-1); }
public static int CountOfCharInCustomString(char find, CustomStringFromDLL input) { int count = 0; foreach (var i in input.customString) { if (i == find) { count++; } } return(count); }
public static CustomStringFromDLL ConcatCustomString(CustomStringFromDLL firstCustomString, CustomStringFromDLL secondCustomString) { char[] customString = new char[firstCustomString.Length + secondCustomString.Length]; for (int i = 0; i < firstCustomString.Length + secondCustomString.Length; i++) { if (i < firstCustomString.Length) { customString[i] = firstCustomString[i]; } else { customString[i] = secondCustomString[i - firstCustomString.Length]; } } return(new CustomStringFromDLL(customString)); }
public static char[] ReturnArray(CustomStringFromDLL input) { return((char[])input.customString.Clone()); }