---
- C# (C Sharp), Microsoft tarafından geliştirilmiş modern, nesne yönelimli bir programlama dilidir.
- .NET platformunda çalışır.
- Windows uygulamaları, oyun geliştirme (Unity 🎮), web uygulamaları (ASP.NET) ve daha fazlasında kullanılır.
- Güçlü tip güvenliği ve zengin kütüphaneleri vardır.
using System;
class Program {
static void Main() {
Console.WriteLine("Merhaba C# 🚀");
}
}
📌 Açıklama:
using System;
→ kütüphaneyi ekler.Console.WriteLine()
→ ekrana yazı yazar.Main()
→ programın giriş noktasıdır.
int sayi = 10; // Tam sayı
double pi = 3.14; // Ondalık sayı
char harf = 'A'; // Tek karakter
string isim = "Ebrar"; // Metin
bool dogruMu = true; // Mantıksal değer
int a = 5, b = 2;
Console.WriteLine(a + b); // Toplama
Console.WriteLine(a - b); // Çıkarma
Console.WriteLine(a * b); // Çarpma
Console.WriteLine(a / b); // Bölme
Console.WriteLine(a % b); // Mod
int yas = 18;
if (yas >= 18) {
Console.WriteLine("Reşitsiniz ✅");
} else {
Console.WriteLine("Reşit değilsiniz ❌");
}
int gun = 3;
switch (gun) {
case 1: Console.WriteLine("Pazartesi"); break;
case 2: Console.WriteLine("Salı"); break;
case 3: Console.WriteLine("Çarşamba"); break;
default: Console.WriteLine("Bilinmiyor"); break;
}
for (int i = 1; i <= 5; i++) {
Console.WriteLine(i);
}
int sayac = 0;
while (sayac < 3) {
Console.WriteLine("Sayaç: " + sayac);
sayac++;
}
using System;
class Program {
static int Kare(int x) {
return x * x;
}
static void Main() {
Console.WriteLine(Kare(5));
}
}
using System;
class Ogrenci {
public string Isim;
public int Yas;
public void Bilgi() {
Console.WriteLine("Ad: " + Isim + ", Yaş: " + Yas);
}
}
class Program {
static void Main() {
Ogrenci ogr = new Ogrenci();
ogr.Isim = "Ebrar";
ogr.Yas = 20;
ogr.Bilgi();
}
}
int[] sayilar = {1, 2, 3, 4, 5};
foreach (int s in sayilar) {
Console.WriteLine(s);
}
using System.Collections.Generic;
List<string> meyveler = new List<string>() { "Elma", "Armut", "Muz" };
foreach (string meyve in meyveler) {
Console.WriteLine(meyve);
}
✔️ Console.WriteLine
→ ekrana yazdırmak için
✔️ List<T>
→ esnek veri yapısı
✔️ Unity oyun motoru öğrenmek için C# bilmek şart 🎮
❌ Bellek yönetimi elle yapılmaz → Garbage Collector otomatik temizler.
- Kullanıcıdan isim al → “Merhaba, [isim]” yazdır.
- 1’den 100’e kadar olan sayıların toplamını bulan program yaz.
- Bir
Araba
sınıfı oluştur → markası ve modeli olsun, ekrana yazdır. - Bir liste oluştur (
int
) → en büyük elemanı bul.
C#, modern yazılım geliştirmede güçlü bir araçtır.
- C# (C Sharp) is a modern, object-oriented programming language developed by Microsoft.
- It runs on the .NET platform.
- It is used in Windows applications, game development (Unity 🎮), web applications (ASP.NET), and more.
- It has strong type safety and rich libraries.
using System;
class Program {
static void Main() {
Console.WriteLine("Hello C# 🚀");
}
}
📌 Description:
using System;
→ adds the library.Console.WriteLine()
→ writes text to the screen.Main()
→ is the entry point of the program.
int number = 10; // Integer
double pi = 3.14; // Decimal number
char letter = 'A'; // Single character
string name = "Ebrar"; // Text
bool true = true; // Boolean value
int a = 5, b = 2;
Console.WriteLine(a + b); // Addition
Console.WriteLine(a - b); // Subtraction
Console.WriteLine(a * b); // Multiplication
Console.WriteLine(a / b); // Division
Console.WriteLine(a % b); // Mode
int age = 18;
if (age >= 18) {
Console.WriteLine("You are a minor ✅");
} else {
Console.WriteLine("You are a minor ❌");
}
int day = 3;
switch (day) {
case 1: Console.WriteLine("Monday"); break;
case 2: Console.WriteLine("Tuesday"); break;
case 3: Console.WriteLine("Wednesday"); break;
default: Console.WriteLine("Unknown"); break;
}
for (int i = 1; i <= 5; i++) {
Console.WriteLine(i);
}
int counter = 0;
while (counter < 3) {
Console.WriteLine("Counter: " + counter);
counter++;
}
usingSystem;
class Program {
static int Square(int x) {
return x * x;
}
static void Main() {
Console.WriteLine(Square(5));
}
}
using System;
class Student {
public string Name;
public int Age;
public void Information() {
Console.WriteLine("Name: " + Name + ", Age: " + Age);
}
}
class Program {
static void Main() {
Student student = new Student();
student.Name = "Ebrar";
student.Age = 20;
student.Information();
}
}
int[] numbers = {1, 2, 3, 4, 5};
foreach (int s in numbers) {
Console.WriteLine(s);
}
using System.Collections.Generic;
List<string> fruits = new List<string>() { "Apple", "Pear", "Banana" };
foreach (string fruit in fruits) {
Console.WriteLine(fruit);
}
✔️ Console.WriteLine
→ for printing to the screen
✔️ List<T>
→ flexible data structure
✔️ C# knowledge is required to learn the Unity game engine 🎮
❌ Memory management is not done manually → Garbage Collector cleans automatically.
- Get the user's name → print "Hello, [name]".
- Write a program that finds the sum of numbers from 1 to 100.
- Create a 'Car' class → print the make and model.
- Create a list ('int') → find the largest element.
C# is a powerful tool in modern software development.
You can use it in Windows applications, Unity games, web services, and more.
In short: The seriousness of Java + the power of C++ + the support of Microsoft = C# 💚
Windows uygulamaları, Unity oyunları, web servisleri ve daha fazlasında kullanabilirsin.
Kısacası: Java’nın ciddiyeti + C++’ın gücü + Microsoft’un desteği = C# 💚