I am using partial classes to split some functionality between 2 files, but I am getting an error. What am I doing wrong?
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'
}
}
As such, C programming does not provide direct support for error handling but being a system programming language, it provides you access at lower level in the form of return values. Most of the C or even Unix function calls return -1 or NULL in case of any error and set an error code errno.
When developing programs there are three types of error that can occur: syntax errors. logic errors. runtime errors.
Errors report problems that make it impossible to compile your program. GCC reports errors with the source file name and line number where the problem is apparent. Warnings report other unusual conditions in your code that may indicate a problem, although compilation can (and does) proceed.
Are the two partial classes in the same namespace? That could be an explanation.
Same answer as @Andrey K but in simple terms
Set the build action of all your partial classes to 'Compile' using the 'Properties' windows of each of those files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With