Tekil Mesaj gösterimi
Alt 30.Ağustos.2022   #1
Çevrimdışı
aSeNa Konuyu Baslatan
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!");
}
}
}
  Alıntı ile Cevapla

IRCForumda.Net Reklamlar
sohbet isami sohbet