C
C#2y ago
bilal94

Can someone explain this for me

namespace CSharp
{
internal class Program
{
static void Main(string[] args)
namespace CSharp
{
internal class Program
{
static void Main(string[] args)
Can someone tell me what this does, as I am new to C#
3 Replies
Thinker
Thinker2y ago
CSharp is like a "folder" that the class Program exists in. Program is a class, something which contains one or more members, for instance methods. Main is a method, something which executes code. This method is very special, because it's called at the very start of your program. Oh and args you don't need to worry about for now, it has to do with what happens when you open your executable file and run the program.
Aeon Vex
Aeon Vex2y ago
also the internal keyword before class Program marks the class as only accessible within this assembly, which is like a bundle of namespaces and classes. you don't need to worry about that for now, just know that your code is always part of an assembly. sidenote: if you were to leave out the internal keyword, the compiler would add it by default. if you're working on a simple project with only one assembly, and you're not writing a library, public and internal are kind of interchangeable, as both are equally accessible to everything within the same assembly. as soon as you start working with multiple assemblies you should know the difference between the two however, and only mark public what should be accessible to other assemblies.
bilal94
bilal942y ago
Thanks guys
Want results from more Discord servers?
Add your server
More Posts
HashCode randomly changing on structures.I've never in my career of coding have seen the behavior I'm about to describe so I'm hoping to learCOMException on Windows.Storage.Pickers.FolderPickerI am receiving the error `Error HRESULT E_FAIL has been returned from a call to a COM component` wheLinq Where JsonSerialization not workingHey, is there a way to get the following running: ```cs dbSet.Set<Table>().Where(x => JsonSerializerMicrosoft's DI Hierarchically controlled lifetime manager? [Answered]With Microsoft's DI, what's the equivalent of hierarchically controlled lifetime manager? The situatDisable bootstrap multiselect options after selectingHi. I have a bootstrap `<select multiple/>`. When one is selected, I want to disable all other selecReading ConfigurationSay I have a class like this: ```cs public StepGenerator(MigrationSteps migration) { XAML Binding error, cannot find sourceHello, I do get a binding error when trying to bind a string from codebehind as content of a ComboBI want on a click of a button in form1 to change a thing in 2nd form, but can't manage [Answered]So i have 4 forms - Main menu - then 3 subForms referenced to that. In form1 i want to click button Unmanaged struct backed INPC ViewModel, only raising PropertyChanged when backing field(s) changedSo, suppose we have a large unmanaged struct that we obtain from external source, suppose from a netTrying to fade In and out ObjectI've been stuck for awhile now, Been trying to figure out how to loop it and have it fade in and out