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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:54:55+00:00 2026-06-07T16:54:55+00:00

I have the following classes: public interface IWaybillDocument { long DocumentId { get; set;

  • 0

I have the following classes:

 public interface IWaybillDocument
    {
        long DocumentId { get; set; }
        long BillingDocumentId { get; set; }

        string ShipToName { get; set; }
        byte AddressType { get; set; }
        string City { get; set; }
        string Country { get; set; }
        string PostCode { get; set; }
        string StateRegion { get; set; }
        string Street1 { get; set; }
        string Street2 { get; set; }
        string Suburb { get; set; }

        void MergeAddressing(Address address);
    }
}

    public class WaybillDocumentList : ERPListBase<IWaybillDocument>
    {
        public WaybillDocumentList() : base() { }
    }

 public partial class WaybillDocument : IWaybillDocument, INonrepudiable
    {

        public void MergeAddressing(Address address)
        {
            address.Street1 = this.Street1;
            address.Street2 = this.Street2;
            address.Suburb = this.Suburb;
            address.City = this.City;
            address.ZipCode = this.PostCode;
            address.StateRegion = this.StateRegion;
            address.Country = this.Country;
            address.AddressKind = (AddressKind)this.AddressType;
        }
    }

They all compile nicely but when trying to apply this extension method:

 public static EntitySet<T> ToEntitySetFromInterface<T, U>(this IList<U> source)
            where T : class, U
        {
            var es = new EntitySet<T>();
            IEnumerator<U> ie = source.GetEnumerator();
            while (ie.MoveNext())
            {
                es.Add((T)ie.Current);
            }
            return es;
        }

Like this:

public void InsertWaybills(WaybillDocumentList waybills)
        {
            try
            {
                ;
                this.Context.WaybillDocuments.InsertAllOnSubmit(waybills.ToEntitySetFromInterface<WaybillDocument, IWaybillDocument>());
                this.Context.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new DALException("void InsertWaybills(WaybillList waybills) failed : " + ex.Message, ex);
            }
        }

I get a compilation error

The type ‘WaybillDocument’ cannot be used as type parameter ‘T’ in the
generic type or method
‘LinqExtensions.ToEntitySetFromInterface(System.Collections.Generic.IList)’.
There is no implicit reference conversion from ‘WaybillDocument’ to
‘IWaybillDocument’

with

waybills.ToEntitySetFromInterface<WaybillDocument, IWaybillDocument>()

underlined. Why is that when it clearly inherits the interface?

UPDATE: ERPListBase (details removed)

public class ERPListBase<T> : List<T>
{
    public ERPListBase()
        : base() {}
}
  • 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-07T16:54:57+00:00Added an answer on June 7, 2026 at 4:54 pm

    I’ve pasted your code to new project and with small modifications like ERPListBase -> List and it compiles. So my guess would be that you have two interfaces named IWaybillDocument and you are referencing wrong one of them somewhere.

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

Sidebar

Related Questions

I have the following set of Interfaces and Classes. public interface IValidatableObject { List<string>
I have following Classes and interfaces.. public interface ITaggable { ICollection<Tag> Tags { get;
I have following classes: public abstract class CustomerBase { public long CustomerNumber { get;
I have the following classes: public interface IRenderer<T> { string Render(T obj); } public
I have the following classes: public interface IServiceA { string MethodA1(); } public interface
I have the following two classes: public class Address { public string AddressLine1 {
I have the following classes [XmlRoot] public class AList { public List<B> ListOfBs {get;
Example, I have the following interface and classes: public interface IRole { DateTime Since
I have this following interface : public interface FruitDetails { public String getFruitName(); }
I have the following classes: public interface Emailer {} @Named public class RealEmailer implements

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.