Share via


컴파일러 경고(수준 1) CS0183

업데이트: 2007년 11월

오류 메시지

지정된 식은 항상 제공된 ('type') 형식입니다.
The given expression is always of the provided ('type') type

조건문이 항상 true이면 사용할 필요가 없습니다. 이 경고는 is 연산자를 사용하여 형식을 계산하는 경우에 발생합니다. 계산이 값 형식인 경우 확인이 필요없습니다.

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

// CS0183.cs
// compile with: /W:1
using System;
public class Test
{
   public static void F(Int32 i32, String str)
   {
      if (str is Object)          // OK
         Console.WriteLine( "str is an object" );
      else
         Console.WriteLine( "str is not an object" );
      
      if (i32 is Object)   // CS0183
         Console.WriteLine( "i32 is an object" );
      else
         Console.WriteLine( "i32 is not an object" ); // never reached
   }


   public static void Main()
   {

      F(0, "CS0183");
      F(120, null); 
   }
}