Wednesday, April 26, 2023

Complete C# Master Class note 2

 1.

C# base virtual and child override behavior is same with Java. But C# can also have the new key word.

The new keyword is used to hide a method, property, indexer, or event of base class into derived class.

sealed doesn't allow override.

2.

Developers use the .NET Framework to create Windows desktop and server-based applications. This includes ASP.NET web applications. On the other hand, .NET Core is used to create server applications that run on Windows, Linux and Mac. It does not currently support creating desktop applications with a user interface.

3.

internal access modifier only allows same assemly/namespace/project access.

4.

struct is similar to class but it's value type. Struct cannot support inheritance.

CONSIDER defining a struct instead of a class if instances of the type are small and commonly short-lived or are commonly embedded in other objects.

5.

num8 = num6 ?? 8.53;

public delegate bool FilterDelegate(Person person);

            FilterDelegate filter = delegate (Person person)

            {

                return person.Age > 18;

            };

Display("Show adults",people,p=>p.Age>18);   //Lambda

No comments:

Post a Comment