Build Clone able objects-
using System;
class Program
{
static void Main()
{
string[] arr = { "Amit", "Nitin", "Ankit", "Sunny", "Rahul" };
string[] arrCloned = [Link]() as string[];
[Link]([Link](",", arr));
[Link]([Link](",", arrCloned));
[Link]();
}
}
Build Comparable objects-
using System;
namespace StringComapreSample
{
class Program
{
static void Main(string[] args)
{
string author1 = "Mahesh Chand";
string author2 = "Praveen Kumar";
string author3 = "Mahesh Chand";
// Compare strings using [Link]
if ([Link](author1, author2))
[Link]($"{author1} and {author2} have same value.");
else
[Link]($"{author1} and {author2} are different.");
if ([Link](author1, author3))
[Link]($"{author1} and {author3} have same value.");
else
[Link]($"{author1} and {author3} are different.");
// Use CompareTo method
if ([Link](author2) == 0)
[Link]($"Both strings have same value.");
else if ([Link](author2) < 0)
[Link]($"{author1} precedes {author2}.");
else if ([Link](author2) > 0)
[Link]($"{author1} follows {author2}.");
[Link]();
}
}
}