0
MyGlobals.ListOfItemsToControl[i].sItemName
이 개체 HWRes.HWResObj
에없는 경우 아래 코드에서 catch 문으로 이동하지 않고이 문제를 감지하고 싶습니다.존재하지 않는 개체 이름을 검색하는 동안 오류를 검색하는 중
어떻게하면됩니까?
try
{
String HWTemp = "";
// Ref http://stackoverflow.com/questions/15628140/c-sharp-eliminate-switch-requirement
HWTemp = HWRes.HWResObj.GetType().GetProperty(MyGlobals.ListOfItemsToControl[i].sItemName, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance).GetValue(HWRes.HWResObj, null).ToString();
// Somehow here I should detect if the value MyGlobals.ListOfItemsToControl[i].sItemName does not exist in the object HWRes.HWResObj
// Detect issue without jumping to catch
}
catch
{
// I dont want to go here when MyGlobals.ListOfItemsToControl[i].sItemName does not exist in the object HWRes.HWResObj
.....
}