Tagged articles

Found 136 articles tagged with C#

Error handling in ASP.NET Core Web API
Generating the proper response for exceptions in ASP.NET Core WepApi
0
Both Web API in .NET 4.5 and later and Web API in ASP.NET CORE have great error handling support out of the box. You can specify you global handler and control your response to a client when exception happens. ... read more
SETNX with TTL in .NET using StackExchange.Redis
Set key if it does not exist in redis with expiry using StackExchange.Redis
0
Recently I needed to set redis key if it is not present with specific expiry time to use it as some logical flag. I knew tat you can use SETNX command for this but did not have any info how to set the expiry time. After some time going through redis documentation and articles found online I found a SET method overload for the redis-cli. ... read more
Generic string to primitive type converter in C#
Converting string data to any primitive type in .NET and .NET Core
0
Often case when you need to convert String to a different type which is most of the time a primitive type in C# is when you are reading values from configuration. In both .NET and .NET Core, reading from configuration return plain String value... read more
Simple implementation of ASP.NET Web API Basic authentication security
Securing Web API with simple basic authentication and consuming it from the client code
 
0
Authentication in web services is a bit more different than with web pages because of one simple reason. There is no UI for entering credentials to authenticate to consume service... read more
Getting GIF image information using C#
Extracting GIF image data in .NET using C#
 
0
GIF image format is most commonly used format for online advertising, especially since all browser starting from major onces stopped supporting Flash animations because of their infamous security vulnerabilities and issues. After going through different articles I found online, I came up with the class which exposes following GIF image properties. ... read more
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
Download file in chunks in parallel in C#
Improved file download using chunks of file in parallel in C#
 
0
Downloading large files from your code may cause problems due to limitations in your network or system where your code is executing. For example, some systems limit the size of the file you can download through the network... read more
Displaying multiple select input for Enum in Swagger WebApi UI
Multiple select input Swagger WebApi UI
 
0
Enums in C# can contain multiple values if they are decorated with [Flags] attribute. However, Flag Enums are not recommended to be used in web api action method signatures... read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more