Why is the compiler Error CS0116 above everything?
<p>I get <a href="http://msdn.microsoft.com/en-us/library/xx071h86%28v=VS.90%29.aspx" rel="nofollow">Compiler Error CS0116</a> in the code:</p>

<pre><code>&lt;%@ Page EnableEventValidation="false" ValidateRequest="false" Language="C#" AutoEventWireup="true"

CodeFile="../Default.aspx.cs" Inherits="x.Program" %&gt;

&lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %&gt;

&lt;%@ Register Assembly="Validators" Namespace="Sample.Web.UI.Compatibility" TagPrefix="cc1" %&gt;

&lt;%@ Import Namespace="System.IO" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head id="Head1" runat="server"&gt;
&lt;title&gt;Title&lt;/title&gt;
&lt;link href="StyleSheet.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;
&lt;body class="mainbody"&gt;&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>script code in Default.aspx.cs(Please note that "this random text somehow ignored" is ignored and no syntax error is generated):</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

//this random text somehow ignored (now commented)

namespace x
{
// To fix the error, you must
// enclose a method in a class:

 class Program // changed from Class Program
 {
 void Method2(string str)
  {
  Console.WriteLine(str)
  }
 }
}
</code></pre>

<p>Why is the compiler Error CS0116 appearing? Why are the other things ignored (such as syntax error)? Update: Please note, if I delete "this random text somehow ignored" line error still persist.</p>

<p>FINAL UPDATE:
Solution is 
1. Obviously, extra line should be deleted.
2. Tools->Options->Text Editor->Basic->VB-Specific->Pretty listing(reformatting) of code was on and caused automatic change of case ("class" to "Class"). I didn't notice it straight away.
Thank you very much. It works as charm now. @Rob Levine and @Guffa I can accept only one answer, but you both did a great job! </p>
