Share via


컴파일러 오류 CS0077

업데이트: 2007년 11월

오류 메시지

as 연산자는 참조 형식 또는 nullable 형식과 함께 사용해야 합니다. '%1!ls!'은(는) null을 허용하지 않는 값 형식입니다.
The as operator must be used with a reference type or nullable type ('int' is a non-nullable value type).

as 연산자에 값 형식을 전달했습니다. as는 null을 반환할 수 있으므로 참조 형식 또는 nullable 형식만 전달할 수 있습니다. nullable 형식에 대한 자세한 내용은 nullable 형식(C# 프로그래밍 가이드)을 참조하십시오.

다음 샘플에서는 CS0077 오류가 발생하는 경우를 보여 줍니다.

// CS0077.cs
using System;

class C
{
}

struct S
{
}

class M
{
   public static void Main()
   {
      object o1, o2;
      C c;
      S s;

      o1 = new C();
      o2 = new S();

      s = o2 as S;  // CS0077, S is not a reference type.
      // try the following line instead
      // c = o1 as C;
   }
}