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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:21:53+00:00 2026-05-12T19:21:53+00:00

When converting a project (in which a template method of IComparable was used a

  • 0

When converting a project (in which a template method of IComparable was used a few times) from VS 2005 to VS 2008 I’ve got some errors:

Error 12 Type argument 'Object' does not inherit from or implement 
the constraint type 'System.IComparable'.

Is this an actual fact that System.Object no longer implements that interface, or something went wrong during the convertion? Can I fix this somehow?

The problem is with the following method:

Public Function ValueIn(Of T As IComparable)(ByVal pValue As T, ByVal ParamArray pArgs() As T) As Boolean
    For Each MyArg As T In pArgs
        If pValue.CompareTo(MyArg) = 0 Then
            Return True
        End If
    Next
    Return False
End Function

and even something simple like:

Dim a as Object = 1
ValueIn(a,1,2)

causes the error mentioned above. It worked perfectly in VS 2005, so what can be the problem now?

  • 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-12T19:21:54+00:00Added an answer on May 12, 2026 at 7:21 pm

    EDIT: I have just tried your code in both VS 2005 and 2008.

    You have Option Strict Off configured in your project or source code file. Your code never worked in the first place, and if you set Option Strict On in VS 2005, you will see the real cause of the error, which is “Type argument inference failed for type parameter ‘T'”. I recommend that Option Strict On be used in all VB.NET code.

    You see a different error in VS 2008 because it is using a newer version of the language, with very different overloading and type inference rules. In VB.NET 2008, the compiler cannot resolve the method call regardless of whether Option Strict is on or off.

    The System.Object type does not and has never implemented any interface.

    The setting of Option Infer in VS 2008 is not relevant to your code because it does not make use of any inferred types.

    The simplest way to fix the error in both IDEs is to change the calling code thus:

        Dim a As Integer = 1
        ValueIn(a, 1, 2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am to edit a project of another guy who used php short tag
We have a .Net 2.0 web app and are converting the solution and projects
I'm working on a project that has a lot of legacy C code. We've
While I know nothing about SSL or installing SSL Certificates, I'm sure one of
While I know nothing about SSL or installing SSL Certificates, I'm sure one of
I've been programming a while now at school, and I'm working on my first
I'm translating an Ant script to Maven 2 and I have this problem: the
I am looking for a way to have the generated proxy class for a
New to maven and equinox. While going through a tutorial on OSGi, I issued
I'm trying to make a subclassed UITableViewCell where I draw an image in the

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.