diff options
author | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-11-30 22:13:45 +0300 |
---|---|---|
committer | Jaime Anguiano Olarra <jaime@mono-cvs.ximian.com> | 2002-11-30 22:13:45 +0300 |
commit | d735632a9efcdc38484bd1a157b12e419bdf46b2 (patch) | |
tree | e6c2ef985ac1bd06ec808888334239ee701c9024 /mcs/errors/cs0027.cs | |
parent | cb985ccfd9be4bc46aafe6e3a835ba5c9b17ab93 (diff) |
Test for C# Compiler Error CS0027: Tried to used 'this' outside a constructor, method or property.
svn path=/trunk/mcs/; revision=9290
Diffstat (limited to 'mcs/errors/cs0027.cs')
-rw-r--r-- | mcs/errors/cs0027.cs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/mcs/errors/cs0027.cs b/mcs/errors/cs0027.cs new file mode 100644 index 00000000000..35aee1b9cc8 --- /dev/null +++ b/mcs/errors/cs0027.cs @@ -0,0 +1,15 @@ +// cs0027.cs: Keyword 'this' can't be used outside a constructor, a method or a property. +// Line: 7 + +using System; + +class Error0027 { + int i = this.x; + int x = 0; + + public static void Main () { + Console.WriteLine ("The compiler should complain: Error CS0027 trying to use 'this' outside context."); + Console.WriteLine ("Trying to assign i to 'this.x' outside a method, property or ctr."); + } +} + |