Tags » Csharp

"Sideways overriding" with partial methods

First note: this blog post is very much tongue in cheek. I’m not actually planning on using the idea. But it was too fun not to share. 827 more words


LINQ LIST: Distinct method extension

While operating with collections, sometime we would like to perform Distinct on column, to achieve this we need to write the extension method.

public static class StaticDistinct
       public static IEnumerable<TSource> DistinctBy<TSource, TKey>
        (this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
              HashSet<TKey> knownKeys = new HashSet<TKey>();
              foreach (TSource element in source)
                    if (knownKeys.Add(keySelector(element)))
                         yield return element;

var distinctUsers = users.DistinctBy(x => x.EmailId).ToList();

… 100 more words

Playing around with OWIN

What exactly is OWIN?

OWIN stands for Open Web Interface for .Net. It’s a Microsoft specification to decouple the server from the web applications that is built on top of it. 295 more words


Media Manager (Programming)

This post is going to be zero effort, except for making an entire program. For those who don’t know I like to make programs in my spare time (hence everything else on this site except my blog). 86 more words

Delegate and its Flavors

Delegate is a very powerful feature available in the .NET Framework. We will explore delegate& its new flavors which are being introduced in the framework. 726 more words

CSharp Core

SharePoint - Get Image tags From HTML C# to set the image width property.

Requirement –  To get only image tags from HTML content and set the width property of the image.

Below code shows how to get the image tags, then image name, image properties to set the width. 276 more words


SharePoint - Add Header and Footer to PDF using iTextSharp and C#

 Requirement : To add header and footer to the PDF file generated using iTextSharp.

In our earlier post – Export to PDF using iTextSharp we discussed on how to export html content to PDF using iTextSharp. 630 more words