I was just wondering what about Java can and can not be applied to C#.
I know they have a lot of similarities, but what are some of the key differences, and what are the "key similarities"?
Also, one question I definitely want answered is: "I learned how to compile C# using csc test.cs
, but, how is the main class chosen?".
Top comments (3)
Java and C# unfortunately have less and less common over the years. Nowadays they differ in almost everything. The only principles you can apply in C# you already know are not Java specific - like inheritance, polymorphism, inversion of control, interfaces, etc.
From my own experience writing applications in C# is far less code and more syntactic sugar than Java.
.Net framework has most of the stuff you need and if you need something more it's most of the time provided as NuGet packages by Microsoft while NuGet package management is part of the framework. No more messing with Maven, Nexus and 5 different Java packages for a simple requirement.
The best starting point would be. Net Core framework, which has CLI tool
dotnet
that allows you to bootstrap a C# project or solution in a second.By default C# program is searching for
void Main()
method and executes it first but this may differ for different project types (class library vs. console program vs. web application).It is advised you create new project using
dotnet new
command which createsproject_name.csproj
file which eases running it by usingdotnet run
command.If you already have built
.dll
file you can usedotnet path/to/the/file.dll any arguments
to run it.C#.... web application?
Yes, part of the .Net (Core) framework is an application server named Kestrel. The most simple C# web application looks like this:
Program.cs
Startup.cs
test2.csproj