我正在写下两个部分类,如下所示:
PartialClassOne.cs:
namespace PartialClassBasic
{
public partial class PartialClass
{
private string firlstName;
public string FirlstName
{
get { return firlstName; }
set { firlstName = value; }
}
private string lastName;
public string LastName
{
get { return lastName; }
set { lastName = value; }
}
}
}
ParticalClassTwo.cs:
namespace PartialClassBasic
{
public partial class ParticalClass
{
public string getFullName()
{
return FirstName + ", " + LastName;
}
}
}
当我构建这个解决方案时,我得到了2个编译错误消息,如下所示:
The name 'FirstName' does not exist in the current context
The name 'LastName' does not exist in the current context
那么,谁可以告诉我,我的代码有问题?
谢谢!
答案 0 :(得分:1)
你弄错了。
<html>
<head>
<title>This is My Page's Title</title>
<style type="text/css">
#left {
float:left;
width:180px;
background-color:#ff0000;
}
#right {
width: 100%;
background-color:#00FF00;
}
</style>
</head>
<body>
<div>
<div id="right">
right
</div>
<div id="left">
left
</div>
</div>
</body>
</html>
应该是:
public partial class ParticalClass
此外,
public partial class PartialClass
应该是:
public string FirlstName