Click here to Skip to main content
11,634,827 members (69,362 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

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, no programming questions and please don't post ads.
 
GeneralRe: Define: Emperor Palpatine Pin
CDP180214-Mar-13 9:18
memberCDP180214-Mar-13 9:18 
GeneralRe: Define: Emperor Palpatine Pin
Mark_Wallace14-Mar-13 20:27
memberMark_Wallace14-Mar-13 20:27 
GeneralRe: Define: Emperor Palpatine Pin
AspDotNetDev14-Mar-13 20:32
protectorAspDotNetDev14-Mar-13 20:32 
GeneralRe: Define: Emperor Palpatine Pin
wizardzz14-Mar-13 9:22
memberwizardzz14-Mar-13 9:22 
GeneralRe: Define: Emperor Palpatine Pin
AspDotNetDev14-Mar-13 9:26
protectorAspDotNetDev14-Mar-13 9:26 
GeneralRe: Define: Emperor Palpatine Pin
BillWoodruff14-Mar-13 18:23
memberBillWoodruff14-Mar-13 18:23 
GeneralRe: Define: Emperor Palpatine Pin
Mark_Wallace14-Mar-13 20:26
memberMark_Wallace14-Mar-13 20:26 
GeneralIt's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Marc Clifton14-Mar-13 8:48
protectorMarc Clifton14-Mar-13 8: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 Pin
CDP180214-Mar-13 8:52
memberCDP180214-Mar-13 8:52 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
mark merrens14-Mar-13 8:54
membermark merrens14-Mar-13 8:54 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Deyan Georgiev14-Mar-13 8:57
memberDeyan Georgiev14-Mar-13 8:57 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Pete O'Hanlon14-Mar-13 9:00
protectorPete O'Hanlon14-Mar-13 9:00 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
dusty_dex14-Mar-13 9:21
memberdusty_dex14-Mar-13 9:21 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Dan Neely14-Mar-13 9:32
memberDan Neely14-Mar-13 9:32 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Maximilien14-Mar-13 10:21
memberMaximilien14-Mar-13 10:21 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Gjelt14-Mar-13 11:20
memberGjelt14-Mar-13 11:20 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
_Josh_14-Mar-13 12:03
member_Josh_14-Mar-13 12:03 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Nicholas Butler14-Mar-13 10:27
mentorNicholas Butler14-Mar-13 10:27 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Marco Bertschi14-Mar-13 10:41
memberMarco Bertschi14-Mar-13 10:41 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
lewax0014-Mar-13 10:44
memberlewax0014-Mar-13 10:44 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Gjelt14-Mar-13 11:22
memberGjelt14-Mar-13 11:22 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Forogar14-Mar-13 12:15
memberForogar14-Mar-13 12:15 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
_Maxxx_14-Mar-13 14:48
member_Maxxx_14-Mar-13 14:48 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
Joe Woodbury14-Mar-13 15:27
memberJoe Woodbury14-Mar-13 15:27 
GeneralRe: It's interesting how much lambda, extension and anonymous methods I'm using nowadays Pin
dusty_dex14-Mar-13 17:54
memberdusty_dex14-Mar-13 17: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
Web01 | 2.8.150728.1 | Last Updated 30 Jul 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid