Download - C guide programming

Transcript

C# GuideDelegates::Delegates have the following properties: Delegates are like C++ function pointers but are type safe. Delegates allow methods to be passed as parameters. Delegates can be used to defne callback methods. Delegates can be chained together; for example multiple methods can be called on asingle event. !ethods do not have to match the delegate signature exactly. "or more information see Covariance and ContravarianceCovariance and Contravariance in Delegates #C$ %rogramming &uide'.((( )xample:::delegate void Delegate1();delegate void Delegate2();static void method(Delegate1 d, Delegate2 e, System.Delegate f){// Compile-time error. //Cosole.!rite"ie(d ## e); // $% at compile-time. &alse if the r'-time type of f// is ot the same as that of d.System.Cosole.!rite"ie(d ## f);(((( )xample:::Regions in C:::#pragma region lets you specify a block of code that you can expand or collapse when using the outlining feature of the *isual +tudio Code )ditor.#pragma region name#pragma endregion comment