컴파일러 오류 CS0255
업데이트: 2007년 11월
오류 메시지
stackalloc는 catch 또는 finally 블록에 사용할 수 없습니다.
stackalloc may not be used in a catch or finally block
stackalloc 키워드를 catch 또는 finally 블록에 사용하면 안 됩니다. 자세한 내용은 예외 및 예외 처리(C# 프로그래밍 가이드)를 참조하십시오.
다음 샘플에서는 CS0255 오류가 발생하는 경우를 보여 줍니다.
// CS0255.cs
// compile with: /unsafe
using System;
public class TestTryFinally
{
public static unsafe void Test()
{
int i = 123;
string s = "Some string";
object o = s;
try
{
// Conversion is not valid; o contains a string not an int
i = (int) o;
}
finally
{
Console.Write("i = {0}", i);
int* fib = stackalloc int[100]; // CS0255
}
}
public static void Main()
{
}
}