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 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

Ask A Question

Stats

  • Questions 209k
  • Answers 209k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You also need flash code to build font_name.swf which can… May 12, 2026 at 9:47 pm
  • Editorial Team
    Editorial Team added an answer RemoveStoryboard's primary use is to remove the animated values and… May 12, 2026 at 9:47 pm
  • Editorial Team
    Editorial Team added an answer The biggest one for me is don't concatenate strings: Bad:… May 12, 2026 at 9:47 pm

Related Questions

I have been considering using the code example shown at Shell Style Drag and
In a project we have implemented the data access layer (DAL) with a visual
I am using iTextSharp to convert HTML to PDF and it doesn't seem to
The windows forms control library project (C++) I writes uses an unmanaged dll. The
In my project, I'm using HTML_ToPDF PHP class, which uses html2ps script to convert

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.