OOP #19

toop

We learned about properties in C#. in the second part of the class we learned about interfaces in C#. we investigated objects using:  is, as, null  key-words

invsab

More topics covered:

    • static class and static ctor
    • properties access modifiers, backing field, abstraction
    • marker interface
    • interface inheritance
    • interface default access modifiers
    • is, as
    • null

Links:

 

OOP #18

toop

We learned about the Encapsulation in OOP which is implemented by the six access modifiers for data and methods (public, private, protected, internal, protected-internal, private-protected [requires c# 7.2]) and the three modifiers for class (public, internal, private), how to add-reference from one project to another, Getters/Setters, for-each loop

modifiers2

UML:

access

More topics covered:

    • What are modifiers?
    • How to install c# 7.2
    • How to compile to c# 7.2
    • Default access modifiers (class/data/functions)
    • ILDASM “private ansi” is actual internal for class
    • private class
    • Circular reference  between projects
    • Creating two projects and add reference > solution
    • Using Setters to filter wrong data (i.e. negative height)
    • Static data could be used as configuration
    • Avoid repetition of values by using a bool[ ] array

Links:

 

21 NOV 2019

toop

We learned about static-data, static-methods, const, read-only, class data fields initialization step

Constantvsreadonly

static

More topics covered:

    • How to access static/const
    • Access static using a derived class
    • Creating static methods – design considerations
    • Const is replaced during compilation
    • Using static/const fields to define an array size
    • .NET Object class static methods
    • Static method can only call another static method

Links:

 

OOP #16

toop

virtual

We learned about ctor overloading, method overloading, using this keyword to call from one ctor to another, using this keyword to refer to class data fields, calling specific base ctor by using base key word, class Object, virtual methods

More topics covered:

    • All classes inherit from Object class
    • Using this.[field-name] in ctor, for example:
      Person(int id) { this.id = id; }
    • : this , for example:
      Person(int id) { this.id = id; }
      Person(int id, string name) :
              this(id) { this.name = name }
    • : base , for example:
      Person(int id) { this.id = id; }
      Employee : Person
      Employee(int id, string name) :
             base (id) { this.name = name }
    • Creating our own custom virtual methods
    • +Override our own custom virtual methods
    • Virtual vs. abstract
    • Passing arguments to console application using Command Prompt
    • Adding readme.txt into GITHUB folder

Links:

 

OOP #15

toop

ildasm

We learned about Common Intermediate Language (CIL), IL Disassembler (ILDASM.exe), IL Assembler (ILASM.exe), Class Constructors, default Constructor

More topics covered:

  • Adding ILDASM to Visual Studio 2017 Tools menu
  • Investigating our .NET class code using ILDASM
  • ctor key-word
  • Creating few ctors in the same class
  • Debug/Release configuration
  • Bin/Debug + Bin/Release folders
  • Creating auto generated constructor in Visual Studio 2017
  • Command Prompt (CMD)
  • Running our Console Application using the  Command Prompt
  • Users: guest, user, administrator
  • Converting executable .net file  (.exe) to Intermediate Language (IL) using ildasm.exe
  • Modifying Intermediate Language (IL) code using notepad
  • Converting Intermediate Language (IL) back to executable .net file  (.exe) using ilasm.exe, and run it again

Links:

 

18 NOV 2019

toop

We learned about inheritance, abstract classes, abstract methods, calling base.ToString(), class inside another class, array of classes, class as parameter type of a method

More topics covered:

  • Creating nested new: derived class inside parent class
  • Creating method which accepts a parent base class (shape). this allows you to send any derived class (i.e. circle, rectangle)
  • Abstract class – usually adding “Base” postfix, i.e. ShapeBase
  • Creating array of classes, create new items of each class inside
  • Polymorphism

Links:

14 NOV 2019

toopWe learned about the Object Oriented Programming (OOP) concept. we learned about classes, objects, data, functionality, inheritance, abstract, new, ToString

More topics covered:

  • Creating new Class
  • override ToString()
  • [DebuggerDisplay]
  • Object Initializer

Links:

 

Winforms #12

shot.png

We developed together in class a File Explorer which could open images, open text files and color labels
We learned how to create MessaegBox which shows buttons –  and handle the option the user has selected in the message box

More topics covered:

  • Menu-Strip
  • Color-Dialog
  • Open-File-Dialog
  • Loading a file into a picture Bitmap
  • Loading text file into a list of strings (very advanced, not required in this module)

Links:

 

Winforms #11

simon

We developed together in class a Simon game – where the computer plays random colors and you have to repeat them (be careful: one wrong color and your out!)
We learned about the UI thread and creating a new worker thread
We learned about global scope of variables
We learned about Thread.Sleep
We learned how to create MessaegBox using: MessageBox.Show(…);
We learned about WinForm theory, and Mono project

More topics covered:

  • Using const, i.e. const int MAX = 4
  • Setting Colors using Color., i.e. Color.Red
  • Setting Text/Colors from the Form1.Designer.cs
  •  new Thread(() =>
    {
         // put your code here
    }).Start();
  • WinForm Framework theory – .NET versions, GDI, popularity, usage, …, read here: Winform PDF
  • Mono cross-platform, read more about it here: Mono Project
    mono

Links:

Winforms #10

We built a chat Application (like Whatsapp, is typing …)
We learned how to add ListBox and more events into our WinForm application.

More topics covered:

  • ListBox (Add item, get count, set focus)
  • KeyPress event: whenever the user clicked on keyboard inside TextBox
  • KeyDown: here we can detect ENTER key [KeyValue == 13]
  • Leave: whenever the user left the TextBox
  • How to print the current Date-Time
  • How to convert Integer into String , i.e. x.ToString()

Links: