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 Roslyn.Scripting.CSharp; | |
using System; | |
namespace RoslynTests | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var script = "using System; public class Test{ public void Do<T>() where T : IDisposable{ } }"; |
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
class ProgramWithAPM : IRunnable | |
{ | |
private int pending; | |
private readonly object lockObject; | |
public ProgramWithAPM() | |
{ | |
this.pending = 0; | |
this.lockObject = new object(); |
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
static void Main() | |
{ | |
var fs = new FileStream("test.txt", FileMode.Open, FileAccess.Read, FileShare.None, 1024, true); | |
var buffer = new byte[1024]; | |
fs.BeginRead(buffer, 0, 1024, ReadCallback, new State { Buffer = buffer, FileStream = fs }); | |
Console.ReadLine(); | |
} |
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
var net = Require<Net>(); | |
var server = net.CreateServer(socket => | |
{ | |
Console.WriteLine("New connection"); | |
socket.On( | |
data: bytes => Console.Write(bytes.AsString()), | |
close: () => Console.WriteLine("Connection closed"), | |
error: e => Console.WriteLine("Error: {0}\r\nStackTrace: {1}", e.Message, e.StackTrace)); |
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
var MyClass = (function () { | |
function MyClass() { | |
} | |
MyClass.prototype.add = function (a, b) { | |
return a + b; | |
}; | |
MyClass.prototype.partialAdd = function (a) { | |
var _this = this; | |
return function (b) { | |
return _this.add(a, b); |
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.Collections.Generic; | |
using System.Data.Entity; | |
public class CompositeDatabaseInitializer<T> : IDatabaseInitializer<T> where T : DbContext | |
{ | |
private readonly List<IDatabaseInitializer<T>> initializers; | |
public CompositeDatabaseInitializer(params IDatabaseInitializer<T>[] databaseInitializers) | |
{ | |
this.initializers = new List<IDatabaseInitializer<T>>(); |
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
needleContainer | |
.Map<IForceEnlightened>() | |
.To<Jedi>() | |
.WithId("Yoda") | |
.UsingLifetime(RegistrationLifetime.Singleton) | |
.Commit(); |
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 class RootBindingExtension : IMarkupExtension<Binding> | |
{ | |
public string Path { get; set; } | |
public Binding ProvideValue(IServiceProvider serviceProvider) | |
{ | |
IRootObjectProvider rootProvider = (IRootObjectProvider) serviceProvider.GetService(typeof(IRootObjectProvider)); | |
var view = rootProvider.RootObject; | |
var fe = view as FrameworkElement; |
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 class ConnectionListView : MmcListView, IConnectionListView | |
{ | |
private readonly IConnectionListPresenter presenter; | |
public ConnectionListView() | |
{ | |
var container = this.SnapIn.Tag as IUnityContainer; |
OlderNewer