Click here to Skip to main content

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy.
The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct and please don't post ads.

Technical discussions are welcome, but if you need specific help please use the programming forums.


 
GeneralRe: Define: Emperor Palpatine PinmemberCDP180214-Mar-13 10:18 
GeneralRe: Define: Emperor Palpatine PinmemberMark_Wallace14-Mar-13 21:27 
GeneralRe: Define: Emperor Palpatine PinprotectorAspDotNetDev14-Mar-13 21:32 
GeneralRe: Define: Emperor Palpatine Pinmemberwizardzz14-Mar-13 10:22 
GeneralRe: Define: Emperor Palpatine PinprotectorAspDotNetDev14-Mar-13 10:26 
GeneralRe: Define: Emperor Palpatine PinmemberBillWoodruff14-Mar-13 19:23 
GeneralRe: Define: Emperor Palpatine PinmemberMark_Wallace14-Mar-13 21:26 
GeneralIt's interesting how much lambda, extension and anonymous methods I'm using nowadays [modified] PinprotectorMarc Clifton14-Mar-13 9:48 
For example, here's a setter that updates the underlying field of a data row and fires a change event based on whether the field actually changed (UpdateField, an extension method, returns true) and whether the event has been wired (not null):
 
set {row.UpdateField<string>(model, "TableOfContents", value).Then(() => TableOfContentsChanged.IfNotNull(e => e(this))); }
 
[edit]
For example, the above would otherwise be written as:
 
bool changed = row.UpdateField<string>(model, "TableOfContents", value);
if (changed)
{
  if (TableOfContentsChanged != null)
  {
    TableOfContentsChanged(this);
  }
}
 
[/edit]
 
Or, here's something that scans the nodes in a tree (Hierarchy being an extension method) and if it finds a match (not null) updates the title in the tree's caption:
 
TreeView.Hierarchy().FirstOrDefault(n => n.Tag == rec).IfNotNull(t=>t[0] = rec.GetTitle());
 
I'm also noticing how my programming is becoming much more "functional" - I often pass in Func or Action anonymous methods, etc. What about you? Is you C# imperative programming starting to look more and more like function programming?
 
Marc


modified 14-Mar-13 15:27pm.

GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberCDP180214-Mar-13 9:52 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmembermark merrens14-Mar-13 9:54 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberDeyan Georgiev14-Mar-13 9:57 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinprotectorPete O'Hanlon14-Mar-13 10:00 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmemberdusty_dex14-Mar-13 10:21 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberDan Neely14-Mar-13 10:32 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberMaximilien14-Mar-13 11:21 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberGjelt14-Mar-13 12:20 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmember_Josh_14-Mar-13 13:03 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmentorNicholas Butler14-Mar-13 11:27 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberMarco Bertschi14-Mar-13 11:41 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmemberlewax0014-Mar-13 11:44 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberGjelt14-Mar-13 12:22 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberForogar14-Mar-13 13:15 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmember_Maxxx_14-Mar-13 15:48 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays PinmemberJoe Woodbury14-Mar-13 16:27 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pinmemberdusty_dex14-Mar-13 18:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 20 Dec 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid