Format:
Recent snippets matching tags of dynamic
// 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);
66 Views
no comments
DECLARE @count int DECLARE @query nvarchar(max) SET @query = 'SELECT @count = count(*) from MyTableName' EXEC sp_executesql @query, N'@count int OUTPUT', @count output
47 Views
no comments
public class Expando : DynamicObject { dynamic Instance; Dictionary<string, dynamic> ExtraProperties = new Dictionary<string, dynamic>(); public Expando(object instance) { Instance = instance; }
298 Views
no comments
//Static classes var con = typeof(System.Console).Extend(); con.WriteLine=new Action<string>(s=>System.Console.WriteLine("hello " + s)); con.WriteLine("hello world");
256 Views
no comments
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());
214 Views
no comments
// la la la if (foo is ISomeInterface) { ((ISomeInterface)foo).SomeMethod(); } else if (foo is ISomeOtherInterface) { ((ISomeOtherInterface)foo).SomeMethod(); } else { throw new SomeException();
369 Views
2 comments
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
563 Views
no comments
dynamic _Dynamic = new ExpandoObject(); _Dynamic.Color = "Brown"; _Dynamic.Print = new Action(() => { Console.Write(_Dynamic.Color); }); _Dynamic.Print();
926 Views
no comments
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;
372 Views
no comments
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search
