2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / errors / cs0027-2.cs
blob33e1fb9186df0bbd8e9e6bc6a8d465bdb3dc17eb
1 // cs0027-2.cs: Keyword `this' is not available in the current context
2 // Line: 10
4 // Attention: Here the compiler complains saying that cannot convert implicitly from 'Error0027' to 'int' but
5 // should also say that the use of keyword 'this' is out of context since it's used outside a constructor, method
6 // or property.
7 using System;
9 class Error0027 {
10 int i = this;
11 int x = 0;
13 public static void Main () {
14 Console.WriteLine ("The compiler should complain: Error CS0027 trying to use 'this' outside context.");
15 Console.WriteLine ("Trying to assign i to 'this' outside a method, property or ctr.");