Note that there are some explanatory texts on larger screens.

plurals
  1. PODividing class file into partial classes affects scope?
    text
    copied!<p>I have a class library project, and my namespace/main class looks like this:</p> <p>File: Document.cs</p> <pre><code> namespace HtmlEngine { public class Document : IDisposable { ... public class DocumentActionReplaceByTag : IDocumentAction { </code></pre> <p>All of this works fine, and in another project/assembly I put:</p> <pre><code>using HtmlEngine; ... DocumentActionReplaceByTag currentDocAction = new HtmlEngine.DocumentActionReplaceByTag("[NEXT_PART]"); </code></pre> <p>and it works perfectly. However, I've now divided that Document class file into several files, called DocumentActions.cs, DocumentSections.cs, as well as keeping the main functionality in my Document.cs file. At the top of each of these I put:</p> <pre><code>public partial class Document : IDisposable { </code></pre> <p>Now, in the consuming project I get a 'cannot resolve symbol 'DocumentActionReplaceByTag'' error. I still have my using reference to HtmlEngine.</p> <p>The closest thing on the 'net I could find was this post which describes my plight similarly, but he wasn't very clear about the reasons for it happening: <a href="http://www.daniweb.com/software-development/csharp/threads/140673/understanding-partial-classes" rel="nofollow">http://www.daniweb.com/software-development/csharp/threads/140673/understanding-partial-classes</a></p> <p>I have always believed partial classes were syntactic sugar and they were combined into a single class prior to compilation. I repeated the interface for each partial class declaration, not sure if that could be a factor.</p> <p>Why would this now be out of scope? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload