Click here to Skip to main content
15,920,801 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: visual studio thinks it resides in Europe, and we're actually in the US Pin
Mihai Pruna20-Jan-09 2:57
Mihai Pruna20-Jan-09 2:57 
AnswerRe: visual studio thinks it resides in Europe, and we're actually in the US Pin
omlac20-Jan-09 3:16
omlac20-Jan-09 3:16 
QuestionDoes the use of many trivial classes with generics pose a performance penalty? Pin
supercat919-Jan-09 10:00
supercat919-Jan-09 10:00 
AnswerRe: Does the use of many trivial classes with generics pose a performance penalty? Pin
Member 362614020-Jan-09 11:06
Member 362614020-Jan-09 11:06 
AnswerRe: Does the use of many trivial classes with generics pose a performance penalty? Pin
Mark Churchill20-Jan-09 14:36
Mark Churchill20-Jan-09 14:36 
GeneralRe: Does the use of many trivial classes with generics pose a performance penalty? Pin
supercat920-Jan-09 16:07
supercat920-Jan-09 16:07 
GeneralRe: Does the use of many trivial classes with generics pose a performance penalty? Pin
Mark Churchill20-Jan-09 16:31
Mark Churchill20-Jan-09 16:31 
GeneralRe: Does the use of many trivial classes with generics pose a performance penalty? Pin
supercat920-Jan-09 18:45
supercat920-Jan-09 18:45 
The basic concept is that I have an class for objects that contain a number of objects that the class doesn't really understand in detail (an iEnumerable is a common example of such a thing, though hardly the most sophisticated) and I would like for code outside the class to be able to invoke methods on some or all of the objects within, generally passing the same parameters to all. In some regards similar to delegates, except (1) delegates are hard-wired for particular method-object pairs, and (2) there is no need to hold the method info for a delegate without holding a hard reference to the object.

One class I created using this approach (which seems to work nicely, though I haven't benchmarked its behavior in a program with hundreds of classes) manages something like event subscription, but using weak references. Any number of objects may subscribe to a 'publisher' object; performing .Exec(of T) on the publisher object will cause it to call function iAct(of T).Act on any subscribed object supporting interface iAct(of T). Subscription and unsubscription are O(1), non-locking, and thread-safe; an object will be unsubscribed if it (1) gets garbage-collected, (2) uses the Unsubscribe method of the Subscription object returned when the object originally subscribed, or (3) one of its iAct(of T) functions returns True when invoked.

My original intended application for this class would be in an application where a number of forms have controls that affect the same properties and should thus all affect each other. While events provide a nice way to achieve much of that functionality, all the forms need a reference to an object that will support all of the events they need. If new events are added, the linking object will have to be extended to support them. Worse, using events creates the possibility of memory or resource leaks if any objects don't get properly disposed. Finalizers won't do any good if delegates keep objects alive forever.

Using my actionLink class avoids these difficulties; if I create a class called e.g. volumeChangedParam, I can call Exec(of volumeChangedParam) on my event publisher object and any subscribed object that supports an iAct(of volumeChangedParam) will have its iAct(of volumeChangedParam).Act function called. The actionLink class doesn't have to know anything about volumeChangedParam or any of the other classes it works with; additional classes could be added to support other operations.

All this stuff seems to work fine, but I wouldn't want to engineer too much of a system around it if it turned out that, e.g. the .net framework performs wonderfully when an application uses less than a certain number of classes, and starts dogging badly if the application uses more.
QuestionDynamic Blob field Pin
dwolver19-Jan-09 9:21
dwolver19-Jan-09 9:21 
AnswerRe: Dynamic Blob field Pin
Eddy Vluggen19-Jan-09 9:37
professionalEddy Vluggen19-Jan-09 9:37 
AnswerRe: Dynamic Blob field Pin
Wendelius20-Jan-09 9:22
mentorWendelius20-Jan-09 9:22 
GeneralRe: Dynamic Blob field Pin
Member 362614020-Jan-09 10:23
Member 362614020-Jan-09 10:23 
QuestionSSHExec:: RunCommand and X11 forwarding Pin
peppoRao7119-Jan-09 8:36
peppoRao7119-Jan-09 8:36 
QuestionVirtualPageProvider - Not getting hit on virtual file requests [modified] Pin
Tristan Rhodes19-Jan-09 3:51
Tristan Rhodes19-Jan-09 3:51 
AnswerRe: VirtualPageProvider - Not getting hit on virtual file requests Pin
cmk19-Jan-09 14:09
cmk19-Jan-09 14:09 
GeneralRe: VirtualPageProvider - Not getting hit on virtual file requests Pin
Tristan Rhodes20-Jan-09 2:24
Tristan Rhodes20-Jan-09 2:24 
GeneralRe: VirtualPageProvider - Not getting hit on virtual file requests Pin
cmk20-Jan-09 5:02
cmk20-Jan-09 5:02 
QuestionHow Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
ox010118-Jan-09 16:05
ox010118-Jan-09 16:05 
AnswerRe: How Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
«_Superman_»18-Jan-09 17:01
professional«_Superman_»18-Jan-09 17:01 
GeneralRe: How Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
ox010118-Jan-09 17:09
ox010118-Jan-09 17:09 
AnswerRe: How Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
Eddy Vluggen19-Jan-09 1:42
professionalEddy Vluggen19-Jan-09 1:42 
AnswerRe: How Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
ox010118-Jan-09 20:26
ox010118-Jan-09 20:26 
GeneralRe: How Can i develop programs in PPC(Pocket PC with Windows Mobile) Pin
Not Active19-Jan-09 2:27
mentorNot Active19-Jan-09 2:27 
Questionwhy Signing with private key ? Pin
bolly-8117-Jan-09 8:58
bolly-8117-Jan-09 8:58 
AnswerRe: why Signing with private key ? Pin
Colin Angus Mackay17-Jan-09 11:48
Colin Angus Mackay17-Jan-09 11:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.