| C# Question Answers-91 - 100 | C# Question Answers-111 - 120 | |
C# (C-Sharp) Question Answers - 101-110 |
Strong typing: Type of variables checked at compile time. Prevents mixing operations between mismatched types. Strong-typed language: variables known at compile time, strict type enforcement, compile-time errors for violations.
Weak typing: Type checking delayed to runtime. Types can be mixed without explicit conversion. Preferred: depends on context. For scripts, weak typing is easier; for large programs, strong typing reduces errors.
System.Object is the base class in C#.
Thread is the part of Process.
One process may have many Threads.
Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
A thread is the entity within a process that can be scheduled for execution. Threads can also have their own security context, which can be used for impersonating clients.
Value types: Both compare values.
Reference types: == compares references; Equals() compares content/value.
Exe has an entry point whereas DLL does not have an entry point.
Both are executable code.
Exe is an executable and independent program/process to run which has its own reserved memory space, whereas DLL (Dynamic Link Library) is neither executable nor independent—it is used by other DLLs or programs.
The finalizer method is called when your object is garbage collected, and you have no guarantee when this will happen.
Although it can be forced to execute, doing so impacts performance. This method belongs to the Object class and is implemented using a destructor.
The Dispose method is meant to be called by the code that created your class so that you can clean up and release any resources you have acquired—
such as unmanaged data, database connections, or file handles—immediately after the object is no longer needed.
This method belongs to the IDisposable interface and is implemented by defining the Dispose() method.
By using the using statement, we can handle the Dispose method internally.
When an object is used within a using block, its Dispose method is called automatically at the end of the block.
typeof() gives compile-time type. GetType() gives runtime type.
catch(Exception e){throw e;} and catch(Exception e){throw;}
throw; rethrows exception keeping stack trace.
throw e; creates new exception, resets stack trace.
JIT (Just-In-Time Compiler) compiles methods at runtime as they are needed. It converts Intermediate Language (IL) code into native machine code during execution.
NGEN (Native Image Generator) compiles assemblies ahead-of-time during installation, producing native images that are stored in the native image cache.
| C# Question Answers-91 - 100 | C# Question Answers-111 - 120 | |