Click here to Skip to main content
14,332,394 members
   

C#

 
GeneralRe: My thoughts on C# Pin
#realJSOP3-Jun-19 0:10
mve#realJSOP3-Jun-19 0:10 
GeneralRe: My thoughts on C# Pin
Dave Kreskowiak3-Jun-19 2:41
mveDave Kreskowiak3-Jun-19 2:41 
GeneralRe: My thoughts on C# Pin
#realJSOP2-Jun-19 4:19
mve#realJSOP2-Jun-19 4:19 
GeneralRe: My thoughts on C# Pin
jschell2-Jun-19 8:49
memberjschell2-Jun-19 8:49 
GeneralRe: My thoughts on C# Pin
Brian_TheLion2-Jun-19 19:46
memberBrian_TheLion2-Jun-19 19:46 
GeneralRe: My thoughts on C# Pin
F-ES Sitecore2-Jun-19 23:19
mveF-ES Sitecore2-Jun-19 23:19 
GeneralRe: My thoughts on C# Pin
Brian_TheLion3-Jun-19 12:26
memberBrian_TheLion3-Jun-19 12:26 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 1:31
professionalNathan Minier4-Jun-19 1:31 
Brian_TheLion wrote:
I'm being drawn towards C++ as it does allow global variables compared to C#. I know that it's not good to use global variables and most variables should remind within their own class but it's not always easy to design a program like this and the program I have in mind that I want to write has many varables between classes.


Yeah, that's not how you do that. There are a few approaches that are valid from a C# point of view, but by and large a variable in the global namespace is never the answer unless the language itself forces that on you (thank you, JavaScript).

There are better tools: a static container class, a service locator, or best of all dependency injection.

Brian_TheLion wrote:
I have in mind that I want to write has many varables between classes. I could write it with less classes but I want to have classes for certain purposes that can be reused in other programs. It also makes the program easier to deal with when changes are made.


Good OOP uses many, many classes that work in conjunction to build a system.I suggest you take some time to learn about SOLID Programming.

Global variables also make maintenance much, much harder in complex software. Modern IDEs have made this a little less significant, but for good, flexible software you should still prefer composability to imperative structure.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor

GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 14:16
memberBrian_TheLion4-Jun-19 14:16 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 14:26
professionalNathan Minier4-Jun-19 14:26 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 14:30
memberBrian_TheLion4-Jun-19 14:30 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 14:40
professionalNathan Minier4-Jun-19 14:40 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 14:53
memberBrian_TheLion4-Jun-19 14:53 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 14:47
professionalNathan Minier4-Jun-19 14:47 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 15:12
memberBrian_TheLion4-Jun-19 15:12 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 15:29
professionalNathan Minier4-Jun-19 15:29 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 16:37
memberBrian_TheLion4-Jun-19 16:37 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 15:28
memberBrian_TheLion4-Jun-19 15:28 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 15:38
memberBrian_TheLion4-Jun-19 15:38 
GeneralRe: My thoughts on C# Pin
Nathan Minier4-Jun-19 15:41
professionalNathan Minier4-Jun-19 15:41 
GeneralRe: My thoughts on C# Pin
Gerry Schmitz4-Jun-19 6:53
mveGerry Schmitz4-Jun-19 6:53 
GeneralRe: My thoughts on C# Pin
Brian_TheLion4-Jun-19 18:44
memberBrian_TheLion4-Jun-19 18:44 
QuestionHow to perform the content of a variable as a C# instruction Pin
Member 133074841-Jun-19 10:02
memberMember 133074841-Jun-19 10:02 
AnswerRe: How to perform the content of a variable as a C# instruction Pin
BillWoodruff1-Jun-19 15:33
mveBillWoodruff1-Jun-19 15:33 
GeneralRe: How to perform the content of a variable as a C# instruction Pin
Member 133074841-Jun-19 18:22
memberMember 133074841-Jun-19 18:22 

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.