Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. CodeDom and partial method

CodeDom and partial method

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 3466810
    wrote on last edited by
    #1

    Hi, Is there a way to produce a partial method with CodeDom? Ex. partial void MyMethod() { ... } It looks like the MemberAttributes doesn't have "Partial" in it :( CodeMemberMethod codeMemberMethod = new CodeMemberMethod(); codeMemberMethod.Attributes = MemberAttributes.Public...but no MemberAttributes.Partial? My problem is that I'm generating some code to implement partial method. I have this class (created "by hand"):

    public partial class MyClass
    {
    partial void MyMethod();
    partial void MyMethodB();
    }

    Then with CodeDom, I want to generate the implementation of those partial method. Something like:

    public partial class MyClass
    {
    partial void MyMethod()
    {
    // Do Something
    }

    partial void MyMethodB()
    {
        // Do Something
    }
    

    }

    That's why I need the "Partial" in System.CodeDom.MemberAttributes. May be I'm all wrong...it's something else the MemberAttributes that I should use to do this? Thank

    E P J 3 Replies Last reply
    0
    • U User 3466810

      Hi, Is there a way to produce a partial method with CodeDom? Ex. partial void MyMethod() { ... } It looks like the MemberAttributes doesn't have "Partial" in it :( CodeMemberMethod codeMemberMethod = new CodeMemberMethod(); codeMemberMethod.Attributes = MemberAttributes.Public...but no MemberAttributes.Partial? My problem is that I'm generating some code to implement partial method. I have this class (created "by hand"):

      public partial class MyClass
      {
      partial void MyMethod();
      partial void MyMethodB();
      }

      Then with CodeDom, I want to generate the implementation of those partial method. Something like:

      public partial class MyClass
      {
      partial void MyMethod()
      {
      // Do Something
      }

      partial void MyMethodB()
      {
          // Do Something
      }
      

      }

      That's why I need the "Partial" in System.CodeDom.MemberAttributes. May be I'm all wrong...it's something else the MemberAttributes that I should use to do this? Thank

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      Create an abstract class and then use CodeDom to return an instance. You don't even need an abstract class as you can use an interface as well.

      Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
      Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
      Most of this sig is for Google, not ego.

      1 Reply Last reply
      0
      • U User 3466810

        Hi, Is there a way to produce a partial method with CodeDom? Ex. partial void MyMethod() { ... } It looks like the MemberAttributes doesn't have "Partial" in it :( CodeMemberMethod codeMemberMethod = new CodeMemberMethod(); codeMemberMethod.Attributes = MemberAttributes.Public...but no MemberAttributes.Partial? My problem is that I'm generating some code to implement partial method. I have this class (created "by hand"):

        public partial class MyClass
        {
        partial void MyMethod();
        partial void MyMethodB();
        }

        Then with CodeDom, I want to generate the implementation of those partial method. Something like:

        public partial class MyClass
        {
        partial void MyMethod()
        {
        // Do Something
        }

        partial void MyMethodB()
        {
            // Do Something
        }
        

        }

        That's why I need the "Partial" in System.CodeDom.MemberAttributes. May be I'm all wrong...it's something else the MemberAttributes that I should use to do this? Thank

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        Sorry, but the CodeDOM classes don't support partial methods.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles | MoXAML PowerToys

        1 Reply Last reply
        0
        • U User 3466810

          Hi, Is there a way to produce a partial method with CodeDom? Ex. partial void MyMethod() { ... } It looks like the MemberAttributes doesn't have "Partial" in it :( CodeMemberMethod codeMemberMethod = new CodeMemberMethod(); codeMemberMethod.Attributes = MemberAttributes.Public...but no MemberAttributes.Partial? My problem is that I'm generating some code to implement partial method. I have this class (created "by hand"):

          public partial class MyClass
          {
          partial void MyMethod();
          partial void MyMethodB();
          }

          Then with CodeDom, I want to generate the implementation of those partial method. Something like:

          public partial class MyClass
          {
          partial void MyMethod()
          {
          // Do Something
          }

          partial void MyMethodB()
          {
              // Do Something
          }
          

          }

          That's why I need the "Partial" in System.CodeDom.MemberAttributes. May be I'm all wrong...it's something else the MemberAttributes that I should use to do this? Thank

          J Offline
          J Offline
          jatin sabarmati
          wrote on last edited by
          #4

          check if this article http://www.codeproject.com/KB/dotnet/PartialMethod.aspx[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups