Skip to content

Instantly share code, notes, and snippets.

@aroder
aroder / CacheProvider.js
Created March 15, 2011 18:58
An implementation of Dustin Diaz's CacheProvider with a simplified interface
/**
* {Boolean} useLocalStorageIfAvailable - optional, defaults to true. The CacheProvider object will
* use the HTML5 localStorage object, if available
*/
function CacheProvider(useLocalStorageIfAvailable) {
// values will be stored here
this._cache = {};
this._useLocalStorage = 'undefined' == typeof(useLocalStorageIfAvailable) ? true : useLocalStorageIfAvailable;
}
using System;
using System.Globalization;
using System.Windows.Data;
/// <summary>
/// Converts a boolean value to a string value. For example, if the paramter passed in is "Elephant,Giraffe"
/// then a boolean true would convert to "Elephant" and false to "Giraffe"
/// </summary>
public class BooleanToStringCustomValueConverter : IValueConverter
{
public static class ObservableCollectionExt {
public static void Populate<T>(this ObservableCollection<T> collection, IEnumerable<T> itemsToAdd) {
collection.Clear();
foreach (T item in itemsToAdd)
{
collection.Add(item);
}
}
}