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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:44:51+00:00 2026-05-31T02:44:51+00:00

In .Net/C# I have a class that’s derived from List. When I try to

  • 0

In .Net/C# I have a class that’s derived from List. When I try to use the FindNextIndex member of that derived class, I get compile errors like below.

Error 3 Argument 1: cannot convert from ‘method group’ to ‘System.Predicate’

Error 2 The best overloaded method match for ‘System.Collections.Generic.List.FindIndex(System.Predicate)’ has some invalid arguments

Some simplified code is below.

class CTileBag:List<int>
{
    ...
}

Then later I try to use it in another class

CTileBag c = new CTileBag();
int idx = c.FindIndex(IsSwamp);

And IsSwamp is defined in the class I’m using CTile bag in as

private static bool IsSwamp(TerrainType type)
        {
            if (type == TerrainType.TT_FUNGUS_SWAMP)
                return true;
            return false;
        }  
  • 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-31T02:44:53+00:00Added an answer on May 31, 2026 at 2:44 am

    Your predicate takes a TerrainType, but your list is a List<int>. The predicate type depends on the list type. It sounds like your tile bag should actually be a List<TerrainType>, at which point it should work.

    However:

    • I would generally suggest not deriving from List<int>. Prefer composition over inheritance – I suspect it would be better to make your tile bag type contain a List<T>.
    • Follow .NET naming conventions: don’t prefix your classes with C, and make your enum values just PascalCased, like FungusSwamp instead of TT_FUNGUS_SWAMP.
    • Your method body can be simplified to just:

      return type == TerrainType.FungusSwamp;
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

if i have a .net 1.1 class that inherits from DictionaryBase and i am
I have an ASP.NET WebService that returns an object of List public class Students
I have a class that inherits from Exception. In .NET 4, I started receiving
I have a class that inherits from ObservableCollection<T> to re-use the INotifyCollection functionality, but
If I have a .Net class that is not part of any namespace then
I have a class 'Database' that works as a wrapper for ADO.net. For instance,
I have a class in .NET that implements IXmlSerializable. I want to serialize its
Using C# .NET 2.0, I have a composite data class that does have the
I have a .NET class library containing a class with a method that performs
C# question (.net 3.5). I have a class, ImageData, that has a field ushort[,]

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.