Tagged articles
Found 11 articles tagged with Extension Method
21
Jan
2018
Get number of messages in MSMQ with C#
.NET
126 titles
MSMQ message count in .NET
0
MSMQ (Microsoft Message Queuing) is a built in Windows component. It is not so popular now days as there are more efficient and robust solutions available.
However, it still has it's place in application architecture as a simple queueing system, plus as I mentioned, it comes out of the box with Windows operating system as a Windows component.This means it is still widely used Windows based applications mostly for internal notifications and services between components of the solution...
read more
13
Jan
2016
Simplified FileAttributes usage with extension methods
.NET
126 titles
Useful extension methods for common used file and folder attributes
0
In case you are working on a small project where you just store some files and access them, you do not really need a database to achieve accessibility and additional info to files or folders. Filesystem itself is providing some stuff which can be useful for this...
read more
02
Mar
2015
Easier manipulation with IEnumerable objects
.NET
126 titles
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. At first sight this looks pretty simple, but first problem is that collection elements might not be in the same order in both collection.
...
read more
06
Feb
2015
Random element of IEnumerable/Array
.NET
126 titles
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
02
Feb
2015
Convert string to any type that implements TryParse method
.NET
126 titles
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
11
Sep
2014
Extension method equivalents in JavaScript
JavaScript
29 titles
How to write an extension method for a type in JavaScript
0
For someone who works in C#, extension methods are one really useful feature introduced in .NET framework.
I use extension methods a lot because they are so nicely integrated with intellisense and you can access them really easy.
...
read more
30
May
2014
Fetching image cropper cropped file path
Umbraco CMS
25 titles
IPublished content extension for getting crop image file easily
0
ImageCropper datatype was once part of uComponents, but because it is so usefull, it is now included into standard Umbraco instalation.
However as much it is useful, I could not find the way to get cropped image file properly with anything that was shipped with Umbraco installation. Therefore I decided to write my own extension and to make life easier while working with ImageCropper in Umbraco.
...
read more
27
May
2014
Extending WebForms Page class for registering stylesheet include
.NET
126 titles
Extension method which enables registering stylesheet file reference
0
I recently started working on an Umbraco package for GoogleMap manipulation. Since initial version of package is planned only for Umbraco 6 I decided to use WebuserControl for creating a package custom datatype.
It means that for one document type I might have multiple control instances on the page.
...
read more
26
Apr
2014
Bitmap manipulation extension methods for C#
.NET
126 titles
Helper methods for bitmap manipulation in .NET
0
This is a class I used few years back for some image manipulation in C#.
Over the years, I was adding more methods and code snippets I needed and some stuff I found on Internet, so it grow to a useful collection of Bitmap manipulation methods. Recently, all static methods are converted to extension methods for easier usage in code.
...
read more
05
Mar
2014
Detect ajax request in C#
.NET
126 titles
Easier way to detect whether request is an ajax request
0
Sometime you need to determine whether your request is standard GET/POST request or Ajax POST/GET http request.
This info is stored in request value isAjax or X-Requested-With. By checking these values of request you can easily determine whether http request is ajax or not.
...
read more
.NET
7
Apr
2018
Simple implementation of ASP.NET Web API Basic authentication security
Securing Web API with simple basic authentication and consuming it from the client code
28
Mar
2018
Getting GIF image information using C#
Extracting GIF image data in .NET using C#
25
Mar
2018
How to avoid Thread.Sleep in your production code in .NET
Avoiding Thread.Sleep in production code in .NET using C#
23
Mar
2018
Reduce traffic by serializing JSON with different alias with Json.NET and C#
Reducing speed and increasing performance by reducing traffic with JSON size
JavaScript
9
May
2017
Non blocking CSS load on the page
Load external CSS files in an async manner
16
Mar
2017
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
17
Jan
2016
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
11
Jan
2016
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
SQL/T-SQL
28
Apr
2016
Create XML/HTML with T-SQL
Generating XML/HTML output in SQL Server
24
Nov
2015
IP address to octets split in TSQL
Split IP addresse into octets in SQL Server
20
Jul
2015
Getting first and last second of the current year, month and day
Using minimum and maximum date time in SQL query
13
Apr
2015
Dealing with duplicate rows in SQL Server
Finding and cleaning up duplicate rows in SQL Server tables
Umbraco CMS
2
Mar
2018
Minify HTML output of your pages
Minification of HTML output using ASP.NET IHttpModule
18
Apr
2015
Generate sitemap.xml on the fly in Umbraco CMS
Simple sitemap.xml Umbraco handler
2
Mar
2015
Accessing UmbracoHelper in HttpHandler request
Working with UmbracoHelper and IPublishedContent in HttpHandler
14
Sep
2014
Same page language switching in Umbraco
Land on the same page in different language in Umbraco using Relations