Tekil Mesaj gösterimi
Alt 19 Temmuz 2021, 18:50   #1
ExCaLuBuR
ExCaLuBuR - ait Kullanıcı Resmi (Avatar)

Standart 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, numaralar ve temsilciler veya diğer ad alanları gibi türleri içerir. Aşağıdaki örnek, bu öğelerin hepsini içeren bir C# programının iskeletidir.

PHP- Kodu

// 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 örnek, programın giriş noktası için üst düzey deyimleri kullanır. Bu özellik C# 9'da eklendi. C# 9'dan önce, giriş noktası aşağıdaki örnekte gösterildiği gibi Main adlı statik bir yöntemdi:

PHP- Kodu

// 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!");
        }
    }


Kaynak : [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...]
________________

06/02/2023 İnsan olan herkesin kalbi acıdı.

Konu ExCaLuBuR tarafından (11 Mart 2023 Saat 00:46 ) değiştirilmiştir..