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. BeginInit() and EndIinit() performance

BeginInit() and EndIinit() performance

Scheduled Pinned Locked Moved C#
performancehelpquestion
8 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.
  • T Offline
    T Offline
    Tavbi
    wrote on last edited by
    #1

    Hi, I have some custom controls and all have methods BeginInit() and EndInit() in it. In most cases both methods are empty and probably will always empty. Is there any performance problem, because I notice in myForm.designer all controls have this two lines: ((System.ComponentModel.ISupportInitialize)(this.crLabel20)).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.crLabe20)).EndInit(); I suppose for all controls both methods are called at runtime. Is this performance wasteful? Thanks and sorry my english, Jure

    M 1 Reply Last reply
    0
    • T Tavbi

      Hi, I have some custom controls and all have methods BeginInit() and EndInit() in it. In most cases both methods are empty and probably will always empty. Is there any performance problem, because I notice in myForm.designer all controls have this two lines: ((System.ComponentModel.ISupportInitialize)(this.crLabel20)).BeginInit(); (System.ComponentModel.ISupportInitialize)(this.crLabe20)).EndInit(); I suppose for all controls both methods are called at runtime. Is this performance wasteful? Thanks and sorry my english, Jure

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      Hello,

      Tavbi wrote:

      I suppose for all controls both methods are called at runtime.

      Yes, it will be called from the constructor (InitialzeComponets) of your form. (When you initialize your form)

      Tavbi wrote:

      Is this performance wasteful?

      No! I wouldn't care too much about it. But maybe if you don't need it at all, you should think of removing it, just to make the code simpler. All the best, Martin

      T D D 3 Replies Last reply
      0
      • M Martin 0

        Hello,

        Tavbi wrote:

        I suppose for all controls both methods are called at runtime.

        Yes, it will be called from the constructor (InitialzeComponets) of your form. (When you initialize your form)

        Tavbi wrote:

        Is this performance wasteful?

        No! I wouldn't care too much about it. But maybe if you don't need it at all, you should think of removing it, just to make the code simpler. All the best, Martin

        T Offline
        T Offline
        Tavbi
        wrote on last edited by
        #3

        Thanks

        M 1 Reply Last reply
        0
        • T Tavbi

          Thanks

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          You are wellcome!

          1 Reply Last reply
          0
          • M Martin 0

            Hello,

            Tavbi wrote:

            I suppose for all controls both methods are called at runtime.

            Yes, it will be called from the constructor (InitialzeComponets) of your form. (When you initialize your form)

            Tavbi wrote:

            Is this performance wasteful?

            No! I wouldn't care too much about it. But maybe if you don't need it at all, you should think of removing it, just to make the code simpler. All the best, Martin

            D Offline
            D Offline
            DavidNohejl
            wrote on last edited by
            #5

            Err but it looks like these were generated by VS. I wouldn't touch them.


            "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

            M 1 Reply Last reply
            0
            • M Martin 0

              Hello,

              Tavbi wrote:

              I suppose for all controls both methods are called at runtime.

              Yes, it will be called from the constructor (InitialzeComponets) of your form. (When you initialize your form)

              Tavbi wrote:

              Is this performance wasteful?

              No! I wouldn't care too much about it. But maybe if you don't need it at all, you should think of removing it, just to make the code simpler. All the best, Martin

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Since that's deigned generated code, the changes you make in there will be overwritten the next time the designed refreshes it. You can also break the designer by messing with that code too!

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              M 1 Reply Last reply
              0
              • D DavidNohejl

                Err but it looks like these were generated by VS. I wouldn't touch them.


                "Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe

                M Offline
                M Offline
                Martin 0
                wrote on last edited by
                #7

                No, No, No! What I mean is removing the interface from the Custom controls (labels,...) Hope he understood it.

                1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Since that's deigned generated code, the changes you make in there will be overwritten the next time the designed refreshes it. You can also break the designer by messing with that code too!

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  M Offline
                  M Offline
                  Martin 0
                  wrote on last edited by
                  #8

                  No, No, No! What I mean is removing the interface from the Custom controls (labels,...) Hope he understood it.

                  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