I just saw that in the previous article on the internet, SQL is used to transpose rows and columns. SQL server 2005/2008 uses only one commit function to implement complex implementations of SQL server 2000. When it comes to transpose, I immediately think of an exercise I have done at the school stage. I use C to implement the transpose of two-dimensional arrays. I believe everyone has done this exercise. The following uses the c # tool to implement it again without practical significance.
1. 2d array transpose
Code
Class Program
{
Public static string [,] Rotate (string [,] array)
{
Int x = array. GetUpperBound (0); // One-dimensional
Int y = array. GetUpperBound (1); // two-dimensional
String [,] newArray = new string [y + 1, x + 1]; // construct a transpose two-dimensional array
For (int I = 0; I <= x; I ++)
{
For (int j = 0; j <= y; j ++)
{
NewArray [j, I] = array [I, j];
}
}
Return newArray;
}
Static void Main (string [] args)
{
String [,] array = new string [4, 2];
For (int I = 0; I <4; I ++)
{
For (