- You might instantiate a generic class like a normal array:
List<T> mylist = new List<T>() { t1, t2, t3, ..., tn};
- LINQ - Language Integrated Query
- Queries for different DBs, XML, Generics
- Properties
- These are easy written accessors
- Futhermore an easy possiblity to convert information
- e.g. we store seconds in our time class
- you might write a property which allows you to simulate an other variable, like hours
which still relays on the seconds. public string Name
{
get { return ...; }
set { ... = value;}
}- Only functions noted with the keyword
virtual
might be overwritten. - Override is a keyword, not an annotation
- Javas
super
is C#sbase
- You must to append an
f
to yourfloat
float f = 3.141f
- There is a special keyword var
- var is a type which is determined at compile-time. So it can't change on run-time!
var v = (new List<int>() {1,2,3})[0];
- v has the type int now
- You might use
var
inforeach
foreach (Type t in Collection)
is javasfor (T t : Collection)
- All types are objects!
- There are two subtypes:
- Valuetypes
- Referencetypes
- There is not multiple inheritance.
- You implement interfaces and super classes in the same way:
class sub : super
{
// ...
}class implementation : interface
{
// ...
}- There a different types of lambdas:
Action<T1, ..., Tn>(...)
which maps on voidFunc<T1, ..., Tn, Tresult>(...)
which maps on given typeTresult
- Futhermore there are two keywords for easy threading:
await
async
Mittwoch, 7. Oktober 2015
From Java to C# - A few notes
Abonnieren
Kommentare zum Post (Atom)
Keine Kommentare:
Kommentar veröffentlichen