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

  • SEARCH
  • Home
  • 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 9132503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:19:19+00:00 2026-06-17T08:19:19+00:00

Possible Duplicate: Who actually last decide what is the Generic Type? As my question

  • 0

Possible Duplicate:
Who actually last decide what is the Generic Type?

As my question title says can anyone please explain me what is bounds (upper bound, lower bound, exact bound) and how do they play role in type inference with examples?

Consider simple code :

void func<T> ( T firstparam , T secondparam) { }

and caller call it

func( 23 , 23.23 ); 

What are the bounds while type inference process happens and how they are used by inference process?. Should my presented example is way trivial and will not have any upper bounds etc, please include your own example which will represent the idea.

  • 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-06-17T08:19:20+00:00Added an answer on June 17, 2026 at 8:19 am

    In your examples there are no bounds in type inference. If you call it like

     func( 23 , 23.23 ); 
    

    Then candidates for types would be int and double. Int can be casted implicitly to double but not vise-versa, so the fixed type for T is double. This has nothing to do with bounds, but type compatibility.

    But however, if you call it like

    func( new object() , 23.23 );
    

    Then the upper bound for T will be object, the lower bound will be double. In such case fixed type for T will be object.

    Eric Lippert describe what bounds are and why they separate lower, upper and exact bounds at blogpost on How do we ensure that method type inference terminates?

    Jon Skeet describe in detail the process of type inference at 9.4.3 Two-phase type inference in his wonderful book C# in Depth. Please read carefully his description for type inference for listing 9.11

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

Sidebar

Related Questions

Possible Duplicate: WebClient vs. HttpWebRequest/HttpWebResponse I can't guess who is better HttpWebRequest or webclient
Possible Duplicate: Special (magic) methods in Python who can tell me what can call
Possible Duplicate: C# 'var' keyword versus explicitly defined variables EDIT: For those who are
Possible Duplicate: How can I convert a list<> to a multi-dimensional array? I want
Possible Duplicate: How can I understand nested ?: operators in PHP? Why does this:
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Can Visual Studio 2012 be installed side-by-side w/ Visual Studio 2010? Before
Possible Duplicate: Who needs singletons? I always write with respect to best practice ,
Possible Duplicate: how to use foursquare API in android application? This is a question
Possible Duplicate: PHP: Check who had read sent email? I'm writing a tool in

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.