اكواد جاهزة بلغة سي شارب مجموعة من أكواد Cلغة السي شارب متنوعة:
csharpCopy code // ==================================== // 1. الأساسيات والمتغيرات والأنواع // ==================================== using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Threading.Tasks; using System.Text.Json; namespace CSharpComprehensiveExamples { // مثال على الأنواع المختلفة والمتغيرات class BasicTypes { public static void DemonstrateTypes() { // أنواع البيانات الأساسية int number = 42; double price = 19.99; char grade = ‘A’; bool isActive = true; string name = “محمد”;
// كلاس أساسي public abstract class Vehicle { public string Brand { get; set; } public string Model { get; set; } public int Year { get; protected set; }
protected Vehicle(string brand, string model, int year) { Brand = brand; Model = model; Year = year; }
public virtual void Start() { Console.WriteLine($”تشغيل {Brand} {Model}“); }
public abstract void DisplayInfo(); }
// كلاس مشتق public class Car : Vehicle { public int NumberOfDoors { get; set; } public string FuelType { get; set; }
public Car(string brand, string model, int year, int doors, string fuel) : base(brand, model, year) { NumberOfDoors = doors; FuelType = fuel; }
public override void Start() { Console.WriteLine($”تشغيل السيارة {Brand} {Model} بالمفتاح”); }
public class Category { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public List Products { get; set; } = new List(); }
public class ProductNotFoundException : Exception { public int ProductId { get; }
public ProductNotFoundException(int productId) : base($”المنتج برقم {productId} غير موجود”) { ProductId = productId; }
public ProductNotFoundException(int productId, Exception innerException) : base($”المنتج برقم {productId} غير موجود”, innerException) { ProductId = productId; } }
public class ValidationException : Exception { public Dictionary Errors { get; }
public ValidationException(Dictionary errors) : base(“فشل في التحقق من صحة البيانات”) { Errors = errors; } }
// ==================================== // 6. LINQ والعمليات على المجموعات // ====================================
public class ProductService { private readonly List _products = new List();
public void LinqExamples() { // إضافة بيانات تجريبية _products.AddRange(new[] { new Product(“لاب توب”, 3500) { Category = new Category { Name = “الكترونيات” } }, new Product(“هاتف ذكي”, 1200) { Category = new Category { Name = “الكترونيات” } }, new Product(“كتاب برمجة”, 85) { Category = new Category { Name = “كتب” } }, new Product(“قميص”, 120) { Category = new Category { Name = “ملابس” } } });
// البحث والتصفية var expensiveProducts = _products .Where(p => p.Price > 1000) .OrderByDescending(p => p.Price) .ToList();
// التجميع var productsByCategory = _products .GroupBy(p => p.Category.Name) .ToDictionary(g => g.Key, g => g.ToList());
7 منصات تعطيك اكواد جاهزة بلغة سي شارب: 1. Microsoft .NET Documentation https://dotnet.microsoft.com/en-us/learn/csharp
المصدر الرسمي من Microsoft مع دروس مجانية ومقاطع فيديو 2. CCorner https://www.c-sharpcorner.com
من أفضل المواقع المتخصصة في Cمع مقالات وأمثلة عملية 3. GitHub – .NET Samples https://github.com/dotnet/samples
مجموعة ضخمة من أمثلة الكود الرسمية من Microsoft 4. Stack Overflow https://stackoverflow.com/questions/tagged/c%23
الموقع الأشهر لحلول البرمجة مع آلاف الأمثلة العملية 5. W3Schools C# https://www.w3schools.com/cs/index.php
دروس مجانية شاملة مع أمثلة تفاعلية 6. GeeksforGeeks https://www.geeksforgeeks.org/c-sharp-tutorial/
منصة تعليمية شاملة مع أمثلة وشروحات متقدمة 7. Codecademy [https://www.codecademy.com/learn/learn-c-sharp
اكواد جاهزة بلغة سي شارب مجموعة من أكواد Cلغة السي شارب متنوعة:
csharpCopy code // ==================================== // 1. الأساسيات والمتغيرات والأنواع // ==================================== using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Threading.Tasks; using System.Text.Json; namespace CSharpComprehensiveExamples { // مثال على الأنواع المختلفة والمتغيرات class BasicTypes { public static void DemonstrateTypes() { // أنواع البيانات الأساسية int number = 42; double price = 19.99; char grade = ‘A’; bool isActive = true; string name = “محمد”;
// كلاس أساسي public abstract class Vehicle { public string Brand { get; set; } public string Model { get; set; } public int Year { get; protected set; }
protected Vehicle(string brand, string model, int year) { Brand = brand; Model = model; Year = year; }
public virtual void Start() { Console.WriteLine($”تشغيل {Brand} {Model}“); }
public abstract void DisplayInfo(); }
// كلاس مشتق public class Car : Vehicle { public int NumberOfDoors { get; set; } public string FuelType { get; set; }
public Car(string brand, string model, int year, int doors, string fuel) : base(brand, model, year) { NumberOfDoors = doors; FuelType = fuel; }
public override void Start() { Console.WriteLine($”تشغيل السيارة {Brand} {Model} بالمفتاح”); }
public class Category { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public List Products { get; set; } = new List(); }
public class ProductNotFoundException : Exception { public int ProductId { get; }
public ProductNotFoundException(int productId) : base($”المنتج برقم {productId} غير موجود”) { ProductId = productId; }
public ProductNotFoundException(int productId, Exception innerException) : base($”المنتج برقم {productId} غير موجود”, innerException) { ProductId = productId; } }
public class ValidationException : Exception { public Dictionary Errors { get; }
public ValidationException(Dictionary errors) : base(“فشل في التحقق من صحة البيانات”) { Errors = errors; } }
// ==================================== // 6. LINQ والعمليات على المجموعات // ====================================
public class ProductService { private readonly List _products = new List();
public void LinqExamples() { // إضافة بيانات تجريبية _products.AddRange(new[] { new Product(“لاب توب”, 3500) { Category = new Category { Name = “الكترونيات” } }, new Product(“هاتف ذكي”, 1200) { Category = new Category { Name = “الكترونيات” } }, new Product(“كتاب برمجة”, 85) { Category = new Category { Name = “كتب” } }, new Product(“قميص”, 120) { Category = new Category { Name = “ملابس” } } });
// البحث والتصفية var expensiveProducts = _products .Where(p => p.Price > 1000) .OrderByDescending(p => p.Price) .ToList();
// التجميع var productsByCategory = _products .GroupBy(p => p.Category.Name) .ToDictionary(g => g.Key, g => g.ToList());
7 منصات تعطيك اكواد جاهزة بلغة سي شارب: 1. Microsoft .NET Documentation https://dotnet.microsoft.com/en-us/learn/csharp
المصدر الرسمي من Microsoft مع دروس مجانية ومقاطع فيديو 2. CCorner https://www.c-sharpcorner.com
من أفضل المواقع المتخصصة في Cمع مقالات وأمثلة عملية 3. GitHub – .NET Samples https://github.com/dotnet/samples
مجموعة ضخمة من أمثلة الكود الرسمية من Microsoft 4. Stack Overflow https://stackoverflow.com/questions/tagged/c%23
الموقع الأشهر لحلول البرمجة مع آلاف الأمثلة العملية 5. W3Schools C# https://www.w3schools.com/cs/index.php
دروس مجانية شاملة مع أمثلة تفاعلية 6. GeeksforGeeks https://www.geeksforgeeks.org/c-sharp-tutorial/
منصة تعليمية شاملة مع أمثلة وشروحات متقدمة 7. Codecademy [https://www.codecademy.com/learn/learn-c-sharp
اكواد جاهزة بلغة سي شارب مجموعة من أكواد Cلغة السي شارب متنوعة:
csharpCopy code // ==================================== // 1. الأساسيات والمتغيرات والأنواع // ==================================== using System; using System.Collections.Generic; using System.Linq; using System.IO; using System.Threading.Tasks; using System.Text.Json; namespace CSharpComprehensiveExamples { // مثال على الأنواع المختلفة والمتغيرات class BasicTypes { public static void DemonstrateTypes() { // أنواع البيانات الأساسية int number = 42; double price = 19.99; char grade = ‘A’; bool isActive = true; string name = “محمد”;
// كلاس أساسي public abstract class Vehicle { public string Brand { get; set; } public string Model { get; set; } public int Year { get; protected set; }
protected Vehicle(string brand, string model, int year) { Brand = brand; Model = model; Year = year; }
public virtual void Start() { Console.WriteLine($”تشغيل {Brand} {Model}“); }
public abstract void DisplayInfo(); }
// كلاس مشتق public class Car : Vehicle { public int NumberOfDoors { get; set; } public string FuelType { get; set; }
public Car(string brand, string model, int year, int doors, string fuel) : base(brand, model, year) { NumberOfDoors = doors; FuelType = fuel; }
public override void Start() { Console.WriteLine($”تشغيل السيارة {Brand} {Model} بالمفتاح”); }
public class Category { public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public List Products { get; set; } = new List(); }
public class ProductNotFoundException : Exception { public int ProductId { get; }
public ProductNotFoundException(int productId) : base($”المنتج برقم {productId} غير موجود”) { ProductId = productId; }
public ProductNotFoundException(int productId, Exception innerException) : base($”المنتج برقم {productId} غير موجود”, innerException) { ProductId = productId; } }
public class ValidationException : Exception { public Dictionary Errors { get; }
public ValidationException(Dictionary errors) : base(“فشل في التحقق من صحة البيانات”) { Errors = errors; } }
// ==================================== // 6. LINQ والعمليات على المجموعات // ====================================
public class ProductService { private readonly List _products = new List();
public void LinqExamples() { // إضافة بيانات تجريبية _products.AddRange(new[] { new Product(“لاب توب”, 3500) { Category = new Category { Name = “الكترونيات” } }, new Product(“هاتف ذكي”, 1200) { Category = new Category { Name = “الكترونيات” } }, new Product(“كتاب برمجة”, 85) { Category = new Category { Name = “كتب” } }, new Product(“قميص”, 120) { Category = new Category { Name = “ملابس” } } });
// البحث والتصفية var expensiveProducts = _products .Where(p => p.Price > 1000) .OrderByDescending(p => p.Price) .ToList();
// التجميع var productsByCategory = _products .GroupBy(p => p.Category.Name) .ToDictionary(g => g.Key, g => g.ToList());
التعليقات