Visual Studio Feeds English |
- Microsoft's Surface Pro: Floor wax or a dessert topping (and does it matter)?
- Using a Java Framework with F#: The Stanford Parser for NLP
- Are you working with QuantLib and F#?
- Download – iOS 6 Untethered Jailbreak Program evasion
- Powershell script to detect the Windows Azure SDK in Azure Cloud Service VM and fix the ...
- Windows 8: Creating Great App Bar Buttons
- Quick Hits Issue 2: Privacy is Paramount (and easy)
- Web based Test Hub in TFS Update2 (TFS2012.2) and Team Foundation Service
- Caching Set and Get Expressions
- Mobile, Cloud are Focuses of Microsoft's 2013 Roadmap
| Microsoft's Surface Pro: Floor wax or a dessert topping (and does it matter)? Posted: 05 Feb 2013 12:12 PM PST |
| Using a Java Framework with F#: The Stanford Parser for NLP Posted: 05 Feb 2013 09:55 AM PST |
| Are you working with QuantLib and F#? Posted: 05 Feb 2013 09:55 AM PST |
| Download – iOS 6 Untethered Jailbreak Program evasion Posted: 05 Feb 2013 05:37 AM PST |
| Powershell script to detect the Windows Azure SDK in Azure Cloud Service VM and fix the ... Posted: 05 Feb 2013 05:22 AM PST |
| Windows 8: Creating Great App Bar Buttons Posted: 05 Feb 2013 04:52 AM PST |
| Quick Hits Issue 2: Privacy is Paramount (and easy) Posted: 05 Feb 2013 03:52 AM PST |
| Web based Test Hub in TFS Update2 (TFS2012.2) and Team Foundation Service Posted: 05 Feb 2013 02:51 AM PST |
| Caching Set and Get Expressions Posted: 05 Feb 2013 02:51 AM PST Originally posted on: http://geekswithblogs.net/Nettuce/archive/2013/02/05/caching-set-and-get-expressions.aspx (http://geekswithblogs.net/Nettuce/archive/2013/02/05/caching-set-and-get-expressions.aspx) public static class ExpressionCache { static readonly ConcurrentDictionary Delegates = new ConcurrentDictionary(); public static void Set(this object obj, string propertyName, object value) { CreateDelegate(obj, propertyName, value).DynamicInvoke(obj, value); } public static object Get(this object obj, string propertyName) { return CreateDelegate(obj, propertyName).DynamicInvoke(obj); } static Delegate CreateDelegate(object obj, string propertyName, object value = null) { var type = obj.GetType(); var key = type.Name + propertyName + (value == null ? "get" : "set"); if (Delegates.ContainsKey(key)) return Delegates[key]; var targetParameter = Expression.Parameter(type); var member = Expression.PropertyOrField(targetParameter, propertyName); var dlg = value == null ? CreateGetter(member, targetParameter) : CreateSetter(member, targetParameter); Delegates.TryAdd(key, dlg); return dlg; } static Delegate CreateSetter(MemberExpression member, ParameterExpression target) { var memberParameter = Expression.Parameter(member.Type); var assign = Expression.Assign(member, memberParameter); return Expression.Lambda(assign, target, memberParameter).Compile(); } static Delegate CreateGetter(MemberExpression member, ParameterExpression target) { return Expression.Lambda(member, target).Compile(); } } ...(Read whole news on source site) (http://geekswithblogs.net/Nettuce/archive/2013/02/05/caching-set-and-get-expressions.aspx) |
| Mobile, Cloud are Focuses of Microsoft's 2013 Roadmap Posted: 05 Feb 2013 12:03 AM PST |
| You are subscribed to email updates from VSF RSS English To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
| Google Inc., 20 West Kinzie, Chicago IL USA 60610 | |
Комментариев нет:
Отправить комментарий