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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:02:02+00:00 2026-06-14T23:02:02+00:00

in C# class ListMap<K, E> : ImyMap<K, E>, IComparable<K>, IEnumerable<KeyValuePair<K, E>> { } in

  • 0

in C#

class ListMap<K, E>
    : ImyMap<K, E>, IComparable<K>, IEnumerable<KeyValuePair<K, E>>
{
}

in Java

class MyListMap<K extends Comparable<? super K>, E>
    implements MyMap<K,E>, Iterable<KeyValuePair<K, E>>
{
}

Just trying to convert some data structures from Java into C# and wanted to know if my C# implementation is equal to my Java one.

If not can you please correct it?

  • 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-14T23:02:03+00:00Added an answer on June 14, 2026 at 11:02 pm

    No, those are not equal. The K extends ... portion needs to be translated into a constraint:

    class ListMap<K, E>
        : ImyMap<K, E>, IEnumerable<KeyValuePair<K, E>>
       where K : IComparable<K>
    {
    }
    

    The wildcard ? super K is not necessary in C#. Wildcards are Java’s way to support co/contravariance. In C#, this is done as part of the interface declaration:

    interface IComparable<in K> { ... }
    

    The in modifier makes the interface contravariant, which has the same effect as the wildcard in Java.

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

Sidebar

Related Questions

class GoogleMusicAdapter extends TestFragmentAdapter implements TitleProvider { public GoogleMusicAdapter(FragmentManager fm) { super(fm); } @Override
class a{ public void foo(int a){ System.out.println(super); } } class b extends a{ public
class Test extends JPanel implements MouseListener { private JButton b1, b2, b3, b4; public
class A(object): _all = set() def __new__(cls): obj = super(A,cls).__new__(cls) cls._all.add(obj) return obj class
class Model_Core_NodeContents extends Zend_Db_Table_Abstract { protected $_name = 'node_contents'; protected $_referenceMap = array( Page
I have two Java classes: LogEntry and Record . The LogEntry class has a
class A{ const FOO = 1; } class B extends A{ const FOO =
class X extends Map[String, String] { def x(): X = { X() } //
class MyTabsListener implements ActionBar.TabListener { public Fragment fragment; public MyTabsListener(Fragment fragment) { this.fragment =
class TaskManager(models.Manager): def get_query_set(self): return super(TaskManager, self).get_query_set().filter(Owner='jim') class Task(models.Model): Name = models.CharField('Title', max_length=200) Notes

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.