컴파일러 오류 CS0193

업데이트: 2007년 11월

오류 메시지

* 또는 -> 연산자는 포인터에 적용되어야 합니다.
The * or -> operator must be applied to a pointer

* 또는 -> 연산자를 포인터가 아닌 형식에 사용할 수 없습니다. 자세한 내용은 포인터 형식(C# 프로그래밍 가이드)를 참조하십시오.

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

// CS0193.cs
using System;

public struct Age
{
   public int AgeYears;
   public int AgeMonths;
   public int AgeDays;
}

public class MyClass
{
   public static void SetAge(ref Age anAge, int years, int months, int days)
   {
      anAge->Months = 3;   // CS0193, anAge is not a pointer
      // try the following line instead
      // anAge.AgeMonths = 3;
   }

   public static void Main()
   {
      Age MyAge = new Age();
      Console.WriteLine(MyAge.AgeMonths);
      SetAge(ref MyAge, 22, 4, 15);
      Console.WriteLine(MyAge.AgeMonths);
   }
}