locked
Class file problem RRS feed

  • Question

  • Hi everybody, I am currently stuck in this Class Library problem. I have a Class Library called ClsLib and is required to create a sub .cs file under a .cs file. For example,


    . clsFile
        . ClsLib.clsFile.(something)


    . C I would appreciate if anyone would be able to help me with this. Thanks.


       

       

    Tuesday, December 1, 2009 2:39 AM

Answers

  • What I am required to accomplish has been stated in this website: http://www.delarou.net/weblog/2006/11/21/VisualStudioNETMacroForNestingProjectItems.aspx A big thanks to everybody for their help.
    • Marked as answer by liurong luo Friday, December 4, 2009 6:14 AM
    Thursday, December 3, 2009 1:15 AM

All replies

  • in your ClsLib file, include the following:

        partial class clsFile
        {
            class ClsLib
            {
            }
        }

    And then following the same qualified namespace (assume for this example the class clsFile is a member of namespace TestApplication)

    namespace TestApplication
    {
        partial class clsFile
        {
            class something
            {
            }
        }
    
    }
    


    This will allow you to spread the clsFile class across multiple files, but...  a .cs file cannot be a child of another .cs file (by that I mean "treed below another one" in the project).  Other file types have templated to them that allow for page/compiler directives and expect a code file to work in conjunction with them.  However, the code files themselves aren't aware of and don't comprehend this layer of division - mainly because that layer of division those files have are brought into the project's fold using .cs files. 
    Tuesday, December 1, 2009 3:18 AM
  • I agree with syntaxeater. Why do you want to "create a sub .cs file under a .cs file"?? It seems that the stucture is something like a namespace name, do you really want a structured namespace if I may ask?
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback, please tell us.
    Welcome to the All-In-One Code Framework!
    Wednesday, December 2, 2009 10:21 AM
  • What I am required to accomplish has been stated in this website: http://www.delarou.net/weblog/2006/11/21/VisualStudioNETMacroForNestingProjectItems.aspx A big thanks to everybody for their help.
    • Marked as answer by liurong luo Friday, December 4, 2009 6:14 AM
    Thursday, December 3, 2009 1:15 AM
  • Although I can't think of any specific instances where it might be an issue...  Are you not at all leery about needing to use custom IDE macros to modify a value that 1) is determined and specified before the project is created and 2) could have easily been made available to the developer in the IDE if it was prefered and not problematic?
    Thursday, December 3, 2009 1:53 AM