Partager via


Erreur du compilateur CS0036

Mise à jour : novembre 2007

Message d'erreur

Un paramètre out ne peut pas posséder l'attribut In
An out parameter cannot have the '[In]' attribute

Actuellement, l'attribut In n'est pas autorisé sur un paramètre out (de sortie).

L'exemple suivant génère l'erreur CS0036 :

// CS0036.cs

using System;
using System.Runtime.InteropServices;

public class MyClass
{
   public static void TestOut([In] out char TestChar)   // CS0036
   // try the following line instead
   // public static void TestOut(out char TestChar)
   {
      TestChar = 'b';
      Console.WriteLine(TestChar);
   }

   public static void Main()
   {
      char i;           //variable to receive the value
      TestOut(out i);   // the arg must be passed as out
      Console.WriteLine(i);
   }
}