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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:17:27+00:00 2026-05-20T14:17:27+00:00

The below code compiles with .Net Framework 4.0 but not with Silverlight 4.0. I

  • 0

The below code compiles with .Net Framework 4.0 but not with Silverlight 4.0.
I would appreciate if anyone could shed some light on this. Here’re the error messages I’m getting:

Error   1   The best overloaded method match for 'ThinkFarAhead.Confounded.Client.Models.Consumer.SetFunctionalAreas(System.Collections.Generic.IEnumerable<ThinkFarAhead.Confounded.Client.Models.IFunctionalArea>)' has some invalid arguments    c:\Hanu\SilverlightApplication1\Test.cs 64  13  SilverlightApplication1
Error   3   The best overloaded method match for 'ThinkFarAhead.Confounded.Client.Models.Consumer.SetFunctionalAreas(System.Collections.Generic.IEnumerable<ThinkFarAhead.Confounded.Client.Models.IFunctionalArea>)' has some invalid arguments    c:\Hanu\SilverlightApplication1\Test.cs 65  13  SilverlightApplication1
Error   2   Argument 1: cannot convert from 'ThinkFarAhead.Confounded.Web.EntitySet<ThinkFarAhead.Confounded.Web.FunctionalArea>' to 'System.Collections.Generic.IEnumerable<ThinkFarAhead.Confounded.Client.Models.IFunctionalArea>'   c:\Hanu\SilverlightApplication1\Test.cs 64  47  SilverlightApplication1
Error   4   Argument 1: cannot convert from 'ThinkFarAhead.Confounded.Web.EntitySet<ThinkFarAhead.Confounded.Web.FunctionalArea>' to 'System.Collections.Generic.IEnumerable<ThinkFarAhead.Confounded.Client.Models.IFunctionalArea>'   c:\Hanu\SilverlightApplication1\Test.cs 65  47  SilverlightApplication1

What I’m trying to do:
Extend generated entities (RIA) on Silverlight (4.0) side to make multiple entities with common features share the same interface (A control needs to use multiple objects the same way. These objects are pretty much the same).

Thanks in advance.

using System;
using System.Collections;
using System.Collections.Generic;
using ThinkFarAhead.Confounded.Client.Models;
using ThinkFarAhead.Confounded.Web;


namespace ThinkFarAhead.Confounded.Web
{

    public class Entity { }

    public class EntitySet<T> : IEnumerable<T>, IEnumerable where T : Entity
    {
        List<T> list = new List<T>();
        public IEnumerator<T> GetEnumerator()
        {
            return (IEnumerator<T>)list;
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        public void Add(T newone)
        {
            list.Add(newone);
        }
    }

    public partial class FunctionalArea : Entity
    {
        public string Name { get; set; }
    }

    public partial class FunctionalArea : IFunctionalArea { }

}

namespace ThinkFarAhead.Confounded.Client.Models
{


    public interface IFunctionalArea
    {
        string Name { get; set; }
    }


    public class Variance
    {
        public static EntitySet<FunctionalArea> FunctionalAreas
        {
            get
            {
                return new EntitySet<FunctionalArea>();
            }
        }

        public static void Main()
        {
            var abc = new EntitySet<FunctionalArea>();
            new Consumer().SetFunctionalAreas(abc);
            new Consumer().SetFunctionalAreas(FunctionalAreas);
        }
    }

    public class Consumer
    {

        public void SetFunctionalAreas(IEnumerable<IFunctionalArea> areas)
        {
        }
    }
}
  • 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-20T14:17:28+00:00Added an answer on May 20, 2026 at 2:17 pm

    As Austin said in SL4 you can’t just pass your collection with type IEnumerable<FunctionalArea> as parameter when your method expects a IEnumerable<IFunctionalArea>.

    But if you don’t want to go ‘dynamic’, don’t forget you can still do this (using System.Linq) :

    var abc = new EntitySet<FunctionalArea>();
    new Consumer().SetFunctionalAreas(abc.Cast<IFunctionalArea>());
    new Consumer().SetFunctionalAreas(FunctionalAreas.Cast<IFunctionalArea>());
    

    Not quite elegant, but hey, that does the trick 😉

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

Sidebar

Related Questions

The code below compiles, but has different behavior for the char type than for
I would like to know how to modify the below code to strip =20
Code below does not run correctly and throws InvalidOperationExcepiton . public void Foo() {
I have these classes in C# (.NET Framework 3.5) described below: public class Base
I've found this odd case of some code (below) doesn't compile under Visual Studio
When running the below code a type is never returned, despite there being a
In the below code snippet can i replace char * to const char *
I have the below code in stdafx.h. using namespace std; typedef struct { DWORD
In the below code sample, what does {0:X2} mean? This is from the reflection
In the below code, the ListBox gets filled with the names of the colors

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.