Beginning with Visual Studio
Download And Install Visual Studio

The .NET Framework
With Visual Studio presently introduced, the. NET Framework is additionally introduced since it is a piece of the Visual Studio establishment.Composing applications in C# with Visual Studio influences the. NET Framework. This implies applications can exploit a wide range of administrations that the structure gives. This incorporates things like sparing data to a database, perusing data from a XML document, just as arrangement, organize tasks, and all the fundamental center highlights that almost every application needs. C# can accordingly be utilized to assemble business applications, games, web applications, and applications that sudden spike in demand for tablets or cell phones. The .NET Framework accomplishes it's work by method of the Common Language Runtime and the Framework Class Library.
The CLR manages your application
Memory the executives
- Language freedom
- Working framework and equipment freedom
System class library
A library of usefulness to assemble applications
Working With C#

Visual Studio will set up some standard code for us which resembles this.
Solution Explorer In Visual Studio
When the new venture is made, we likewise observe the arrangement traveler. The Solution Explorer window arranges the entirety of the ventures code and just as different tasks. In the screen capture underneath, we see that WelcomeToCSharp is featured which speaks to the present task. Within that venture we have three organizers.
Those are bin
, obj
and Properties. There is likewise an App.config record, a Program.cs document, and a Visual C# Project File named WelcomeToCSharp.csproj.
Namespaces In C#
Notice at the highest point of the Program.cs document that there are a few lines of code we probably won't be acquainted with.
For the present we can erase those namespaces with the goal that our Program.cs resembles this. .
Now, we are utilizing our own namespace, which is WelcomeToCSharp. So the class of Program is truly something like WelcomeToCSharp.Program. How about we work something out to the support at that point!
Building And Running Your C# Application
How about we put this program in to activity. To see the aftereffect of our code up until this point, we can tap on Debug, and afterward Start Without Debugging.
Quite Sweet! We got our first C# reassure application to run. Visual Studio consequently aggregated the source code and propelled the program in another reassure window. Visual Studio consequently included the "Press any key to proceed . . ." discourse to cause the comfort window to leave. In the event that this wasn't given, you'd see an order window streak on the screen for a second and that is about it. The program can likewise be run from the order line by composing the name of the executable, WelcomeToCSharp.exe.
C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharp.exeWelcome To C#!
Passing A Parameter To Our Program
So as to alter our first C# Program somewhat more, how about we include support for going in a Parameter. Here is the way we can do that.

Now, we can run the program again from the order line and go in a string parameter like so. Note that while determining the name of the program, you can exclude the .exe from the finish of the document when running it.
C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharp TomWelcome To C#, Tom!
We can run it again and go in an alternate string parameter just to see it in real life.
C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharp FriendWelcome To C#, Friend!
Preventing Runtime Errors
We have our program tolerating a parameter with the goal that it shows a custom message. What occurs on the off chance that we don't pass that contention when running the program? Indeed, how about we see.
C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharpUnhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array.at WelcomeToCSharp.Program.Main(String[] args) in C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\Program.cs:line 9
OOPS!. We get a frightful mistake message, and the program crashes. We can adjust the program so that if a contention isn't given at runtime, we won't understand that Index was beyond the cluster blunder message. Here is the refreshed code.
Now,when we run the program it won't crash in the event that we don't give a contention. Beneath we run the program once with no contention, on the other hand with a contention. The program currently has rationale as a straightforward if/else articulation with the goal that it can carry on diversely relying upon what was passed to it.
C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharpWelcome To C#, Friend!C:\Users\user\source\repos\WelcomeToCSharp\WelcomeToCSharp\bin\Debug>WelcomeToCSharp PartnerWelcome To C#, Partner!
Using Console.ReadLine
Another methodology we could take to the program is to incite the client for data while the program is running. We can do this with the Console.ReadLine strategy.
Now when the program runs, we are incited to enter a few information. The program doesn't push ahead until we do as such.
1 Comments
Nice blog. Keep writing.
ReplyDelete