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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:09:51+00:00 2026-05-27T13:09:51+00:00

I am pulling back information about locations from a webservice. The service returns an

  • 0

I am pulling back information about locations from a webservice. The service returns an array of WebObjectsDTOs which holds all of the objects. The objects can be of different types but in this case I’m requesting only objects of type MlaLocation. I then need to orderby the locations name. The problem I ran into was that I cannot do an orderby on searchResult.WebObjectDTOs because it’s the base object and does not have access to the location name.

I thought my solution would be to cast searchResult.WebObjectDTOs to MlaLocationDTO[] since searchResult is only returning an array of MlaLocationDTO. But what I’m seeing in debug is that mlaLocations is being set as null even though searchResult.WebObjectDTOs has objects in it.

MlaWebObjectServiceClient svc = new MlaWebObjectServiceClient();
SearchRequest searchRequest = new SearchRequest(){
    OperatingCompanyId = Guid.Parse("e4be5383-03d0-4a99-9613-6238dd2396ad"), 
    WebObjectType = "MlaLocation"
};
SearchResult searchResult = svc.GetMlaWebObjects(searchRequest);
MlaLocationDTO[] mlaLocations = searchResult.WebObjectDTOs as MlaLocationDTO[];
rptLocationsList.DataSource = mlaLocations.OrderBy(m => m.Name);
rptLocationsList.DataBind();
  • 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-27T13:09:51+00:00Added an answer on May 27, 2026 at 1:09 pm

    Since your collection has many other types of objects, you can safely filter MlaLocationDTO objects using the OfType method:

    var mlaLocations = searchResult.WebObjectDTOs.OfType<MlaLocationDTO>();
    

    If all of the objects were MlaLocationDTO, you can use the Cast method instead:

    var mlaLocations = searchResult.WebObjectDTOs.Cast<MlaLocationDTO>();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Array thats pulling back about 20 sets of items from a
I'm pulling back a Date and a Time from a database. They are stored
In my application I'm pulling back a user's feed. This contains all of that
Possibly related to Git - pulling changes from clone back onto the master I
I am pulling back some data from the twitter query API, and parsing it
I'm having some trouble pulling up relationed objects from my database using Doctrine2 in
I am pulling back a large amount of tabular data that I wish to
I am pulling a long timestamp from a database, but want to present it
I'm pulling email address records from a table in SQL Server 2005, and want
This goes back to my other question which I thought was sufficiently answers but

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.