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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:38:25+00:00 2026-06-03T09:38:25+00:00

I am having an issue whereby I cannot use an objects method because of

  • 0

I am having an issue whereby I cannot use an objects method because of this error:

Does not contain a definition…and no extension method…

It is very related to this question. I am doing what is given as the answer in that question, but I am still getting this error.

namespace MyProject.ViewModel
{
    public class NetworkHealthViewModel : ViewModelBase
    {
        private IDataService _dataService;
        public ObservableCollection<NetworkBandwidthModel> NbicNetworkBandwidth
        public ObservableCollection<NetworkPortalStatusModel> NbicNetworkPortalStatus

        public NetworkHealthViewModel()
        {
            _dataService = new DataServiceNetworkHealth();
            NbicNetworkBandwidth       = new ObservableCollection<NetworkBandwidthModel>();
            NbicNetworkPortalStatus    = new ObservableCollection<NetworkPortalStatusModel>();
            _dataService.LoadChartItems(NetworkBandwidthLoaded, NetworkBandwidthLoadedFailed);
            _dataService.LoadPortalStatus(NetworkPortalStatusLoaded, NetworkPortalStatusLoadedFailed);
         }

The error lies at LoadPortalStatus(). LoadChartItems() is fine. NetworkBandwidthLoaded and NetworkPortalStatusLoaded are delegates.

NetworkPortalStatusLoaded is laid out pretty much the same as NetworkBandwidthLoaded:

private void NetworkPortalStatusLoaded(IEnumerable<ChartModel> portalStatItems) 
{
    NbicNetworkPortalStatus.Clear();

    var networkPortalItems = from item in portalStatItems
                             where ((NetworkPortalStatusModel)item).Unit == "Portal"
                             select item;

    foreach (var item in networkPortalItems)
    {
        NbicNetworkPortalStatus.Add((NetworkPortalStatusModel)item);
    }

    Message = "Network Portal details loaded";
}

My DataServiceNetworkHealth class is defined as:

namespace MyProject.DataServices
{
    public class DataServiceNetworkHealth : IDataService
    {
        private Action<IEnumerable<ChartModel>> _delagateSuccess;
        private Action<Exception> _delagateFail;
        private String _portalHtmlResponse;

        public void LoadChartItems(Action<IEnumerable<ChartModel>> success, Action<Exception> fail)
        {
          ....
        }

        public void LoadPortalStatus(Action<IEnumerable<ChartModel>> success, Action<Exception> fail)
        {
          ....
        }
    }
}

Method LoadChartItems() is defined in the interface IDataService, but LoadPortalStatus is not. Perhaps that’s where the problem lies. There are other DataServiceX classes that do not use LoadPortalStatus.

I know this is a long post, but I thought better to give all info up front. 🙂 Thanks for any help!

  • 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-03T09:38:26+00:00Added an answer on June 3, 2026 at 9:38 am

    Your reference to _dataService is of the type IDataService, which means that you can only access members defined by this interface (or extension methods for said interfae). You mention that LoadPortalStatus isn’t part of that interface and thus you cannot access it through the _dataService reference.

    Updated based on comment: Let’s look at another example. If you define a List<int> reference like this:

    List<int> i = new List<int>();
    

    you can access all the members of List<T>() and all the members of Object. However, if you change the reference to

    IEnumerable<int> i = new List<int>();
    

    the only accessible members through i are GetEnumerator which is defined on IEnumerable<T> and the members inherited from Object.

    If you include the System.Linq namespace, you also get access to the numerous extension methods defined for IEnumerable<T>.

    The static type of i determines which members are available through that reference.

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

Sidebar

Related Questions

I am having an issue whereby a column within a table of mine has
I am having an issue with a dynamic Ovi / Nokia map whereby I
I'm having issue converting this string to a decimal. I tried to follow the
I seem to be having an odd issue whereby every time I try to
I am having the standard issue timeout exception in my production environment whereby, after
I'm having a problem whereby a loop which is instantiating two objects, which in
I'm currently having a strange issue whereby all browsers except from Google Chrome are
I was having an issue whereby my excel grab was taking the numeric values
I'm building a menu options, having issue in last option, The Anchor method doesn't
I'm having an issue whereby I navigate around my site but when I return

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.