Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Text;
namespace System
{
public struct NonNullable<T> where T : class
{
public NonNullable(T value)
{
@rorymurphy
rorymurphy / XFormatResponder.cs
Last active August 29, 2015 14:22
ASP.NET MVC Multi-format responder
Copyright 2015 Rory A. Murphy
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@rorymurphy
rorymurphy / JsonNetResult.cs
Created May 13, 2015 18:43
JSON.NET ActionResult for ASP.NET MVC (using JSON extensions)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Web;
using System.Web.Mvc;
using Newtonsoft.Json;
@rorymurphy
rorymurphy / JsonNetValueProviderFactory.cs
Created May 7, 2015 14:40
ASP.NET MVC Value Provider Factory using JSON.NET
// This is a slightly modified ValueProviderFactory based almost entirely on Microsoft's JsonValueProviderFactory.
// That file is licensed under the Apache 2.0 license, but I am leaving the copyright statement below nonetheless.
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Configuration;
using System.Globalization;
using System.IO;
@rorymurphy
rorymurphy / JsonExtensions
Created September 30, 2014 18:47
.NET extension class to make JSON serialization quick, easy, and secure (using JSON.NET)
/*
* This file is licensed under the MIT license
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;