Tagged articles
Image from Pexels

Tagged articles - .NET

Found 104 articles tagged with .NET

Zip whole folder on the fly in ASP.NET MVC application
Generate folder archive and send zip file in a response in ASP.NET MVC
 
0
Generating Zip archives has always been a great thing if you need to generate different content for the request depending on some parameters. In case you need to return multiple files this is one approach to go with...read more
Image thumbnail Html helper with image caching for the perforance
Creating image thumbnail with caching in MVC
0
Creating image thumbnail on the fly is pretty easy in ASP.NET whether you are still using WebForms or MVC. There is even a methods introduced in .NET 4.5 framework for generating thumbnail image from a Bitmap class instance. You can easily create and action in a controller and generate and return thumbnail image on the fly...read more
Enabling GZip and Deflate compression from ASP.NET code
Compress your response on hosts where IIS compression is not supported
0
HTTP compression is a simple way to improve site performance and decrease bandwidth, with no configuration required on the client side. If you test your website through Google PageSpeed Insights, HTTP compression will be one of the points recommended to be used to increase website performance. Luckily for .NET developers IIS supports it out of the box...read more
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
0
If you were planning to create sitemap.xml in Umbraco, you most probably were doing it with HttpHandler. This was fine until Umbraco version 6.2.2. If your website was running in lower version, most probably after update your HttpHandler were crashing since UmbracoContext.Current returns null. ...read more
Easier manipulation with IEnumerable objects
Useful extension methods for working with lists, arrays, dictionaries...
 
0
Working with any collection which implements IEnumerable is pretty easy in C#, plus if you are using LINQ you can easily manipulate with collection data. Recently I was doing some filtering with some in-memory collections and I had to check whether one collection contains same elements as some other collection with elements of the same type...read more
Managed Extensibility Framework (MEF) quick start
Introducing MEF with simple code example application
 
0
Managed Extensibility Framework or MEF is a library introduced in .NET Framework 4 which allows developers to easily create plugin based applications. It lives in System.ComponentModel.Composition namespace and before start working with MEF reference to this assembly needs to be added in a project.It is basically an implementation of IoC (Inversion of Control) pattern with few core functionalities such as assembly loading...read more
Random element of IEnumerable/Array
Random element extension method for IEnumerable/Array
 
0
I don't work with random values very often but recently I had to write some small function that returns random value from an array. It sounded like a good idea to write it as an extension method to make it reusable for other projects...read more
ConcurrentDictionary vs Hashtable.Synchronized
Comparison of collections in multithread environment
 
0
Basically all Dictionary collections in .NET internally implement Hashtable wrapped, so in terms of mechanism they are pretty much the same. The difference is that Dictionary exposes strong types while Hashtable uses object-object keyvalue pair which is much harder to work with because you need to know what is the actual type of the object stored in a key or value. Often casting will probably be required...read more
Convert string to any type that implements TryParse method
String extension method for converting to other value types
0
In many cases serialized data is returned in a form of string although the actual type of data is different. The problem begings when you want to use data in it's original type becaus direct cast is not allowed in C# as it is in VB.net. This is why you have to use TryParse and safely parse the value to it's original type...read more
Set entry assembly in Unit testing methods
Resolving null entry assembly issue in unit tests
0
Recently I started writing unit tests for a small project I keep in my visualstudio online TFS repository. After few test done I run into an issue. Since this project heavily relies on Reflection and dynamic assembly loading, main class constructor at one point is calling ...read more
Avoiding high processor load in long running loops
Keep processor not overloaded with long running loops
0
When having a long running loop which you are not sure when it is going to end you will probably have to create a loop in a separate loop and on every iterration you will check whether some condition is true and exit the loop. Let's say you want to execute some piece of code after some specific time, let's say after one minute or everyday at specific time (common scenario in windows services). You can do it really simple with Timer class and just few lines of code as the code below. ...read more
Deserializing JSON to anonymus type in C#
Binding JSON string to anonyms type
0
JSON is really easy to use and it really boosts performances since it is a lot lighter than XML and SOAP. Sometime it can be really annoying having to create POCO class every time you need to deserialize JSON value passed from client side in ASP.NET web applications. During extending project functionality this number of POCO classes can significantly grow to that matter that you have a bunch of classes for even the simplest task you have to do with JSON value. ...read more
Application plugin host with assembly caching and auto reloading
Caching and loading plugins dynamically when plugin library updates
 
0
Few moths ago I wrote and article about simple way to implement plugin architecture in C# simple plugin host application approach. This approach is great for desktop applications because when you for example need to update (which means replace the plugin dll) you can easily close the app and start it again and it will pickup new code...read more
JavaScript Eval function equivalent in C#
Execute C# code string on the fly
 
0
Probably who ever was working on some complicated dynamic client-side JavaScript used at least once eval functional in JavaScript. Basically this function executes the code which is passed to it as parameter...read more
Windows Scheduled Task vs Windows Service
Points to consider whether to use scheduled task or windows service
0
From time to time you have a need to implement some maintainance opration for your application server. Whether it is just a simple temporary file deleting pr something more complicated. Two most common ways to do this are either using ...read more

.NET

read more

JavaScript

read more

SQL/T-SQL

read more

Umbraco CMS

read more