🎧 New: AI-Generated Podcasts Turn your study notes into engaging audio conversations. Learn more

C# Programming Fundamentals
9 Questions
0 Views

C# Programming Fundamentals

Created by
@IntegralJupiter

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

الiclassفي لغة برمجة سي شارب必须 أن يكون موجوداً في كل كلاس.

False

يمكن العثور على استثناءات فحصية من قبل المترجم.

True

كلمة Async هي التي توقف تنفيذ الطريقة بشكل كلي حتى يتم إكمال العملية غير المتزامنة.

False

المعربات اللامبة (Lambda Expressions) هي دائمات معروفة مسبقاً.

<p>False</p> Signup and view all the answers

Events في لغة برمجة سي شارب تستخدم فقط لاتصالات بين كائنات في نفس الفئة.

<p>False</p> Signup and view all the answers

في لغة برمجة سي شارب،يمكن أن نخلق استثناءات مخصصة من خلال наследة من فئة Exception.

<p>True</p> Signup and view all the answers

Khốiة Try في لغة برمجة سي شارب تستخدم فقط لتشغيل التعليمات البرمجية التي لا ت.Throw استثناءات.

<p>False</p> Signup and view all the answers

في لغة برمجة سي شارب،يمكن أن نخلق معربات لامبة من أجل تشغيل وظائف مختلفة.

<p>True</p> Signup and view all the answers

في لغة برمجة سي شارب،Events هي طريقة لاتصال كائنات مع بعضها البعض.

<p>True</p> Signup and view all the answers

Study Notes

Object-oriented Programming

  • C# is an object-oriented programming language that supports:
    • Encapsulation: Hiding implementation details through access modifiers (public, private, protected)
    • Inheritance: Creating a new class based on an existing class
    • Polymorphism: Method overriding and method overloading
    • Abstraction: Defining abstract classes and interfaces

Exception Handling

  • C# provides a try-catch-finally block for exception handling:
    • Try: Code that may throw an exception
    • Catch: Handles the exception and provides error handling
    • Finally: Code that is executed regardless of an exception
  • Types of exceptions:
    • Checked exceptions: Caught by the compiler
    • Unchecked exceptions: Not caught by the compiler, but can be caught at runtime
  • Custom exceptions can be created by inheriting from the Exception class

Async and Await

  • Async and Await are used for asynchronous programming:
    • Async: Marks a method as asynchronous
    • Await: Suspends the execution of the enclosing async method until the asynchronous operation completes
  • Benefits:
    • Improved responsiveness and performance
    • Reduced thread blocking and thread pool usage *Async and Await are used with Tasks and Task to represent asynchronous operations

Lambda Expressions

  • Lambda expressions are anonymous functions that can be used:
    • As event handlers
    • As LINQ query operators
    • As delegates
  • Syntax: (input parameters) =&gt; { expression }
  • Lambda expressions can be converted to delegates or expression trees
  • Benefits:
    • Concise code
    • Improved readability

Event Handling

  • Events in C# are used for communication between objects:
    • Publisher: Raises an event
    • Subscriber: Handles the event
  • Event handlers are methods that are executed when an event is raised
  • Events are declared using the event keyword
  • Delegates are used to reference the event handler method
  • Benefits:
    • Decoupling of objects
    • Improved flexibility and scalability

لغات البرمجة OBJECT-ORIENTED

  • لغة سي شارب # Supports:
    • التغليف: إخفاء تفاصيل التنفيذ من خلال محددات الوصول (عام، خاص، محمي)
    • الإرث: إنشاء فئة جديدة مستندة إلى فئة موجودة
    • الت πολυمورفيزم: переопределение الطرق وكتابة طريقة متعددة
    • التجريد: تعريف الفئات والواجهات المجردة

معالجة الأخطاء

  • سي شارب # يوفر μπλοك Try-Catch-Finally لمعالجة الأخطاء: +ลอง: كود قد يthrow استثناء
    • كاتش: يعالج الاستثناء ويقدم معالجة الخطأ
    • فينالي: كود يتم تنفيذه بغض النظر عن الاستثناء
  • أنواع الأخطاء:
    • الأخطاء المدققة: يمكن اكتشافها من قبل المترجم
    • الأخطاء غير المدققة: لا يمكن اكتشافها من قبل المترجم، ولكن يمكن اكتشافها في समय التشغيل
  • يمكن创蟆 الاستثناءات المخصصة من خلال-warث من فئة الاستثناء

Async و Await

  • Async و Await مستخدمون لبرمجة متزامنة:
    • Async: يصنف الطريقة كمتزامنة
    • Await: يوقف تنفيذ الطريقة المتزامنة حتى完成 العملية المتزامنة
  • الفوائد:
    • تحسين الاستجابة والأداء
    • نقصان حظر الخيط واستخدام مجمع الخيوط
  • Async و Await مستخدمون مع المهام و taskId لتمثيل العمليات المتزامنة

تعبيرات لامدا

  • تعبيرات لامدا هي دوال مجهولة يمكن استخدامها:
    • كدوال معالجة الاحداث
    • كأوبراتور كويري لينق
    • كمندوبين
  • الصيغة: (مُدخلات) =&gt; { التعبير }
  • يمكن تحويل تعبيرات لامدا إلى دوال أو أشجار التعبير
  • الفوائد:
    • رمز موجز
    • تحسين القراءة

معالجة الاحداث

  • الأحداث في سي شارب # مستخدمة للتواصل بين الكائنات:
    • الناشر: يرفع الحدث
    • المشترك: يعالج الحدث
  • دوال معالجة الاحداث هي دوال يتم تنفيذها عندما يرفع الحدث
  • الأحداث يتم إعلانها باستخدام كلمة محدد الحدث
  • دوال المندوبين مستخدمة لمرجعية دوال معالجة الاحداث
  • الفوائد:
    • فك الارتباط بين الكائنات
    • تحسين المرونة والاستفادة

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

إختبار معرفة أساسيات لغة برمجة السي شارب، مثل البرمجة كائنية التوجه و zpracování للأخطاء

Use Quizgecko on...
Browser
Browser