0
以下のコードをASPXファイル(MyTest.aspx)の中に挿入します。私はCode Behind
を使いたくありません。 ASP.NETページ(インラインコード方式)の内部で名前空間を定義する方法ASP.NETページ内で名前空間を定義する方法(インラインコードメソッド)?
Compiler Error Message: CS1519: Invalid token 'namespace' in class, struct, or interface member declaration
:ページ(MyTest.aspx)を閲覧中
<%@ Page Language="C#" %>
<script runat="server">
namespace MyNamespace
{
class MyClass
{
}
}
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Hello World!");
}
</script>
しかし、次のエラーが発生しましたか?