コード例 #1
0
ファイル: Program.cs プロジェクト: VorXal/xt_net_web
        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());
        }
コード例 #2
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() != this.GetType())
            {
                return(false);
            }

            CustomStringFromDLL cs = (CustomStringFromDLL)obj;

            return(this.customString == cs.customString);
        }
コード例 #3
0
 public static int GetPositionCharInCustomString(char find, CustomStringFromDLL input)
 {
     for (int i = 0; i < input.Length; i++)
     {
         if (input[i] == find)
         {
             return(i);
         }
     }
     return(-1);
 }
コード例 #4
0
        public static int CountOfCharInCustomString(char find, CustomStringFromDLL input)
        {
            int count = 0;

            foreach (var i in input.customString)
            {
                if (i == find)
                {
                    count++;
                }
            }

            return(count);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
 public static char[] ReturnArray(CustomStringFromDLL input)
 {
     return((char[])input.customString.Clone());
 }