Hi! I'm learning C# right now, and the tutorials I'm using are great, but as a coding expert, I was wondering if you had any off-the-cuff recommendations for like, basic C-language coding terminology explanations. Like, I *sort of* get the public variable distinction, but I don't *really* get it and I'd love to be able to read an explanation for things like that specifically.
Sorry, I'm not really sure where you'd go for that sort of information. Any followers have any advice?
LearnXinYMinutes is a really good reference if you already have some sense of how things are put together, some languages don't require a CS degree to read through the explanation. I even used it myself to quickly review C# since I have barely touched that language in a few years (Elixir, Python, C, Bash, Pascal-like -- are what I use in my day-job).
https://learnxinyminutes.com/docs/csharp/
@oneominousvalbatross Jump to "Bicycle" for the visibility (public, private, protected, internal) explanation with Ctrl+F to search.
Microsoft's docs on it are also an *okay* reference, there was a lot in the .NET implementation that I ran into as issues for dealing with raw network and serial connections, it's still documentation.
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/accessibility-levels
There's some foundations that need to be found outside of tutorials, here is a summary of a 100 level Computer Science course. C# is going to fall into the realm of OOP (Object Oriented Programming); where rather than writing functions that just do stuff, that stuff is attached to classes as methods. Other stuff that is stored as variables of the class is what are known as properties of a class or object. There is a distinction between class and object, where the class is typically called the blueprint or template; this is a half-truth and a little more complex without getting into how programming languages are designed. The class can contain methods that act on the instance of the class (the object), or methods that act on data fed to a the class itself when they are declared with "static".
FooClass foo = new FooClass(); // Object
foo.someSelfOperation(); // Instance method
FooClass.turnXintoY(bar); // static Class method
// public static turnXintoY(int x) { return y; }
This is where I explain visibilty/public/private.
Public: Any class/object can access the labeled property or method. This can be anything that references it.
Private: Only the class/object itself can access the labeled property or method.
Protected: Only the class/object itself _and_ those that *inherit* it will have access. I recommend reading up on Inheritance early it really helps with code reuse.
// Has Access to protected in Bicycle
class MountainBike : Bicycle { ... }
// Can only access public in Bicycle
class FooBar2000 : MusicProgram { ... }
Internal: Only files in the same Assembly will have access. What does that mean? Files that get compiled into the same final file will have access, like `exe` and `dll`. It doesn't matter so much if you're not building libraries for other people to use, but if you build two projects the `exe` will not be able to access those protected items in the `dll`. `pingle.dll` will similarly not be able to access protected items in `sprocket.dll` if it is linked against it. Really, you might not have to worry about this one until much later.
That's it for what I can provide right now, don't look into C# as C-like because then terminology will get mixed; `static` means something **completely** different in C.

















