locked
Given a file (active document), if it is a partial class, how do I get the methods defined for this partial class. RRS feed

  • Question

  • Given a file (active document), if it is a partial class, how do I get the methods defined for this partial class?

    I'm using code similar to that from the article:

    http://www.mztools.com/articles/2006/mz2006008.aspx

    But for a partial class the filecodemodel is null.

    DTE.ActiveDocument.ProjectItem.FileCodeModel is null.


    Monday, October 15, 2012 11:46 AM

Answers

  • Hi Derek,

    I created a partial class like:

        public partial class Employee
        {
            public void DoWork()
            {
            }
        }
        public partial class Employee
        {
            public void GoToLunch()
            {
            }
        }

    I ran this macro, it can show the kind of the functions in the partial class.

    Did you create an add-in or use macro?

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Derek Morin Tuesday, October 16, 2012 11:52 AM
    Tuesday, October 16, 2012 6:30 AM

All replies

  • Hi Derek,

    I created a partial class like:

        public partial class Employee
        {
            public void DoWork()
            {
            }
        }
        public partial class Employee
        {
            public void GoToLunch()
            {
            }
        }

    I ran this macro, it can show the kind of the functions in the partial class.

    Did you create an add-in or use macro?

    Best regards,


    Ego [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Derek Morin Tuesday, October 16, 2012 11:52 AM
    Tuesday, October 16, 2012 6:30 AM
  • I'm not seeing the problem any more.  If I see it again, I'll try to get better details and make a note of what file I was in.  At the time, it seemed like my function was working in a regular class but not a partial class, but maybe the computer Gremlins were just acting up for a little bit.
    Tuesday, October 16, 2012 11:53 AM