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 7948481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:44:02+00:00 2026-06-04T01:44:02+00:00

The msdn docs ( http://msdn.microsoft.com/en-us/library/tfakywbh.aspx ) report the syntax for the Comparison delgate with

  • 0

The msdn docs (http://msdn.microsoft.com/en-us/library/tfakywbh.aspx) report the syntax for the Comparison delgate with what looks like a keyword ‘in’.

public delegate int Comparison<in T>(
    T x,
    T y
)

Does the ‘in’ have any actual meaning? Are there other keywords that may appear there?

  • 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-04T01:44:04+00:00Added an answer on June 4, 2026 at 1:44 am

    in means the generic parameter is contravariant. This means, in this case, that you can assign a Comparison<Base> to a Comparison<Derived>.

    You can do this, because a Comparison<Derived> variable can accept a method which takes Base type parameters. When you call a Comparison<Derived>, you need to pass Derived variables, which happen to be valid parameters to a method accepting Base parameters. This means that it makes sense to assign a Comparison<Base> to a Comparison<Derived>.

    The opposite of in is (naturally) out. This means the parameter is covariant, and can assign a Derived generic to a Base generic. This would be used, for example, in specifying the return type of a delegate.

    A handy way of remembering which is which:

    in should only be used for types that are only passed in. out should only be used for types that are only passed out.

    Read more here:

    in (Generic Modifier) (C# Reference)

    Covariance and Contravariance (C# and Visual Basic)

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

Sidebar

Related Questions

According to the docs: http://msdn.microsoft.com/en-us/library/x13ttww7.aspx : The volatile keyword can be applied to reference
The docs http://msdn.microsoft.com/en-us/library/ms597043%28v=VS.96%29.aspx state the System.Windows.Clipboard should be available in Windows Phone 7.1. I
So I was reading over the MSDN docs and came across: http://msdn.microsoft.com/en-us/library/sf0df423.aspx What is
MSDN reference: [1] http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx#Y1178 From the link it says that the first argument will
The process is explained here: http://msdn.microsoft.com/en-US/library/d1ae6tz5%28v=VS.80%29.aspx What I don't get from that article is
I am trying to follow this example: http://msdn.microsoft.com/en-us/library/aa179614%28SQL.80%29.aspx# It says to add the following
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them
MSDN docs say that only value types need boxing, but this does not apply
The MSDN docs state that I can find the WCF Test Client in: C:\Program
MSDN has the functionality I'm looking for here . Since microsoft recognizes the usefulness

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.