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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:25:55+00:00 2026-05-23T04:25:55+00:00

I’m getting a strange error in VS 2010. I have a project set to

  • 0

I’m getting a strange error in VS 2010. I have a project set to use .NET Framework 4. When I type the code:

var record = ...;

// returns IEnumerable<Staff>
var staff = new StaffRepository().GetAll(); 

// The method has two signatures:
// CreateSelectList(IEnumerable<object> enumerable, string value)
// CreateSelectList(IDictionary<object, object> enumerable, string value)
StaffList = SelectListHelper.CreateSelectList(staff, record.Staff);

CreateSelectList basically takes an enumerable of objects, converts them to strings using ToString(), and then auto-selects the string passed.

The problem is, this code gets a red underline in VS 2010 with an error saying that it cannot resolve the method.

However, if I change the code to explicitly say the type:

IEnumerable<Staff> staff = new StaffRepository().GetAll();
StaffList = SelectListHelper.CreateSelectList(staff, record.Staff);

VS 2010 no longer gives the error. My understand of generics is that these two fragments of code should be the same to the compiler, so why is it giving me an error underline?

Also:

This will also fix the problem:

var staff = new StaffRepository().GetAll();
StaffList = SelectListHelper.CreateSelectList(from s in staff select s, record.Staff);

ReSharper:

I’ve tried deleting my _ReSharper directory, but no luck. I still get the underline. However, if I suspend (i.e. turn off) ReSharper, the red underline goes away so it’s definitely being caused by ReSharper.

Code:

As requested, here’s the code.

Here’s StaffRepository:

namespace Foo.Client.Business.Repositories {
    public class StaffRepository : StaffRepositoryBase<Staff, StaffCriteria, Discriminator> {

        public StaffRepository(Discriminator discriminator) : base(discriminator) {
        }

        protected override Staff CreateStaff(MembershipUser user) {
            return new Staff(user);
        }

    } // end class
}

Here’s StaffRepositoryBase (where GetAll is defined):

namespace Foo.Common.Business.Repositories {
    public abstract class StaffRepositoryBase<TStaff, TStaffCriteria, TDiscriminator> 
        : IStaffRepository<TStaff, TStaffCriteria, TDiscriminator>
        where TStaff : class, IStaff<TDiscriminator>
        where TStaffCriteria : class, IStaffCriteria {
        ...

        protected abstract TStaff CreateStaff(MembershipUser user);

        public virtual IEnumerable<TStaff> GetAll() {
            return from u in Membership.GetAllUsers().Cast<MembershipUser>()
                   let s = CreateStaff(u)
                   where s.Discriminator.Equals(Discriminator)
                   select s;
        }

        public virtual IEnumerable<TStaff> GetAll(LimitCriteria criteria) {
            var staffs = GetAll()
                .Skip(criteria.Skip.GetValueOrDefault())
                .Take(criteria.Take.GetValueOrDefault());

            return staffs;
        }

        public virtual IEnumerable<TStaff> GetAll() {
            return from u in Membership.GetAllUsers().Cast<MembershipUser>()
                   let s = CreateStaff(u)
                   where s.Discriminator.Equals(Discriminator)
                   select s;
        }

        ...
    }
}
  • 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-23T04:25:56+00:00Added an answer on May 23, 2026 at 4:25 am

    You have stated in the comments the project in question was previously targeting .NET3.5.

    For a project targeting .NET 3.5 Resharper will underline in the fashion that you describe. Given you are now targeting .NET4, Resharper still thinks you’re in .NET3.5 for some reason.

    You could try

    1. Clear the Resharper cache (Resharper -> Options -> Environment/General -> Clear Caches)
    2. Recreate the project (csproj) file as a .NET4 project from the start
    3. Use Resharper 6.0 Beta (just out) as it doesnt appear to have this issue
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a JSP page retrieving data and when single or double quotes are
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.