| C# Threading QA-31-40 | C# Question Answers-131 - 140 | |
C# (C-Sharp) Question Answers - 121-130 |
A delegate is a type-safe reference to a method. It encapsulates a method with a specific signature and allows an object to call different event handlers under different circumstances.
A delegate that has multiple handlers assigned. Each assigned method is invoked in order.
A class that cannot be instantiated directly and must be inherited. Abstract classes can contain methods that must be overridden.
HashTable
StringBuilder is more efficient for frequent string manipulations since String objects are immutable and create new memory instances on each change.
try { }
catch (System.Exception) { }
// or simply
catch { }
// : Single-line comment/* */ : Multi-line comment/// : XML documentation commentSystem.String is immutable; System.Text.StringBuilder is mutable and allows modifications without creating new instances.
Clone(): returns a new array (shallow copy).
CopyTo(): copies elements into an existing array (shallow copy).
Shallow copy: elements reference same objects; deep copy: creates new object instances.
| C# Threading QA-31-40 | C# Question Answers-131 - 140 | |