我得到编译错误,因为第一行可以为我修复它吗?

我得到编译错误,因为第一行可以为我修复它吗?

问题描述:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserDetailsScreen.aspx.cs" Inherits="website4_UserDetailsForm" %>

namespace website4


using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Drawing;
using System.Data;
{
    public class UserDetailsForm
    {

移动命名空间使用行在之后行,或者在开放卷曲之后使用语句移动托架。但是首先在文件中使用$ c>行更为正常。



错字:noamrl表示正常 - OrignalGriff [/ edit]
Move the namespace line to after the using lines, or move the using statements to after the open curly bracket. But it''s more normal to have the using lines first in the file.

[edit]Typo: "noamrl" for "normal" - OrignalGriff[/edit]


解决方案2的代码是正确的,但这不是唯一的选择。你的问题不是之前或之后,而是括号。您还可以这样做:



The code of Solution 2 is correct, but this is not the only option. You problem is not "before" or "after", but brackets. You also can do:

namespace website4 {
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

//...
} // namespace website4





别忘了删除未使用的使用; Visual Studio有一个菜单项...在它之前,不要忘记删除未使用的引用。



-SA


命名空间应该在使用语句之后



namespace should after Using Statement

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace website4
{