Array.Resize( ref 배열이름 , 새로운 크기 );
using System;
namespace ConsoleApp2
{
internal class Program
{
public struct Font
{
public string s;
public short[] f;
}
static void Main(string[] args)
{
Font[] font = new Font[1]; 방 1칸
font[0].s = "한";
font[0].f = new short[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
Array.Resize(ref font, 2); 방 2칸
Font f = new Font("국", new short[] { 0, 1, 2, 3 });
font[1] = f;
Console.WriteLine(font.Length); // 2
foreach (short i in font[0].f) Console.Write(i+" "); // 0 1 2 3 4 5 6 7 8 9
Console.WriteLine();
foreach (short i in font[1].f ) Console.Write(i+" "); // 0 1 2 3
Console.WriteLine();
f = new Font("국", new short[] { 0, 1, 2, 3, 100 });
foreach (short i in font[1].f ) // 안 바뀌네요 참고그냥
Console.Write(i + " "); // 0 1 2 3
}
}
}
2 0 1 2 3 4 5 6 7 8 9 0 1 2 3 0 1 2 3 계속하려면 아무 키나 누르십시오 . . . |
'Tip !!! > C# tip' 카테고리의 다른 글
DataGridView의 Row 갯수는? (0) | 2022.08.01 |
---|---|
검색결과 레코드(Row) DataGrid에 모우기 (0) | 2022.08.01 |
Table에 연결된 DataGridView Row 이동방법 (0) | 2022.08.01 |
DataGridView에서 선택된 Cell 처리 (0) | 2022.08.01 |
폼 닫기 취소 시키기 form closing cancel (0) | 2022.07.29 |