
Image from Pexels
Tagged articles - Extension Method
Found 12 articles tagged with Extension Method
22
May
2018
Using strongly typed objects with IDistributedCache instead of byte arrays
.NET229 titlesAn easy way to cache any object to distributed cache store using .NET Core
0
Saving an object to distributed cache store in .NET Core requires your object to be serialized to byte array in order for SetAsync method on Microsoft.Extensions.Caching.Distributed.IDistributedCache interface implemented instance to save your object to the injected cache store instance.
This means that what ever instance you have, you need to serialize it first to byte array. Similar, just reversed process applies for the process of reading an object from the distributed cache store.
...read more
21
Jan
2018
Get number of messages in MSMQ with C#
.NET229 titlesMSMQ 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
.NET229 titlesUseful 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. File-system itself is providing some stuff which can be useful for this...read more
02
Mar
2015
Easier manipulation with IEnumerable objects
.NET229 titlesUseful 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
06
Feb
2015
Random element of IEnumerable/Array
.NET229 titlesRandom 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
.NET229 titlesString 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
JavaScript31 titlesHow 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 CMS25 titlesIPublished 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
.NET229 titlesExtension 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#
.NET229 titlesHelper 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...read more
05
Mar
2014
Detect ajax request in C#
.NET229 titlesEasier 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
05
Mar
2014
Extending Umbraco API with extension methods
Umbraco CMS25 titlesNullreference exception safe property accessing
0
Often during writing partial view for page you need to read value from property which is content or media picker. In order to get integer value you need to cast value acquired with GetPropertyValue method which is object type...read more
.NET
5
Jun
2022
Using dotnet nuget package vulnerability scan in Azure DevOps build
Listing nuget vulnerabilities and controlling build in Azure DevOps
5
May
2022
Protecting static files in ASP.NET Core using custom middleware
Restricting access to specific static content with middleware in ASP.NET Core
20
Dec
2021
Supporting multiple authentication schemes in asp.net core webapi
Using more than one authentication schemes in webapi projects
12
Dec
2021
Controlling the flow of migrations in EF Core
Altering EF Core migrations execution order
28
Nov
2021
Unit of work pattern with Dapper
Implementing unit of work pattern with Dapper in .NET 5
21
Sep
2021
Adding display name to Enum values
Implementing additional values for Enum items in C#
JavaScript
28
Oct
2018
HTML5 localStorage with expiry with vanilla JavaScript
Using HTML5 localStorage with expiry
8
May
2018
Monitoring DOM changes with JavaScript
Handling DOM changes with plain 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
22
Feb
2022
Select column names with values from SQL Server database
Fetching column names with its value in T-SQL using built in JSON methods
23
May
2020
Identifying opened connections for the specific application in SQL Server
Connection listing queries in SQL Server
3
May
2018
Reading JSON data in T-SQL on SQL Server
Extracting values from JSON string on SQL Server using 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
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
4
Sep
2014
Getting cropped image the smart way
The way to get cropped image URL with option to load original image too
27
Aug
2014
Fastest way to return JSON result from a controller
Resturn JSON in MVC controller action