Click here to Skip to main content
15,901,035 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Long Lines Pin
PIEBALDconsult22-Oct-19 2:57
mvePIEBALDconsult22-Oct-19 2:57 
GeneralRe: Long Lines Pin
Member 916705721-Oct-19 20:52
Member 916705721-Oct-19 20:52 
GeneralRe: Long Lines Pin
Sander Rossel21-Oct-19 21:55
professionalSander Rossel21-Oct-19 21:55 
GeneralRe: Long Lines Pin
Rolf Borchmann22-Oct-19 0:14
Rolf Borchmann22-Oct-19 0:14 
GeneralRe: Long Lines Pin
Richard Deeming22-Oct-19 1:35
mveRichard Deeming22-Oct-19 1:35 
GeneralRe: Long Lines Pin
PeejayAdams22-Oct-19 1:45
PeejayAdams22-Oct-19 1:45 
GeneralRe: Long Lines Pin
Gary Wheeler22-Oct-19 2:10
Gary Wheeler22-Oct-19 2:10 
GeneralRe: Long Lines Pin
Dan Neely22-Oct-19 2:53
Dan Neely22-Oct-19 2:53 
C#
class ConfigWrapper
{
    public static double LowerBound { get { return double.Parse(ConfigurationManager.AppSettings["LowerBound"].ToString()); } }
    public static double UpperBound { get { return double.Parse(ConfigurationManager.AppSettings["UpperBound"].ToString()); } }
    ...
}

 ...

var face = allFaces.Where(f => f.Proportion > lowerBound && f.Proportion < upperBound).ToList()
                   .OrderBy(f => f.Proportion).ThenByDescending(f => f.Rectangle.Height).FirstOrDefault();
OutputImage(file, face);


Wrap the config so that you can be sure it's always accessed correctly, and can potentially do lazy loading and data validation. This also makes changing hard coded app.config settings into user configurable ones later on a lot less painful.

Unless I was doing something that LINQ couldn't translate to SQL or that caused it to do something terribly inefficient, I'd drop the `ToList()` in the middle of the method chain as useless overhead.
Did you ever see history portrayed as an old man with a wise brow and pulseless heart, weighing all things in the balance of reason?
Is not rather the genius of history like an eternal, imploring maiden, full of fire, with a burning heart and flaming soul, humanly warm and humanly beautiful?
--Zachris Topelius

Training a telescope on one’s own belly button will only reveal lint. You like that? You go right on staring at it. I prefer looking at galaxies.
-- Sarah Hoyt

GeneralRe: Long Lines Pin
obermd22-Oct-19 3:35
obermd22-Oct-19 3:35 
GeneralRe: Long Lines Pin
Thomas James22-Oct-19 4:36
Thomas James22-Oct-19 4:36 
GeneralRe: Long Lines Pin
MikeTheFid22-Oct-19 5:51
MikeTheFid22-Oct-19 5:51 
GeneralRe: Long Lines Pin
Jan Heckman22-Oct-19 12:11
professionalJan Heckman22-Oct-19 12:11 
GeneralThought of the Day Pin
OriginalGriff21-Oct-19 4:38
mveOriginalGriff21-Oct-19 4:38 
GeneralRe: Thought of the Day Pin
lopatir21-Oct-19 5:12
lopatir21-Oct-19 5:12 
GeneralRe: Thought of the Day Pin
Kschuler21-Oct-19 5:44
Kschuler21-Oct-19 5:44 
GeneralRe: Thought of the Day Pin
jeron121-Oct-19 5:46
jeron121-Oct-19 5:46 
GeneralRe: Thought of the Day Pin
Ravi Bhavnani21-Oct-19 5:48
professionalRavi Bhavnani21-Oct-19 5:48 
GeneralRe: Thought of the Day Pin
dandy7221-Oct-19 9:28
dandy7221-Oct-19 9:28 
GeneralRe: Thought of the Day Pin
Herman<T>.Instance21-Oct-19 21:16
Herman<T>.Instance21-Oct-19 21:16 
GeneralAre you still alive... Pin
glennPattonWork321-Oct-19 3:09
professionalglennPattonWork321-Oct-19 3:09 
GeneralRe: Are you still alive... Pin
  Forogar  21-Oct-19 3:24
professional  Forogar  21-Oct-19 3:24 
GeneralRe: Are you still alive... Pin
phil.o21-Oct-19 3:32
professionalphil.o21-Oct-19 3:32 
GeneralRe: Are you still alive... Pin
ZurdoDev21-Oct-19 5:59
professionalZurdoDev21-Oct-19 5:59 
GeneralRe: Are you still alive... Pin
Mike Hankey21-Oct-19 3:33
mveMike Hankey21-Oct-19 3:33 
GeneralRe: Are you still alive... Pin
AFell221-Oct-19 5:19
AFell221-Oct-19 5:19 

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

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


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   499 votes