Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3720940
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:23:09+00:00 2026-05-19T05:23:09+00:00

I am going through this WPF tutorial http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Post.aspx?ID=18 and I have a question about

  • 0

I am going through this WPF tutorial http://blogs.vertigo.com/personal/alanl/Blog/Lists/Posts/Post.aspx?ID=18 and I have a question about the CountToFontSizeConverter section of the tutorial. Could someone please explain the return statement to me i.e

return ((minFontSize + count + increment) < maxFontSize) ? 
         (minFontSize + count + increment) : maxFontSize;

I understand it’s a conditional but the syntax looks rather bespoke. If possible could someone re-write this in a simpler way? Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:23:10+00:00Added an answer on May 19, 2026 at 5:23 am

    Not sure what you mean by “somewhat bespoke” but it’s worth breaking down.

    Original:

    return ((minFontSize + count + increment) < maxFontSize) 
          ? (minFontSize + count + increment) : maxFontSize;
    

    Broken down:

    bool condition = (minFontSize + count + increment) < maxFontSize;
    if (condition)
    {
        return minFontSize + count + increment;
    }
    else
    {
        return maxFontSize;
    }
    

    Better approach – far more readable:

    return Math.Min(minFontSize + count + increment, maxFontSize);
    

    In general, you can usually replace an expression of the form

    a < b ? a : b
    

    with

    Math.Min(a, b)
    

    assuming that a and b are of numeric types. It’s not always the case, but it’s a good starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going through this tutorial: http://tutorials.jumpstartlab.com/projects/jsattend.html In iteration 7, step 3 we get to
I was going through this article today. http://vinothbabu.com/2010/05/08/update-and-insert-differences-in-syntax-is-an-inconvenience/ I was not able to understand
I am going through this tutorial http://www.9lessons.info/2009/04/exactly-twitter-like-follow-and-remove.html on how to implement a twitter-like follow/unfollow
I am going through this tutorial about PDO and have come to the point
Trying to learn a bit about PDO and is going through this tutorial .
So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps.
I have been going through this tutorial on auto-populating boxes using jQuery and Ajax:
I am going through this document and this is what I gathered. <Esc> Escape
I was going through some data structures and I noticed this as a time
I was going through Jeffrey Palermo's book and came across this syntax. private void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.