Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variables C#
Message
From
13/12/2009 11:16:13
 
 
To
13/12/2009 10:51:08
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01438724
Message ID:
01438832
Views:
53
>>>>>>Cetin.
>>>>>>
>>>>>>I have a class like this called myAppConstants, but I'm interesting in variables, not constants, that span all forms
>>>>>>A good example is the ID of the user who logs into the application.
>>>>>>All forms need that information.
>>>>>>I'm rolling it forward from form to form using properties.
>>>>>>Am I missing something?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>>you again refer to it as:
>>>>>>myApplication.definitions.myConStr
>>>>>>
>>>>>>However if value is changed it's only 'definitions' class that you need a recompile (other classes obtain value at runtime despite compile time if it's a field and not a constant). Also with constants and fields you're not limited to simple types and could get the value using a method (and say read from a txt,xml file or ask to user etc). ie:
>>>>>
>>>>>Yes, you are missing that I suggest an alternative to constants in that message's question. Sample shows readonly which instead you might use read/write property.
>>>>>Cetin
>>>>
>>>>That is suggested by Bill Wagner as well in his excellent books "Effective C#" and "More Effective C#". In fact it is the second of 50 tips in the first book: "Prefer readonly to const".
>>>>
>>>>Good books, BTW. The second one focuses on new features in C# 3.0 and 3.5. He is probably running like a hamster on a wheel on another volume, covering C# 4.0, even as we speak ;-)
>>>
>>>I hope to read those books and at the moment I am doing some Silverlight 4 with WCF services on 4.0:)
>>
>>A jump ahead of me ;-) I am still getting up to speed on what is yesterday's news for you. Oh, well. At least I'm learning. I'm sure we agree that the day you stop learning things in this business is the day you're in trouble.
>>
>>That said, you may think this is funny. Just this week I started learning some new skills -- Access 2003 and VBA! (lol) I started a six month contract two weeks ago, primarily VFP 8 and SQL Server (migrating production databases to 2008 this weekend), with a fair number of Access/VBA batch processes. When I finished my open tasks a little early and went to my manager for more work, he looked over the list for the current "sprint" (they are an Agile shop) and asked if I felt like taking on some work in one of those processes. I gave him the classic consultant's response: "Sure." <g> Ordered a book from Amazon, delved into the code, and I'm off to the races.
>
>
>No I wouldn't laugh - since delving into C# world VFP doesn't seem to be the best thiing in this world to me:) VBA is the language behind all office and alike products anyway.
>Cetin

Hi,
Not directly relevant in the case but I've alway been meaning to take a look at the VS 'Tools for Office'.
I never see any questions here on the subject.
Have you done anything with it ?
Regards,
Viv
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform