Evenementer
Mar 17, 11 PM - Mar 21, 11 PM
Maacht mat bei der Meetup-Serie, fir skaléierbar KI-Léisungen op Basis vu realistesche Benotzungsfäll mat aneren Entwéckler an Experten ze bauen.
Elo umellenDëse Browser gëtt net méi ënnerstëtzt.
Upgrat op Microsoft Edge fir vun de Virdeeler vun leschten Eegeschaften, Sécherheetsupdaten, an techneschem Support ze profitéieren.
C# programs consist of one or more files. Each file contains zero or more namespaces. A namespace contains types such as classes, structs, interfaces, enumerations, and delegates, or other namespaces. The following example is the skeleton of a C# program that contains all of these elements.
using System;
Console.WriteLine("Hello world!");
namespace YourNamespace
{
class YourClass
{
}
struct YourStruct
{
}
interface IYourInterface
{
}
delegate int YourDelegate();
enum YourEnum
{
}
namespace YourNestedNamespace
{
struct YourStruct
{
}
}
}
The preceding example uses top-level statements for the program's entry point. Only one file can have top-level statements. The program's entry point is the first line of program text in that file. In this case, it's the Console.WriteLine("Hello world!");
.
You can also create a static method named Main
as the program's entry point, as shown in the following example:
// A skeleton of a C# program
using System;
namespace YourNamespace
{
class YourClass
{
}
struct YourStruct
{
}
interface IYourInterface
{
}
delegate int YourDelegate();
enum YourEnum
{
}
namespace YourNestedNamespace
{
struct YourStruct
{
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello world!");
}
}
}
In that case the program will start in the first line of Main
method, which is Console.WriteLine("Hello world!");
You learn about these program elements in the types section of the fundamentals guide:
For more information, see Basic concepts in the C# Language Specification. The language specification is the definitive source for C# syntax and usage.
Feedback zu .NET
.NET ass en Open-Source-Projet. Wielt e Link, fir Feedback ze ginn:
Evenementer
Mar 17, 11 PM - Mar 21, 11 PM
Maacht mat bei der Meetup-Serie, fir skaléierbar KI-Léisungen op Basis vu realistesche Benotzungsfäll mat aneren Entwéckler an Experten ze bauen.
Elo umellenTraining
Modul
Write your first C# code - Training
Get started by writing code examples to learn the basics of the C# syntax.
Dokumentatioun
C# docs - get started, tutorials, reference.
Learn C# programming - for beginning developers, developers new to C#, and experienced C# / .NET developers
New to C#? Learn the basics of the language. Start with this overview.
Language strategy - A tour of C#
We will keep evolving C# to meet the changing needs of developers and remain a state-of-the-art programming language. We will innovate eagerly and broadly in collaboration with C# developers