我正在使用部分类将某些功能分割到2个文件中,但是出现了一个错误。我做错了什么?
A1.cs:
private partial class A
{
private string SomeProperty { get { return "SomeGeneratedString"; } }
}
A2.cs:
private partial class A
{
void SomeFunction()
{
//trying to access this.SomeProperty produces the following compiler error, at least with C# 2.0
//error CS0117: 'A' does not contain a definition for 'SomeProperty'
}
}
App.xaml
和App.xaml.cs
上。我忘记显式添加 C# 文件,因此生成的代码不完整,即使在解决方案资源管理器中也显示了 C# 文件。必须手动编辑csproj
以正确添加 C# 文件。 - Timo