Skip to content

Instantly share code, notes, and snippets.

View pmunin's full-sized avatar

Philipp Munin pmunin

View GitHub Profile
@pmunin
pmunin / XNodeSerializationExtensions.cs
Created March 22, 2016 20:28
.NET Xml Serialization Extensions
using System;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Serialization;
public static class XNodeSerializationExtensions
{
static string GetXmlRootName(XNode xml)
{
@pmunin
pmunin / WebAppHostHelper.cs
Last active April 11, 2016 15:25
helpers for ASP.NET, ASP.NET MVC app server side testing
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
@pmunin
pmunin / ObjectAnnotation.cs
Created April 25, 2016 15:27
Allows to create annotation (dynamically linked objects/wrappers)
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace ObjectAnnotation
{
@pmunin
pmunin / Comparer.cs
Last active March 17, 2017 04:57
EqualityComparer helpers
//Latest version here: https://gist.github.com/b471ea36789d375069020030f600bd3e.git
using System;
using System.Collections.Generic;
namespace ComparerUtils
{
public static class Comparer
{
public static IComparer<T> From<T>(Comparison<T> compare)
@pmunin
pmunin / method.snippet
Last active March 23, 2017 15:46
Visual Studio C# Snippets
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Method template</Title>
<Shortcut>method</Shortcut>
<Description>New method template</Description>
<Author>Philipp Munin</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@pmunin
pmunin / WebViewPageExtensions.cs
Last active October 19, 2016 21:02
ASP.NET MVC WebViewPageExtensions
using System;
using System.Collections.Generic;
using System.Web.Mvc;
using System.Web.WebPages;
using System.Linq;
public static class WebViewPageExtensions
{
/// <summary>
/// Functionality similar to the controller's TryUpdateModel() protected method
@pmunin
pmunin / PriorityQueue.cs
Last active March 29, 2018 16:28
Simple .NET PriorityQueue based on SortedDictionary<TKey, Queue<TItem>> (BST) behind the scene
//Latest version is here: https://gist.github.com/affc23dd89950e67ece9ca3b19b9508a.git
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace PriorityQueueUtils
{
/// <summary>
/// Queue contract
@pmunin
pmunin / CartesianProduct.cs
Last active May 1, 2017 22:20
CartesianProduct extensions
//latest version is here: https://gist.github.com/7d99ff883fdf2ddfe968f6f9c57b1d4a.git
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PriorityQueueUtils; //from https://gist.github.com/affc23dd89950e67ece9ca3b19b9508a.git
using CachingEnumeratorUtils; //from https://gist.github.com/b1059488d17c52da5a732a100ba6e09f.git
@pmunin
pmunin / CachingEnumerator.cs
Last active March 14, 2017 04:11
Caching enumerator, making sure source enumerator will be only iterated once
//latest version is here: https://gist.github.com/b1059488d17c52da5a732a100ba6e09f.git
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace CachingEnumeratorUtils
{
/// <summary>
/// Enumerable doing lazy caching of enumerator, to avoid generating items more than one time
@pmunin
pmunin / MergeSortedEnumerables.cs
Last active May 15, 2017 05:38
Merge Sorted Enumerable
//Latest version is here: https://gist.github.com/1eef7d55a19593735b9ecc3fc6449626.git
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Collections;
using PriorityQueueUtils; //https://gist.github.com/affc23dd89950e67ece9ca3b19b9508a.git
namespace MergeSortedEnumerablesUtils
{