Tagged articles - Extension Method
Found 12 articles tagged with Extension Method
22
May
2018
Using strongly typed objects with IDistributedCache instead of byte arrays
.NET178 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#
.NET178 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
.NET178 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
.NET178 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. 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
.NET178 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
.NET178 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
.NET178 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#
.NET178 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. Recently, all static methods are converted to extension methods for easier usage in code.
...read more
05
Mar
2014
Detect ajax request in C#
.NET178 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
4
Feb
2019
How to have a REST with Azure serverless functions
Building REST API services with Azure Functions Serverless model
21
Jan
2019
Speech to text mp3 audio files using Azure Cognitive Services and .NET Core
Transcribe mp3 audio files to text using Azure SpeechServices and C#
4
Jan
2019
SqlBulkCopy object collection to database table with C#
Performing SqlBulkCopy with collection of objects as a source data
3
Jan
2019
Filtering and paging collection result in ASP.NET Core Web API
Paging response data in ASP.NET Core WebApi projects
30
Dec
2018
Running .NET Core on Raspberry PI with Raspbian Stretch
Setting up .NET Core on Raspbery Stretch Linux distribution running on Raspberry PI
15
Dec
2018
The best option to use for a return type in ASP.NET Core WebAPI controller
Choosing the proper return type for WebApi controller actions
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
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
13
Apr
2015
Dealing with duplicate rows in SQL Server
Finding and cleaning up duplicate rows in SQL Server tables
12
Mar
2015
Reducing the number of Stored Procedures for the Application
Approach to reduce number of stored procedure for the application
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