Code/C#

C# switch Conflicting variable is defined below

Segel 2021. 9. 8. 04:25

문제:

    switch문에서 Conflicting variable is defined below 오류가 발생

 

해결:

    각 case 섹션에 중괄호 삽입:

switch (example)
{
	case "1":
	{
		return int.TryParse(example, out int rtn);
	}
	case "2":
	{
		return int.TryParse(example, out int rtn);
	}
}

 

반응형