Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
csharp [2020/04/13 19:20] paul created |
csharp [2020/04/17 03:06] (current) paul [var] |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== C# ====== | ====== C# ====== | ||
+ | C# is a general-purpose, | ||
+ | |||
+ | C# was designed by Anders Hejlsberg, and its development team is currently led by Mads Torgersen. | ||
+ | |||
+ | ==== var ==== | ||
+ | |||
+ | C# is a strongly typed language which means, you must declare a variable type before you can use it. But what if you don’t know the type of the variable? C# lets you declare local variables without giving them explicit types. It is possible with the help of the “var” type variable. | ||
+ | |||
+ | The “var” keyword is used to declare a var type variable. The var type variable can be used to store a simple .NET data type, a complex type, an anonymous type, or a user-defined type. | ||
+ | |||
+ | ==== Interfaces ==== | ||
+ | |||
+ | A C# interface is a collection of things that we promise to put in our class if we decide to use that interface. | ||
+ | |||
+ | Let's say we have a cat. We can make an interface that a cat can implement, but also dogs, and other animals. | ||
+ | |||
+ | For example we can have an interface called IWalk, ISleep or IEat. |