This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//----------------------------------------------------------------------- | |
// <copyright file="EnumerableCache.cs" company="Andrew Arnott"> | |
// Copyright (c) Andrew Arnott. All rights reserved. | |
// This code is released under the Microsoft Public License (Ms-PL). | |
// </copyright> | |
//----------------------------------------------------------------------- | |
namespace IEnumeratorCache { | |
using System; | |
using System.Collections; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> | |
<!-- EF Runtime content --> | |
<edmx:Runtime> | |
<!-- SSDL content --> | |
<edmx:StorageModels> | |
<Schema Namespace="MSBuildAcceleratorModel.Store" Alias="Self" Provider="System.Data.SqlClient" ProviderManifestToken="2005" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl"> | |
<EntityContainer Name="MSBuildAcceleratorModelStoreContainer"> | |
<EntitySet Name="File" EntityType="MSBuildAcceleratorModel.Store.File" store:Type="Tables" Schema="dbo" /> | |
<EntitySet Name="Project" EntityType="MSBuildAcceleratorModel.Store.Project" store:Type="Tables" Schema="dbo" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MSBuildAwaiterSample | |
{ | |
using System.Threading.Tasks; | |
using Microsoft.Build.Execution; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class AwaitExtensions | |
{ | |
/// <summary> | |
/// Provides await functionality for ordinary <see cref="WaitHandle"/>s. | |
/// </summary> | |
/// <param name="handle">The handle to wait on.</param> | |
/// <returns>The awaiter.</returns> | |
public static TaskAwaiter GetAwaiter(this WaitHandle handle) | |
{ | |
Contract.Requires<ArgumentNullException>(handle != null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
namespace MemoryModelTest { | |
class Program { | |
static Barrier barrier; | |
static volatile LazyExample example; | |
static bool exit; | |
static volatile CountdownEvent evt; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Gets an awaitable object that immediately schedules any continuations on the given scheduler. | |
/// </summary> | |
/// <param name="scheduler">The scheduler to use for continuations.</param> | |
/// <returns>An awaitable object.</returns> | |
internal static TaskSchedulerAwaiter GetAwaiter(this TaskScheduler scheduler) | |
{ | |
Contract.Requires<ArgumentNullException>(scheduler != null); | |
return new TaskSchedulerAwaiter(scheduler); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// LICENSED under the Ms-PL (http://opensource.org/licenses/MS-PL) | |
public static Task<TResult> ToApm<TResult>(this Task<TResult> task, AsyncCallback callback, object state) { | |
if (task == null) { | |
throw new ArgumentNullException("task"); | |
} | |
if (task.AsyncState == state) { | |
if (callback != null) { | |
task.ContinueWith( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static Task<T> DoAsync<T>(Action<Action<FlickrNet.FlickrResult<T>>> begin) { | |
var tcs = new TaskCompletionSource<T>(); | |
begin(result => { | |
if (result.HasError) { | |
tcs.SetException(result.Error); | |
} else { | |
tcs.SetResult(result.Result); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; | |
public abstract class ActivityBase : Activity { | |
private int activityResultRegistrationCounter = 10000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Collections.Specialized; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Text; | |
using Android.App; | |
using Android.Content; | |
using Android.OS; |
OlderNewer