CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets matching tags of Dynamic
C#
public class Expando : DynamicObject
{
    dynamic Instance;
    Dictionary<string, dynamic> ExtraProperties = new Dictionary<string, dynamic>();
 
    public Expando(object instance)
    {
        Instance = instance;
    }
by Rick Strahl   November 16, 2011 @ 1:35pm
234 Views
no comments
 
C#
//Static classes
  var con = typeof(System.Console).Extend();
  con.WriteLine=new Action<string>(s=>System.Console.WriteLine("hello " + s));
  con.WriteLine("hello world");
 
by amazedsaint   October 21, 2010 @ 5:38am
223 Views
no comments
 
C#
 
class PrototypeTest
{
    static void Main()
    {
        dynamic pastry1 = new Prototype();
        pastry1.PastryType = "cake";
        pastry1.Cake = new Func<string>(() => "awesome");
 
        Console.WriteLine("Pastry 1's {0} is {1}.", pastry1.PastryType, pastry1.Cake());
by Andy Sherwood   August 17, 2010 @ 9:22am
190 Views
no comments
 
C#
 
// la la la
if (foo is ISomeInterface) {
    ((ISomeInterface)foo).SomeMethod();
}
else if (foo is ISomeOtherInterface) {
    ((ISomeOtherInterface)foo).SomeMethod();
}
else {
    throw new SomeException();
by InfinitiesLoop   August 09, 2010 @ 4:26pm
336 Views
2 comments
 
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Hosting;
 
namespace DynamicObjectContracts
{
    public class Program
by Glenn Block   March 17, 2010 @ 9:32am
Tags: Dynamic, MEF
531 Views
no comments
 
C#
dynamic _Dynamic = new ExpandoObject();
_Dynamic.Color = "Brown";
_Dynamic.Print = new Action(() => { Console.Write(_Dynamic.Color); });
_Dynamic.Print();
by Jerry Nixon   March 05, 2010 @ 8:38am
879 Views
no comments
 
C#
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
by Athens Springer   January 22, 2010 @ 8:33am
334 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate