using
System;
using
System.Collections;
class
comparer : IComparer {
public
int
Compare(Object x, Object y)
{
return
(
new
CaseInsensitiveComparer()).Compare(y, x);
}
}
class
GFG {
public
static
void
Main()
{
String[] arr1 = {
"H"
,
"J"
,
"K"
,
"L"
,
"I"
,
"N"
,
"M"
};
String[] arr2 = {
"A"
,
"E"
,
"D"
,
"C"
,
"F"
,
"B"
,
"G"
};
IComparer g =
new
comparer();
Console.WriteLine(
"The original order of "
+
"elements in the array:"
);
Display(arr1, arr2);
Array.Sort(arr1, arr2, 1, 4, g);
Console.WriteLine(
"\nAfter sorting in a "
+
"range of index 1 to 4 :"
);
Display(arr1, arr2);
}
public
static
void
Display(String[] arr1, String[] arr2)
{
for
(
int
i = 0; i < arr1.Length; i++)
{
Console.WriteLine(arr1[i] +
" : "
+ arr2[i]);
}
}
}