내 C # 클래스 코드 (Class1.cs) :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Montajat.App_Code
{
public class Class1
{
}
}
default.aspx.cs 코드 :
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
aspx.cs 파일의 Page_Load에서 Class1을 어떻게 사용할 수 있으며 왜 지금 사용할 수 없습니까?
맨 위에는 네임 스페이스가 포함됩니다 .
using Montajat.App_Code;
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Class1 objClass1 = new Class1();
}
}
또는 정규화 된 이름을 사용하여 수행 할 수 있습니다.
public partial class _default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Montajat.App_Code.Class1 objClass1 = new Montajat.App_Code.Class1();
}
}
수업 :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Montajat.App_Code
{
public class Class1
{
public Class1()
{
}
}
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다