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