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#
// Predicate Builder code
// Produces match only on LAST match - INCORRECT
var predicate = PredicateBuilder.False<Entry>(); 
foreach (string phrase in searchPhrases)
{
    predicate = predicate.Or(ent => (ent.Title.Contains(phrase) || ent.Keywords.Contains(phrase) || ent.Description.Contains(phrase)));
}
entries = entries.AsExpandable().Where(predicate);
 
by Rick Strahl   April 10, 2012 @ 3:41pm
66 Views
no comments
 
SQL
DECLARE @count int
DECLARE @query nvarchar(max)
 
SET @query = 'SELECT @count = count(*) from MyTableName'
EXEC sp_executesql @query, N'@count int OUTPUT', @count output
by dknaack   February 17, 2012 @ 1:39am
Tags: TSQL, Dynamic
47 Views
no comments
 
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
298 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
256 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
214 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
369 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
563 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
926 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
372 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