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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:55:47+00:00 2026-05-13T18:55:47+00:00

This is a quick one. I have the following code: foreach (var item in

  • 0

This is a quick one. I have the following code:

foreach (var item in myRepeater.Items)
{
    MyViewModelItem x = new MyViewModelItem();
    MapToEntity(x, item);
    myList.Add(report);
}

void MapToEntity(object entity, Control control);

I expected this code to compile with no problems. It didn’t, however.

It resulted in a compile time error saying that the method “MapToEntity” has some invalid arguments. The compiler failed to infer the type of the RepeaterItem, it recognizes it as a plain System.Object.

Why is this happening? Am I missing something?

Ps: I fixed the code by deleting the var keyword and explicitly defining the type of the item “RepeaterItem”.

  • 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-13T18:55:47+00:00Added an answer on May 13, 2026 at 6:55 pm

    RepeaterItemCollection does not implement IEnumerable<RepeaterItem> just plain IEnumerable. Thus, it’s impossible for the compiler in infer the type.

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

Sidebar

Related Questions

Hopefully this is a really quick one ;) I have written a lexer /
Hopefully this is a quick one! I have an editable grid using 'clientSide' (local)
I'm fairly new to C# but I will try to make this quick! ;)
I'm looking for a quick-and-dirty solution to this, I have to set up a
I was just writing some quick code and noticed this complier error Using the
I have the following code: #include <string.h> int main(void) { char *buffer = NULL,
This should a quick question for some easy rep. I'm doing some PHP Website
A quick Google search of this issue shows it's common, I just can't for
I ended up writing a quick little script for this in Python, but I
In SQL server 2005 this query select len(cast('the quick brown fox jumped over 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.