Scenario
I have a C# Win Forms App, where the Main Form contains a loop that creates 3000 Instances of another CLASS (CLASS B). Inside Form B there are a large number of properties and fields and a bunch of methods that do a fair amount of processing.
Question
Will the creation of 3000 of these classes give me problems? I’m thinking along the lines of memory exceptions? I’ve had 1 or 2 already, and I’ve also had an exception that says something along the lines of "Something went bang and this is usually a sign of corrupt memory somewhere else".
Setup
I’m using a DevExpress Ribbon Form and I haven’t implemented Dispose on anything….Do I need to?
Help greatly appreciated.
3000 objects is not massive in general, but would have to question the sanity of 3000 forms.
Presumably you are not displaying these all to the user simultaneously so a better approach might be to open instances of the form as required by the user and have a method DisplayData(..) that populates the form with the data required for that record. A user is unlikely to open 3000 simutaneously! 3-5 would be more reasonable.
You should also think about re-layering your app so the processing logic is separated from the forms themselves. This will give you more flexibility for scaling the processing layer should you need to. Have a google for MVC / MVP as a starter.