Je suis en train de lire une documentation mais il y a quelque chose que je ne comprend pas.

Dans la docu il me donne un exemple comme celui ci :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
using System;
 
namespace affectationreference
{
	class Exemple
	{
		public static int x;
		int y;
		public void f1(int a)
		{
			x = a;
			y = a;
		}
		public static void g1(int a)
		{
			x = a;
		}
	}
	class Utilise
	{
		public static void Main()
		{
			Exemple obj = new Exemple();
			obj.f1(10);
			Console.WriteLine("<f1(10)>obj.x = "+obj.x);
			obj.g1(50);
			Console.WriteLine("<g1(10)>obj.x = "+obj.x);
		}
	}
}
C'est l'exemple qu l'on donne dans le livre. Cependant cela donne des erreurs :
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(25): Static member 'affectationreference.Exemple.x' cannot be accessed with an instance reference; qualify it with a type name instead
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(25): The type or namespace name 'obj' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(26): Static member 'affectationreference.Exemple.g1(int)' cannot be accessed with an instance reference; qualify it with a type name instead
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(26): The type or namespace name 'obj' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(27): Static member 'affectationreference.Exemple.x' cannot be accessed with an instance reference; qualify it with a type name instead
C:\Documents and Settings\Administrator.SERVER1.000\My Documents\Visual Studio Projects\affectationreference\Class1.cs(27): The type or namespace name 'obj' could not be found (are you missing a using directive or an assembly reference?)

Après avoir eu ces erreures j'ai analiser le code et j'ai enlever le static de public static int x; et de public static void g1(int a) et cela fonctionne.

Ce que j'aimerais savoir c'est est ce que c'est moi qui ne comprend rien à l'exemple qu'il donne ou c'est un erreur de la docu? Si c'est moi qui n'a pas comprit auriez vous une explcation.

merci