Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Class design question...
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00710694
Message ID:
00710702
Views:
14
It's great to get positive feedback on the book. I agree that Kevin covered so many areas, not covered in many books and gave great resources for further education.

If you will only need one set of variables then using STATIC is fine. However, if you need (or anticipate needing to) have more then one instance of this class then don't use STATIC. One common approach to allow multiple instances is to use a Statuc constructor on the class that will create a physical instance of itself the first time the static member of the class is accessed. In effect, the first time you ask for the value of one of the class's field, a new instance of the class will be created and set against the field. The class should be scoped as Public.


>Thanks, Cathi...I figured that would also be an advantage. We do many enhancements to our product every month or two, so users often download a new EXE. Obviously, breaking it out means smaller downloads for just the stuff that changed.
>
>A follow-up question, dealing with properties of a class. Let's say I have a user class, where I determine (at user signon) what rights a user has. I set user rights as properties in the user class (lCanSavePayments, lCanRunReports, etc.)
>
>In different modules through the software, I need to read from those user class properties [usually to determine if someone can run an option]. So in different modules, I'll have to 're-instantiate' the class...(UserClass myclass = new UserClass).
>
>When I initially did that, all the properties I set at startup were lost...the only way I could retain them was to define them as STATIC in the class. Is that an 'acceptable' way of doing things?
>
>Thanks,
>Kevin
>
>P.S. I've gone through most of the new book (.NET for VFP). Great book! I was going to write a 5-star review on Amazon, but they don't have the option (yet) to write a review on the Web page that advertises the book. For some reason they believe the book won't be published until 01/2003. I've told several friends about the book and urged them to buy from Henztenwerke. You and Kevin created a great reference that covers more areas of .NET than any book I've seen.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform