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 ExtensibleDynamicObject : DynamicObject | |
{ | |
private readonly Dictionary<string, object> data; | |
public ExtensibleDynamicObject() | |
{ | |
data = new Dictionary<string, object>(); | |
} | |
public override bool TrySetMember(SetMemberBinder binder, object value) |
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
[DataContract] | |
public class Order: ExtensibleDynamicObject | |
{ | |
[DataMember] | |
public string CustomerCategory { get; set; } | |
[DataMember] | |
public int TableNumber { get; set; } | |
[DataMember] | |
public string Server { get; set; } | |
[DataMember] |
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.IO; | |
using System.Linq; | |
using System.Runtime.Serialization; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ |
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.Diagnostics; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace ConsoleApplication1 | |
{ | |
class Program |
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 Autofac; | |
using Autofac.Extras.DynamicProxy2; | |
using Castle.DynamicProxy; | |
namespace DynamicProxy | |
{ | |
//1. Install-Package Autofac | |
//2. Install-Package Autofac.Extras.DynamicProxy2 | |
//3. F5 |
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
builder.RegisterAssemblyTypes(thisAssembly) | |
.Where(type => type.Implements<IToResolve>()) | |
.AsImplementedInterfaces() | |
.InstancePerLifetimeScope() | |
// What is the name of MyCustomRegistrationCallback in AutoFac lingo? | |
// Does it even exist? | |
.MyCustomRegistrationCallback(data => | |
{ | |
if (data.Type == typeof (ThisOneType)) | |
{ |
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 IEnumerable<int> MatchSingleItemInCollection(int value) | |
{ | |
return Arg.Is<IEnumerable<int>>(coll => coll.Single() == value); | |
} |
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.Specialized; | |
using System.Diagnostics; | |
using Quartz; | |
using Quartz.Impl; | |
using Quartz.Impl.Triggers; | |
namespace ConsoleApplication5 | |
{ | |
class Program |
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
#Run as admin and make sure C:\temp exists and is accessible | |
(new-object System.Net.WebClient).DownloadFile('http://tinyurl.com/hhqarue', 'c:/temp/chrome.exe'); |
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; | |
namespace ConsoleApplication3 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine(new Test().GetExtension()); | |
Console.ReadLine(); |