i have a matrix came from an image 1600x1600. now i need to assign this matrix into 4x4 blocks. As an example:
00 01 02 03
IMAGE = 04 05 06 07 BLOCK(i) = 00 01 BLOCK(i+1) = 02 03
08 09 0A 0B 04 05 06 07
0C 0D 0E 0F
BLOCK(i+2) = 08 09 BLOCK(i+3) = 0A 0B
0C 0D = 0E 0F
1 ) Firstly i dont know the image dimensions , the user opens it. i get it later. my test image 1600x1600.But blocks dimensions are fixed at 4x4. And image dimensions are , lets we agree can be divided with 4 for now...
2 ) I dont know how many blocks going to be.
3 ) I need to acces the row and coloumb of the blocks later because i will be performing mathematical operations with the blocks later... For example , XOR operation with block(n)[x,y] with block(n+1) [x,y].
So this decleration part , this part of the program is very very important.
i stucked this part of the program for 2 weeks i cant continue. Pls help me. İt looks very simple code but.......
My structure is like this , begining part
private void Form1_Load(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap("c:\\yavanna.jpg");
pictureBox1.Image = Image.FromFile("c:\\yavanna.jpg");
int width = bmp.Width;
int height = bmp.Height;
Color p;
int[,] alpha_map_int = new int[width, height];
int[,] red_map_int = new int[width, height];
int[,] green_map_int = new int[width, height];
int[,] blue_map_int = new int[width, height];
int[,] grayscale_map_int = new int[width, height];
string[,] gray_scale_map = new string[width, height];
string temp_hexValue;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
//get pixel value
p = bmp.GetPixel(x, y);
//extract pixel component ARGB
int a = p.A;
alpha_map_int[x, y] = a;
int r = p.R;
red_map_int[x, y] = r;
int g = p.G;
green_map_int[x, y] = g;
int b = p.B;
blue_map_int[x, y] = b;
//convert to gryscale
double grayscale = 0.2126 * red_map_int[x,y] + 0.7152 * green_map_int[x, y] + 0.0722 * blue_map_int[x, y];
grayscale_map_int[x, y] = Convert.ToInt32(grayscale);
temp_hexValue = Convert.ToString(grayscale_map_int[x, y]);
gray_scale_map[x, y] = temp_hexValue;
}
}
Here's a version of jdweng's answer, that generates 4x4 arrays and handles source arrays that don't divide by 4. You can see why he posted a simplified sample. Any bigger and it would be worth using two more loops to populate the 4x4 array.
'image' is the input, 'bytes4x4' is the output.
List<List<List<byte>>> bytes4x4 = new List<List<List<byte>>>();
for (int row = 0; row<length-3 ; row += 4)
{
for (int col = 0; col<width-3; col += 4)
{
bytes4x4.Add(new List<List<byte>>() {
new List<byte>() { image[row, col], image[row, col + 1], image[row, col + 2], image[row, col + 3]},
new List<byte>() { image[row + 1, col], image[row + 1, col + 1], image[row + 1, col + 2], image[row + 1, col + 3] },
new List<byte>() { image[row + 2, col], image[row + 2, col + 1], image[row + 2, col + 2], image[row + 2, col + 3] },
new List<byte>() { image[row + 3, col], image[row + 3, col + 1], image[row + 3, col + 2], image[row + 3, col + 3] }
});
}
This declares and populates 'bytes4x4', which is a long list of two dimensional blocks. Access a block like this:
var block100 = bytes4x4[100];
And use that to get a pixel:
var block100pixelrow1col3 = block100[1][3];
or
var block100pixelrow1col3 = bytes4x4[100][1][3];
Note that these indexs are all zero based, so there's no element [4] in the blocks.
Now I think about it, you might be after a 2-dimensional array of 2-dimensional blocks. If so the code would look like this:
var bytes4x4 = new List<List<List<List<byte>>>>();
for (int row = 0; row<length-3 ; row += 4)
{
var row = new List<List<List<byte>>>();
bytes4x4.Add(row);
for (int col = 0; col<width-3; col += 4)
{
row.Add(new List<List<byte>>() {
new List<byte>() { image[row, col], image[row, col + 1], image[row, col + 2], image[row, col + 3]},
new List<byte>() { image[row + 1, col], image[row + 1, col + 1], image[row + 1, col + 2], image[row + 1, col + 3] },
new List<byte>() { image[row + 2, col], image[row + 2, col + 1], image[row + 2, col + 2], image[row + 2, col + 3] },
new List<byte>() { image[row + 3, col], image[row + 3, col + 1], image[row + 3, col + 2], image[row + 3, col + 3] }
});
}
Then you could access a block that is 14 rows down and 23 columns across like this:
var block14by23 = bytes4x4[14][23];
Try following :
const string FILENAME = #"c:\temp\test.jpg";
public Form1()
{
InitializeComponent();
Bitmap image = new Bitmap(FILENAME);
int height = (int)image.Height ;
int width = (int)image.Width;
List<List<List<Color>>> bytes = new List<List<List<Color>>>();
List<List<List<Int32>>> grayscale_map_int = new List<List<List<Int32>>>();
for (int row = 0; row < height; row += 4)
{
for (int col = 0; col < width; col += 4)
{
bytes.Add(new List<List<Color>>() {
new List<Color>() { image.GetPixel(col, row), image.GetPixel(col + 1, row), image.GetPixel(col + 2, row), image.GetPixel(col + 3, row)} ,
new List<Color>() { image.GetPixel(col, row + 1), image.GetPixel(col + 1, row + 1), image.GetPixel(col + 2, row + 1), image.GetPixel(col + 3, row + 1)} ,
new List<Color>() { image.GetPixel(col, row + 2), image.GetPixel(col + 1, row + 2), image.GetPixel(col + 2, row + 2), image.GetPixel(col + 3, row + 2)} ,
new List<Color>() { image.GetPixel(col, row + 3), image.GetPixel(col + 1, row + 3), image.GetPixel(col + 2, row + 3), image.GetPixel(col + 3, row + 3)} ,
});
grayscale_map_int.Add(new List<List<Int32>>() {
new List<Int32>() { GetGrayScale(image.GetPixel(col, row)), GetGrayScale(image.GetPixel(col + 1, row)), GetGrayScale(image.GetPixel(col + 2, row)), GetGrayScale(image.GetPixel(col + 3, row))} ,
new List<Int32>() { GetGrayScale(image.GetPixel(col, row + 1)), GetGrayScale(image.GetPixel(col + 1, row + 1)), GetGrayScale(image.GetPixel(col + 2, row + 1)), GetGrayScale(image.GetPixel(col + 3, row + 1))} ,
new List<Int32>() { GetGrayScale(image.GetPixel(col, row + 2)), GetGrayScale(image.GetPixel(col + 1, row + 2)), GetGrayScale(image.GetPixel(col + 2, row + 2)), GetGrayScale(image.GetPixel(col + 3, row + 2))} ,
new List<Int32>() { GetGrayScale(image.GetPixel(col, row + 3)), GetGrayScale(image.GetPixel(col + 1, row + 3)), GetGrayScale(image.GetPixel(col + 2, row + 3)), GetGrayScale(image.GetPixel(col + 3, row + 3))} ,
});
}
}
}
public Int32 GetGrayScale(Color color)
{
return Convert.ToInt32(0.2126 * color.R + 0.7152 * color.G + 0.0722 * color.B);
}
Related
I am trying to get a jagged array that will solve the sums of the elements from dailyTemperature and that will successfully display them in the Main () under the Weather class. This is what I have so far.
public int[,] GetTemperatures()
{
int[,] dailyTemperature =
{
{38, 40, 42, 34},
{55, 41, 40, 30},
{28, 39, 21, 60},
{61, 52, 43, 42},
{35, 36, 30, 29},
{24, 33, 37, 40}
};
Console.Write(" ");
for (int i = 0; i < dailyTemperature.Length; i++)
{
Console.Write(dailyTemperature[i] + " ");
}
Console.WriteLine();
for (int i = 0; i < dailyTemperature.GetLength(0); i++)
{
Console.Write(dailyTemperature[i].Substring(0, dailyTemperature[i].Length - 1) + " ");
for (int j = 0; j < dailyTemperature.GetLength(1); j++)
{
Console.Write(dailyTemperature[i, j] + " ");
}
Console.WriteLine();
}
return dailyTemperature;
}
{
public int[] GetTemperatureSum(int [,] dailyTemperature)
{
int[][] temperatureSum= new int[6][];
temperatureSum[0][1] = dailyTemperature[0, 0] + dailyTemperature[0, 1] + dailyTemperature[0, 2] + dailyTemperature[0, 3];
temperatureSum[0][2] = dailyTemperature[1, 0] + dailyTemperature[1, 1] + dailyTemperature[1, 2] + dailyTemperature[1, 3];
temperatureSum[0][3] = dailyTemperature[2, 0] + dailyTemperature[2, 1] + dailyTemperature[2, 2] + dailyTemperature[2, 3];
temperatureSum[0][4] = dailyTemperature[3, 0] + dailyTemperature[3, 1] + dailyTemperature[3, 2] + dailyTemperature[3, 3];
temperatureSum[0][5] = dailyTemperature[4, 0] + dailyTemperature[4, 1] + dailyTemperature[4, 2] + dailyTemperature[4, 3];
temperatureSum[0][6] = dailyTemperature[5, 0] +dailyTemperature[5, 1] + dailyTemperature[5, 2] + dailyTemperature[5, 3];
for (int i = 0; i < temperatureSum.GetLength(0); i++)
{
for (int j=0; j<temperatureSum.GetLength(1); j++)
{
Console.Write(temperatureSum[i][j]);
}
Console.WriteLine();
}
return temperatureSum;
}
static void Main(string[] args)
{
Weather weather= new Weather();
{
weather.GetTemperatures();
weather.GetTemperatureSum(dailyTemperature);
}
};
My strategy here is to display all of these methods through the Main() method, however I am getting an error under (dailyTemperature) by weather.GetTemperatureSum. This is what the error says, "An object reference is required for the nonstatic field, method, or property 'member'".
I'd love it if someone could help me on this, although as I understand the formatting has to be relatively similar to this. I absolutely need to, for example, solve the sums through the computer as opposed to doing so manually. Thanks.
More details about:
Multidimensional Arrays
Jagged Arrays
Multidimensional Array [][] vs [,] [duplicate]
int[,] dailyTemperatures =
{
{ 38, 40, 42, 34 },
{ 55, 41, 40, 30 },
{ 28, 39, 21, 60 },
{ 61, 52, 43, 42 },
{ 35, 36, 30, 29 },
{ 24, 33, 37, 40 }
};
Weather.GetTemperatures(dailyTemperatures);
Weather.GetTemperatureSum(dailyTemperatures);
public static class Weather
{
public static int[,] GetTemperatures(int[,] dailyTemperatures)
{
var rows = dailyTemperatures.GetUpperBound(0) + 1;
var columns = dailyTemperatures.Length / rows;
for (var i = 0; i < rows; i++)
{
for (var j = 0; j < columns; j++)
{
Console.Write($"{dailyTemperatures[i, j]} \t");
}
Console.WriteLine();
}
return dailyTemperatures;
}
public static int[] GetTemperatureSum(int[,] dailyTemperature)
{
var temperatureSum = new int[6];
temperatureSum[0] = dailyTemperature[0, 0] + dailyTemperature[0, 1] + dailyTemperature[0, 2] + dailyTemperature[0, 3];
temperatureSum[1] = dailyTemperature[1, 0] + dailyTemperature[1, 1] + dailyTemperature[1, 2] + dailyTemperature[1, 3];
temperatureSum[2] = dailyTemperature[2, 0] + dailyTemperature[2, 1] + dailyTemperature[2, 2] + dailyTemperature[2, 3];
temperatureSum[3] = dailyTemperature[3, 0] + dailyTemperature[3, 1] + dailyTemperature[3, 2] + dailyTemperature[3, 3];
temperatureSum[4] = dailyTemperature[4, 0] + dailyTemperature[4, 1] + dailyTemperature[4, 2] + dailyTemperature[4, 3];
temperatureSum[5] = dailyTemperature[5, 0] + dailyTemperature[5, 1] + dailyTemperature[5, 2] + dailyTemperature[5, 3];
for (var i = 0; i < temperatureSum.GetLength(0); i++)
{
Console.WriteLine(temperatureSum[i]);
}
return temperatureSum;
}
}
In the GetTemperatureSum method, the returned type is an array (int[]).
It is better to pass dailyTemperatures variable as a method parameter
I'm mainly parsing large amounts of text from a text file and then populating it into an excel.
//populate into worksheet
for (int x = 0; x < rawLine.Length; x++)
{
string[] tempLine = rawLine[x].Split(';');
for (int y = 0; y < tempLine.Length; y++)
{
DateTime hour = Convert.ToDateTime(tempLine[6]);
xlWorkSheet.Cells[y + 2, 1] = tempLine[0];
xlWorkSheet.Cells[y + 2, 2] = tempLine[1];
xlWorkSheet.Cells[y + 2, 3] = tempLine[2];
xlWorkSheet.Cells[y + 2, 4] = tempLine[3];
xlWorkSheet.Cells[y + 2, 5] = tempLine[4];
xlWorkSheet.Cells[y + 2, 6] = tempLine[5];
xlWorkSheet.Cells[y + 2, 7] = tempLine[6];
xlWorkSheet.Cells[y + 2, 8] = tempLine[7];
xlWorkSheet.Cells[y + 2, 9] = tempLine[8];
xlWorkSheet.Cells[y + 2, 10] = tempLine[9];
xlWorkSheet.Cells[y + 2, 11] = tempLine[10];
xlWorkSheet.Cells[y + 2, 12] = hour.Hour;
xlWorkSheet.Cells[y + 2, 13] = tempLine[8] == "0" ? "SAME" : tempLine[9];
}
Console.WriteLine("Current line = " + x + "\n");
}
Currently this code works, but it's just taking way too long. Is there anyway to speed it up? I have done some searching but found nothing much specific.
Thanks in advance.
It will probably be a very small improvement, but this line:
DateTime hour = Convert.ToDateTime(tempLine[6]);
Should be moved outside the y loop because it doesn't depend on it.
Other than that, you should probably look into some way to set multiple cells at the same time--most of the time is probably spent doing round trips to Excel. (It looks like this is what #Gusman suggests in the comments).
#Mohit's answer is good too because it is much shorter and simpler.
You can try:
//populate into worksheet
DateTime hour;
string[] tempLine;
StringBuilder output = new StringBuilder();
for (int x = 0; x < rawLine.Length; x++)
{
tempLine = rawLine[x].Split(';');
for (int y = 0; y < tempLine.Length; y++)
{
hour = Convert.ToDateTime(tempLine[6]);
xlWorkSheet.Cells[y + 2, 1] = tempLine[0];
xlWorkSheet.Cells[y + 2, 2] = tempLine[1];
xlWorkSheet.Cells[y + 2, 3] = tempLine[2];
xlWorkSheet.Cells[y + 2, 4] = tempLine[3];
xlWorkSheet.Cells[y + 2, 5] = tempLine[4];
xlWorkSheet.Cells[y + 2, 6] = tempLine[5];
xlWorkSheet.Cells[y + 2, 7] = tempLine[6];
xlWorkSheet.Cells[y + 2, 8] = tempLine[7];
xlWorkSheet.Cells[y + 2, 9] = tempLine[8];
xlWorkSheet.Cells[y + 2, 10] = tempLine[9];
xlWorkSheet.Cells[y + 2, 11] = tempLine[10];
xlWorkSheet.Cells[y + 2, 12] = hour.Hour;
xlWorkSheet.Cells[y + 2, 13] = tempLine[8] == "0" ? "SAME" : tempLine[9];
}
output.AppendLine("Current line = " + x);
}
Console.WriteLine(output.ToString());
May be just to improve the loop you can write like this. This does not improve the performance but would look cleaner.
for (int x = 0; x < rawLine.Length; x++)
{
string[] tempLine = rawLine[x].Split(';');
for (int y = 0; y < tempLine.Length; y++)
{
DateTime hour = Convert.ToDateTime(tempLine[6]);
for(int z=0; z<11; z++)
{
xlWorkSheet.Cells[y + 2, (z+1)] = tempLine[z];
}
xlWorkSheet.Cells[y + 2, 12] = hour.Hour;
xlWorkSheet.Cells[y + 2, 13] = tempLine[8] == "0" ? "SAME" : tempLine[9];
}
Console.WriteLine("Current line = " + x + "\n");
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am trying to perform a bubble sort on a 2D array, sorting by the third index (the integer)
string[,] edges = new string[,] { {"A", "B", "2"},
{"A", "C", "3"},
{"A", "E", "10"},
{"B", "C", "5"},
{"B", "D", "10"},
{"C", "D", "2"},
{"D", "E", "5"},
{"E", "B", "3"}
};
I get an IndexOutOfRangeException on IF statenent of the sort code
string[] temp = {};
//sort edges and add them to sortedEdges - using bubblesort
for (int i = 0; i < edges.Length - 1; i++){
for (int j = 0; j < edges.Length - 1; j++){
if (Int32.Parse(edges[i, 2]) > Int32.Parse(edges[i + 1, 2])){
//make a swap
//put array record i into temp holder
temp[0] = edges[i, 0];
temp[1] = edges[i, 1];
temp[2] = edges[i, 2];
//copy i + 1 into i
edges[i, 0] = edges[i + 1, 0];
edges[i, 1] = edges[i + 1, 1];
edges[i, 2] = edges[i + 1, 2];
//copy temp into i + 1
edges[i + 1, 0] = temp[0];
edges[i + 1, 1] = temp[1];
edges[i + 1, 2] = temp[2];
}
}
}
My question is, how do I fix this so that the array "edges" is filled with the rows, ordered by the third column?
Thanks.
UPDATED v-3
The problem was in Length for such defined table which in your case was 24 because it seems to count all the elements in both dimensions.
Please try the following code:
string[] temp = new string[3];
for (int i = 0; i < edges.GetLength(0) - 1; i++){
int j;
j = 0;
for (; j < edges.GetLength(0) - 1; j++){
if (Int32.Parse(edges[j, 2]) > Int32.Parse(edges[j + 1, 2])){
//make a swap
//put array record j into temp holder
temp[0] = edges[j, 0];
temp[1] = edges[j, 1];
temp[2] = edges[j, 2];
//copy j + 1 into j
edges[j, 0] = edges[j + 1, 0];
edges[j, 1] = edges[j + 1, 1];
edges[j, 2] = edges[j + 1, 2];
//copy temp into j + 1
edges[j + 1, 0] = temp[0];
edges[j + 1, 1] = temp[1];
edges[j + 1, 2] = temp[2];
}
}
}
You can find (updated) working example here: https://dotnetfiddle.net/FQs4OA
And what i mean by the title is
I have 2 images - each one is from a different time ( from screen cap)
i want to get the difference between the two
make all the same parts transparent,
send the difference to a client
and place it on top of an image that he has
Don't worry about the sending part - I have covered that.
The thing I need help is how to get the difference, save it to an image / stream / byte array
and merging it to one image.
You create and fill a target Bitmap.
Do try to use LockBits if performance is too bad.
Using a library should be even faster.
Here is a quick piece of code; you pass in two Bitmaps and the Color the differences should be painted in, e.g. Color.Red or Color.Transparent.
It returns the difference Bitmap or null if the Bitmap Sizes don't match.
public Bitmap getDifferencBitmap(Bitmap bmp1, Bitmap bmp2, Color diffColor)
{
Size s1 = bmp1.Size;
Size s2 = bmp2.Size;
if (s1 != s2) return null;
Bitmap bmp3 = new Bitmap(s1.Width, s1.Height);
for (int y = 0; y < s1.Height; y++)
for (int x = 0; x < s1.Width; x++)
{
Color c1 = bmp1.GetPixel(x, y);
Color c2 = bmp2.GetPixel(x, y);
if (c1 == c2) bmp3.SetPixel(x, y, c1);
else bmp3.SetPixel(x, y, diffColor);
}
return bmp3;
}
You could call it like this:
Bitmap bmp1 = new Bitmap(filepath1);
Bitmap bmp2 = new Bitmap(filepath2);
Bitmap bmp3 = getDifferencBitmap(bmp1, bmp2, Color.Transparent);
bmp3.Save(filepath3, System.Drawing.Imaging.ImageFormat.Png);
bmp1.Dispose();
bmp2.Dispose();
bmp3.Dispose();
Make sure you dispose of the Bitmaps when you are done with them!
Of course you can easily change the logic to make identical parts Transparent and non-identical parts whatever.. I assumed you really wanted to show the differences, though.
Here is a post which contains the code for a LockBits version; you just would need to change the inner loop's code to this:
for (int x = 0; x < s1.Width; x++)
{
int index1 = y * bmp1Data.Stride + x * bpp1;
int index2 = y * bmp2Data.Stride + x * bpp2;
int index3 = y * bmp3Data.Stride + x * bpp3;
Color c1, c2;
if (bpp1 == 4)
c1 = Color.FromArgb(data1[index1 + 3], data1[index1 + 2], data1[index1 + 1], data1[index1 + 0]);
else c1 = Color.FromArgb(255, data1[index1 + 2], data1[index1 + 1], data1[index1 + 0]);
if (bpp1 == 4)
c2 = Color.FromArgb(data2[index2 + 3], data2[index2 + 2], data2[index2 + 1], data2[index2 + 0]);
else c2 = Color.FromArgb(255, data2[index2 + 2], data2[index2 + 1], data2[index2 + 0]);
Color putColor = (c1 == c2 ? c1 : diffColor);
data3[index3 + 0] = putColor.B;
data3[index3 + 1] = putColor.G;
data3[index3 + 2] = putColor.R;
data3[index3 + 3] = putColor.A;
}
Here is a method that you can check two image and compare pixel to pixel
public void matchimage(System.Drawing.Bitmap img1, System.Drawing.Bitmap img2)
{
string img1_ref, img2_ref;
int count1 = 0, count2 = 0;
bool flag = true;
if (img1.Width == img2.Width && img1.Height == img2.Height)
{
for (int i = 0; i < img1.Width; i++)
{
for (int j = 0; j < img1.Height; j++)
{
img1_ref = img1.GetPixel(i, j).ToString();
img2_ref = img2.GetPixel(i, j).ToString();
if (img1_ref != img2_ref)
{
count2++;
flag = false;
break;
}
count1++;
}
}
if (flag == false)
MessageBox.Show("Sorry, Images are not same , " + count2 + " wrong pixels found");
else
MessageBox.Show(" Images are same , " + count1 + " same pixels found and " + count2 + " wrong pixels found");
}
else
MessageBox.Show("can not compare this images");
img1.Dispose();
img2.Dispose();
}
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Sorting by Name (alphabetic)
Say I have the code below. I have a total of 6 radio buttons. I have the 5 of the radio buttons working. The last is called radio button is called rbRegion. I believe I have everything set up correctly. There are two arrays, one for strings, and one for 4 quarterly totals and one yearly total. Say I wanted to sort by region name, I would place it in the `if (rbRegion.Checked) area. What exactly would I need to place in there to sort it alphabetically and to change the corresponding numeric array.
private void btnSort_Click(object sender, EventArgs e)
{
int n;
decimal temp;
int sortCol = 0;
string ntemp;
bool swapFlag;
if (rb1.Checked)
sortCol = 0;
if (rb2.Checked)
sortCol = 1;
if (rb3.Checked)
sortCol = 2;
if (rb4.Checked)
sortCol = 3;
if (rbTotal.Checked)
sortCol = 4;
if (rbRegion.Checked)
{
}
else
{
do
{
swapFlag = false;
for (n = 0; n < lastIndexUsed; n++)
{
if(quarters[n,sortCol] < quarters[n+1, sortCol])
{
//column 4
temp = quarters[n, 4];
quarters[n, 4] = quarters[n + 1, 4];
quarters[n+1, 4] = temp;
//col 3
temp = quarters[n, 3];
quarters[n, 3] = quarters[n + 1, 3];
quarters[n + 1, 3] = temp;
//col 2
temp = quarters[n, 2];
quarters[n, 2] = quarters[n + 1, 2];
quarters[n + 1, 2] = temp;
// col 1
temp = quarters[n, 1];
quarters[n, 1] = quarters[n + 1, 1];
quarters[n + 1, 1] = temp;
//col 0
temp = quarters[n, 0];
quarters[n, 0] = quarters[n + 1, 0];
quarters[n + 1, 0] = temp;
//name
ntemp = Branch[n];
Branch[n] = Branch[n + 1];
Branch[n + 1] = ntemp;
swapFlag = true;
}//endif
}//for end
} while (swapFlag);
}
If the value inside the rbRegion.Checked condition is an array. you can use this code.
Array.Sort(YourStringArray); // Ascending
Array.Reverse(YourStringArray); // Descending