-
-
Save polatengin/59ea9b882738262ef40e6cdd7119902d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C# Multi-Dimensional Array (Dizi) ve Jagged Array (Dizi) arasındaki farklar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jagged = new int[10][30]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jagged[3][6]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jagged[0].Length == jagged[1].Length |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jagged = new int[3][]; | |
jagged[0] = new int[4] { 1, 2, 3, 4 }; | |
jagged[1] = new int[2] { 11, 12 }; | |
jagged[2] = new int[3] { 21, 22, 23 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | 2 | 3 | 4 | |
11 | 12 | |
21 | 22 | 23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var multi = new int[10, 30]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi.GetLength(0) // 10 | |
multi.GetLength(1) // 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multi[5, 6]; // 5 x 10 + 6 = 56. öğeye erişiliyor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = new int[2, 2]; | |
data[0,0] = 1; | |
data[0,1] = 2; | |
data[1,0] = 3; | |
data[1,1] = 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 | 2 | |
3 | 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void SetElementAt(int[][] array, int i, int j, int value) | |
{ | |
array[i][j] = value; | |
} | |
static void SetElementAt(int[,] array, int i, int j, int value) | |
{ | |
array[i, j] = value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.method private hidebysig static void SetElementAt(int32[][] 'array', | |
int32 i, | |
int32 j, | |
int32 'value') cil managed | |
{ | |
// Code size 7 (0x7) | |
.maxstack 8 | |
IL_0000: ldarg.0 | |
IL_0001: ldarg.1 | |
IL_0002: ldelem.ref | |
IL_0003: ldarg.2 | |
IL_0004: ldarg.3 | |
IL_0005: stelem.i4 | |
IL_0006: ret | |
} // Jagged Array | |
.method private hidebysig static void SetElementAt(int32[0...,0...] 'array', | |
int32 i, | |
int32 j, | |
int32 'value') cil managed | |
{ | |
// Code size 10 (0xa) | |
.maxstack 8 | |
IL_0000: ldarg.0 | |
IL_0001: ldarg.1 | |
IL_0002: ldarg.2 | |
IL_0003: ldarg.3 | |
IL_0004: call instance void int32[0...,0...]::Set(int32, | |
int32, | |
int32) | |
IL_0009: ret | |
} // Multi-Dimensional Array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment