IRCDefteri - En İyi IRCForum Sayfasi

IRCDefteri - En İyi IRCForum Sayfasi (https://www.ircforumda.net/)
-   C# (https://www.ircforumda.net/c/)
-   -   C# Program bölümleri (https://www.ircforumda.net/c/33002-c-program-bolumleri.html)

aSeNa 30.Ağustos.2022 09:47

C# Program bölümleri
 
C# Programının Genel Yapısı
C# programları bir veya daha fazla dosyadan oluşur. Her dosya sıfır veya daha fazla ad alanı içerir. Ad alanı sınıflar, yapılar, arabirimler, numaralandırmalar ve temsilciler veya diğer ad alanları gibi türleri içerir. Aşağıdaki örnek, bu öğelerin tümünü içeren bir C# programının çatısıdır.

// A skeleton of a C# program
using System;

// Your program starts here:
Console.WriteLine("Hello world!");

namespace YourNamespace
{
class YourClass
{
}

struct YourStruct
{
}

interface IYourInterface
{
}

delegate int YourDelegate();

enum YourEnum
{
}

namespace YourNestedNamespace
{
struct YourStruct
{
}
}
}


Yukarıdaki örnekte, programın giriş noktası için*üst düzey deyimler*kullanılır. Bu özellik C# 9'a eklendi. C# 9'den önce, aşağıdaki örnekte gösterildiği gibi giriş noktası adlı*Mainstatik bir yöntemdi:


// 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)
{
//Your program starts here...
Console.WriteLine("Hello world!");
}
}
}


Forum Saati: 16:15. Zaman dilimi GMT +4 olarak ayarlanmıştır.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.