2025-03-18 This article was created with the assistance of ChatGPT Low-Level CPU Instructions: The Interlocked class uses atomic CPU instructions that are executed as indivisible units. These CPU instructions, like Compare-and-Swap (CAS) or Test-and-Set, ensure that the operation is performed entirely or not at all, with no interference from other threads. These instructions are implementedContinue reading “How Interlocked Ensures Atomicity”
Tag Archives: C#
Understanding Stack Frames in .NET
2025-03-18 This article was created with the assistance of ChatGPT What is a Stack Frame? A stack frame is a data structure created on the call stack whenever a method is invoked. It holds all the necessary information for a method to execute and return correctly. Each thread in a .NET application has its ownContinue reading “Understanding Stack Frames in .NET”
Solved: The destination thread no longer exists exception – C#
2016-11-08 You will get System.ComponentModel.InvalidAsynchronousStateException (The destination thread no longer exists.) if a UI component gets disposed or the UI thread EXITs while a different thread is in the middle of invoking a change on the same UI component. This usually happens when a user closes a window (form) that has been updated by aContinue reading “Solved: The destination thread no longer exists exception – C#”
C# Reflection Code to Search Objects for Fields Properties and Methods and Get Values
2016-07-06 Code below will search for a given named property, field, or method inside a given object. It will search in below order: Properties Fields Methods It will continue to search until it finds a match that holds or returns (for methods) a non-null value. E.g. If you searched for “Name” and if there is a propertyContinue reading “C# Reflection Code to Search Objects for Fields Properties and Methods and Get Values”
C# extension method to check if a string matches any string in given list
2016-06-16
ILT – How to Programmatically Get Version Information of a Visual Studio Solution
03-10-2012 How to get major, minor, build and revision version figures for a visual studio solution (using c#)? Menol ILT
Is Order Of OleDbCommand.Parameters Important
01-08-2012 The order of the parameters collection of an OleDbCommand must match the order to which those parameters appear in the SQL statement. Otherwise the .net framework will try to fill the parameters in your SQL statement according to the order of parameters in the OleDbCommand.Parameters collection. This can cause an Data type mismatch inContinue reading “Is Order Of OleDbCommand.Parameters Important”
Use of Nullable ?? Operator in C#
20-07-2012 Use ?? operator to tell the compiler how to assign a null-able variable to a non-null-able variable. Menol ILT
How To Exit or End a C Sharp (C#) Application
12-06-2012 To exit a c# program simply use following command: Environment.Exit(int Status); Status is the integer you return to tell the environment how your program concludes. If it executed according as expected or if it encountered any errors. The commonly used success value is zero 0 This will mean that your program termintaes without anyContinue reading “How To Exit or End a C Sharp (C#) Application”
How to Implement a Background Worker Thread that Supports Cancellation (How to Stop A Background Thread)
30-05-2012 The background worker in .net provides a method CancelAsync() to cancel a background worker. However, calling this method will not stop a worker thread there has to be several things you have to implement before. 1. First of all, for a BackgroundWorker to respond to a CancelAsync, you must set the WorkerSupportsCancellation flag. 2.Continue reading “How to Implement a Background Worker Thread that Supports Cancellation (How to Stop A Background Thread)”