Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
thegloomyclown26-Jun-07 4:45
thegloomyclown26-Jun-07 4:45 
GeneralRe: Loading referenced assemblies using System.Reflection Pin
Ed.Poore26-Jun-07 5:02
Ed.Poore26-Jun-07 5:02 
QuestionMultiThreading Pin
HexaDeveloper25-Jun-07 5:53
HexaDeveloper25-Jun-07 5:53 
AnswerRe: MultiThreading Pin
led mike25-Jun-07 6:11
led mike25-Jun-07 6:11 
GeneralRe: MultiThreading Pin
HexaDeveloper25-Jun-07 7:00
HexaDeveloper25-Jun-07 7:00 
GeneralRe: MultiThreading Pin
led mike25-Jun-07 9:21
led mike25-Jun-07 9:21 
AnswerRe: MultiThreading Pin
Hesham Yassin26-Jun-07 5:47
Hesham Yassin26-Jun-07 5:47 
QuestionStructuring my program Pin
ruanr25-Jun-07 4:39
ruanr25-Jun-07 4:39 
Hi,

This is hard to explain, but it is a simple enough problem...

I have a large dataset (Class 'Dataset') that will be altered by a sequence of events (Abstract class Event, not events in the sense of delegate events). I need to be able to reconstruct the state of this dataset after any amount of events, so I designed an Event abstract class which will be extended for every type of event that can happen. An instance of the specific type is created, applied to the dataset, and stored in a list whenever an event occurs.

Now, it is quite important that the rest of my program does not modify any of the data without constructing an Event, otherwise if I recreate the dataset at that point in time (by re-applying all the events in my list) it will not be consistent with the original.

At the moment my Event has the abstract method Apply(Dataset data), which applies the changes for that event to the given dataset. However, this means I have to keep a most of Dataset's members public, and (besides being bad OO practice) if I or someone else accidentally modify any of them w/o an Event, it's going to be quite hard to debug.

My other option would be to include an overloaded method in Dataset that applies each Event accordingly, but I'm not sure how it will apply. For example, if I have extended Event to EventA, and do:
<br />
Event e = new EventA();<br />
<br />
Dataset.ApplyEvent (e);<br />

and Dataset has two ApplyEvent methods:
<br />
public void ApplyEvent (Event e) {}<br />
<br />
public void ApplyEvent (EventA e) {}<br />


Will the overloaded method for EventA be called? Or is there a simpler, elegant solution I'm not thinking of?

Sorry for the long post and thanks for your help Smile | :)
AnswerRe: Structuring my program Pin
led mike25-Jun-07 4:51
led mike25-Jun-07 4:51 
GeneralRe: Structuring my program Pin
ruanr25-Jun-07 20:43
ruanr25-Jun-07 20:43 
GeneralRe: Structuring my program Pin
led mike26-Jun-07 5:08
led mike26-Jun-07 5:08 
QuestionGoogle Page Rank Calculator Pin
zeltera25-Jun-07 4:31
zeltera25-Jun-07 4:31 
AnswerRe: Google Page Rank Calculator Pin
Vasudevan Deepak Kumar25-Jun-07 5:04
Vasudevan Deepak Kumar25-Jun-07 5:04 
GeneralRe: Google Page Rank Calculator Pin
zeltera25-Jun-07 5:08
zeltera25-Jun-07 5:08 
QuestionStack OverFlow Exception in C# Pin
meeram39525-Jun-07 4:26
meeram39525-Jun-07 4:26 
AnswerRe: Stack OverFlow Exception in C# Pin
led mike25-Jun-07 4:46
led mike25-Jun-07 4:46 
GeneralRe: Stack OverFlow Exception in C# Pin
meeram39525-Jun-07 19:53
meeram39525-Jun-07 19:53 
AnswerRe: Stack OverFlow Exception in C# Pin
Guffa25-Jun-07 6:11
Guffa25-Jun-07 6:11 
GeneralRe: Stack OverFlow Exception in C# [modified] Pin
meeram39525-Jun-07 19:39
meeram39525-Jun-07 19:39 
AnswerRe: Stack OverFlow Exception in C# Pin
Luc Pattyn25-Jun-07 10:27
sitebuilderLuc Pattyn25-Jun-07 10:27 
QuestionDo post your Articles here Pin
MussaratAziz25-Jun-07 4:23
MussaratAziz25-Jun-07 4:23 
AnswerRe: Do post your Articles here Pin
Dave Kreskowiak25-Jun-07 4:36
mveDave Kreskowiak25-Jun-07 4:36 
GeneralRe: Do post your Articles here Pin
mav.northwind25-Jun-07 18:57
mav.northwind25-Jun-07 18:57 
GeneralRe: Do post your Articles here Pin
Dave Kreskowiak26-Jun-07 2:45
mveDave Kreskowiak26-Jun-07 2:45 
QuestionAccessing the default application folder Pin
Richard W Allen25-Jun-07 3:35
Richard W Allen25-Jun-07 3:35 

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.