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”

Using Regular Expressions With Find And Replace In .Net IDE

06-06-2012 Use any regular expression to make your match. Then use {} pairs to define blocks of the search string you want to use in the Replaced string. Example: following find and replace strings will replace all occurrences ” report(number) ” to  ” // report – number ” in the following sample code. Sample CodeContinue reading “Using Regular Expressions With Find And Replace In .Net IDE”

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)”

ASP.NET – AutoPostBack : What is AutoPostBack and How AutoPostBack Works

2008-12-26 Today I was experimenting on a grid view where I was trying to select multiple rows of the grid view using a check box column. I wrote some code in the CheckedChanged of checkbox but then I found that the code was not executed when the state of the checkbox is changed. So IContinue reading “ASP.NET – AutoPostBack : What is AutoPostBack and How AutoPostBack Works”