.NET

@aspnet

How to avoid Thread.Sleep in your production code in .NET

Avoiding Thread.Sleep in production code in .NET using C#
0
I am pretty sure any of us used Thread.Sleep method to pause the current thread execution. Mostly this is used to simulate long running process during the test or debug. While this is fine to use for testing, if your intention is to actually schedule thread execution this is probably wrong way of doing it, simply because Thread.Sleep does not actually take as many milliseconds as you pass to the method as a parameter...read more

Reduce traffic by serializing JSON with different alias with Json.NET and C#

Reducing speed and increasing performance by reducing traffic with JSON size
0
One of the reasons JSON is used rather than XML is it's simplicity in notation. However XML is claimed to be more human readable than JSON and JSON is easier to parse for machines, so basically we switched from XML in favor to machine processing. If you take a C# class and serialize it to JSON string you still find it quite readable since we kept all nice property names in the JSON output...read more

log4net logger for Microsoft Azure Log Analytics

Logging to Azure Log Analytics using log4net
 
 
0
Recently I wrote an article on how to Send data to Azure Log Analytics from C# code which is demonstrating pushing data from your code to Microsoft Azure Log Analytics and simple quering the data from the Log Analytics. Azure Log Analytics are extremely helpful for storing application logs because they provide transformation of the raw data into queriable columns, you can easily query your logs stored in Log Analytics and export to Excel format if you need to share the data or you just want to make some offline data analysis...read more

Export DataSet and DataTable to Excel with C#

Saving DataSet or DataTable instace to an Excel spreadsheet with C#
0
Some time ago I wrote an article on how to export data to Excel from C# code. Essentially it exports data to file which can be opened in Excel but it does not produce the actual Microsoft Office Excel document. I recently wrote an article on Working with Excel files in .NET without using COM in C#, so I decided to use this approach to create extension methods for DataTable and DataSet classes...read more

Export DataTable to HTML in C#

Generate HTML table from DataTable instance in C#
0
When I searched for exporting s to HTML table in C# I found a lot of articles and code snippets which are basically doing string concatenation or String.Format on the hard-coded HTML String to generate HTML string of the table. To me this approach is a bit like a workaround and I was never a fan of hard-coding values. In addition, code with a lot of hard-coded value end up as hardly maintainable code...read more

Simplest way to store lists and dictionaries in config files

Fast and simple way of storing and using lists and dictionaries in config files
0
Configuration files are a useful place too keep any related configuration settings. It provides easy to use configuration fetching which you can invoke from any part of the application. However it does not support many stuff out of the box, but on the other hand it is pretty flexible and expendable. One of the things that are not there built in is support for lists. ...read more

Multiple file upload with ASP.NET WebApi

Upload multiple files using WebApi REST service
0
Taking out business logic from the application allows different clients running on a different platform to use same logic. REST API is a great way to decuple business logic and make it available to different clients on a different platforms. To upload files using WebApi we first need to define an action in a WebApi controller to handle files posted to the endpoint. ...read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more

PowerShell

read more