๋ช‡๊ฐ€์ง€ ์ •๋ณด๋ฅผ ๋‹ด์„ Class Information ์ƒ์„ฑํ•จ


List<Information> information = new List<Information>();

tempClass = new Information();


์š”๋ ‡๊ฒŒ ๋งŒ๋“ค๊ณ 

for (int i=0; i<anotherList.Count; i++)

{

tempClass.a = anotherList[i];

tempClass.bย = anotherAnotherList[i];

information.Add(tempClass);

}

์ด๋ ‡๊ฒŒ tempclass๋ฅผ ํ†ตํ•ด ๊ฐ’์„ ์ฃผ๊ณ ๋‚˜์„œ information๋ฆฌ์ŠคํŠธ๋กœ ์ถ”๊ฐ€ํ•ด์ฃผ๋Š”๊ฑธ ๋ฐ˜๋ณต๋ฌธ์„ ํ†ตํ•ด ์—ฌ๋Ÿฌ๋ฒˆ ์‹คํ–‰ํ–ˆ์–ด

๊ทธ๋Ÿฌ๋ฉด information์—๋Š” Information ์ธ์Šคํ„ด์Šค ์—ฌ๋Ÿฌ๊ฐœ๊ฐ€ ๊ฐ๊ธฐ ๋‹ค๋ฅธ๊ฐ’์„ ๋‹ด๊ณ  ์žˆ์–ด์•ผ ๋œ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ, ๊ทธ๋ ‡์ง€๊ฐ€ ์•Š๋”๋ผ๊ณ 

๋งจ ๋งˆ์ง€๋ง‰ tempClass์˜ ๊ฐ’์ด information[0 ~ i]๊นŒ์ง€ ๋‹ค ๋ฎ์–ด์”Œ์›Œ์ ธ ๋ฒ„๋ฆฌ๋”๋ผ

information[0]๋ถ€ํ„ฐ [i]๊นŒ์ง€ ๋‹ค ๋‹ฌ๋ผ์•ผ ๋œ๋‹ค ์ƒ๊ฐํ–ˆ๊ฑฐ๋“ 


์ด๊ฑฐ ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ•ด์•ผํ• ๊นŒ

์งˆ๋ฌธ ์“ฐ๋‹ค๋ณด๋‹ˆ tempclass๋ฅผ ๋ฏธ๋ฆฌ ๋งŒ๋“ค์ง€๋ง๊ณ  ํฌ๋ฌธ ์•ˆ์—์„œ new Information(); ํ•˜๋ฉด ๋ ๊ฑฐ๊ฐ™๊ธฐ๋„ ํ•œ๋ฐ ํ˜„์žฌ ํšŒ์‚ฌ๋ผ ํ™•์ธ๋ถˆ๊ฐ€

C# ์ž˜์•Œ๋“ค ๋‹ต๋ณ€์ข€...