인자로 받은 class가 원하는 타입의 클래스인지 확인후
dynamic 으로 원하는 obj를 담아서 사용
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
| /// <summary>
/// 여러 타입의 클래스를 이용한 데이터 파싱함수()
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="targetContents">적용할 UI 컨텐츠</param>
/// <param name="target_roll_Unit_Infos">적용할 실제 데이터</param>
/// <param name="sss">동적으로 적용할 클래스 타입(반 동적이라고 보면된다...없는거는 못함)</param>
void CreateContents_Manual_Optimized<T>(Transform targetContents,List<Roll_Unit_Info> target_roll_Unit_Infos,T sss) where T:class
{
Contents_Init(targetContents);
//PRODUCTION_SCHEDULE_GUIDANCE _guidance;
dynamic currentList= null;
if (sss.GetType() == typeof(Production_Schedule_Original))
{
Production_Schedule_Original tmpClass = sss as Production_Schedule_Original;
currentList = tmpClass._PRODUCTION_SCHEDULE_ORIGINAL_ITEM;
}
else if (sss.GetType() == typeof(Production_Schedule_Optimized))
{
Production_Schedule_Optimized tmpClass = sss as Production_Schedule_Optimized;
currentList = tmpClass._PRODUCTION_SCHEDULE_OPTIMIZED_ITEM;
}
else if (sss.GetType() == typeof(Production_Schedule_Manual_Optimized) )
{
Production_Schedule_Manual_Optimized tmpClass = sss as Production_Schedule_Manual_Optimized;
currentList = tmpClass._PRODUCTION_SCHEDULE_MANUAL_OPTIMIZED_ITEM;
}
## 사용 Production_Schedule_Original _Original; CreateContents_Manual_Optimized(Original_Contents, Original_Infos, _Original);
foreach (var x in currentList)
{
| cs |
댓글 없음:
댓글 쓰기