freature of c#
Assembly Versioning
Properties and Events
Delegates and Events Management
Indexers
Conditional Compilation
Simple Multithreading
LINQ and Lambda Expressions
namespace
There is no package, but nested namespace instead.
namespace outer { namespace inner { class Demo { // some code here } } }
value type
to get exact size of a type of variable, you can use sizeof method.
reference type
object type
the object type can be assigned values of any other types,
value type
reference type
or user-defined type
object obj;
obj = 100; // this is boxing
dynamic type
you can store any type of value in the dynamic data type variable.
type checking takes place at run-time.
dynamic <variable_name> = value;
dynamic d = 20;
the difference between dynamic type and object type is the time when type checking takes place.
former's type type checking takes place at run-time.
later's type type checking takes place at compile time.
string
The string type is an alias for the System.String class.
It is derived from object type.
There are two forms:
quoted
@quoted
pointer type
pointer in c# have the same capabilities as the pointers in c or c++.
we will discuss pointer types as unsafe codes.
lvalue: An expression that is an lvalue may appear as either the left-hand or right-hand side of an assignment.
rvalue: An expression that is an rvalue may appear on the right- but not left-hand side of an assignment.
array
double[] balance = new double[10]; for (int i = 0; i < 10; i++) { balance[i] = i; } foreach (double d in balance) { Console.WriteLine(d + " "); }
structures in c#
struct Books { public string title; public string author; public string subject; public int book_id; };
class versus struct
*classes are reference types and structs are value types
structures do not support inheritance
structures cannot have default constructor
c# has preprocessor directives like in c or c++.
exception handling
try
catch
finally
throw
以上内容均来自 https://www.tutorialspoint.com/csharp/