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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:07:43+00:00 2026-05-11T05:07:43+00:00

I have got a collection. The coll has strings: Location=Theater=2, Name=regal, Area=Area1 and so

  • 0

I have got a collection. The coll has strings:

Location='Theater=2, Name=regal, Area=Area1' 

and so on. I have to extract just the Name bit from the string. For example, here I have to extract the text ‘regal’

I am struggling with the query:

Collection.Location.???? (what to add here)

Which is the most short and precise way to do it?

[Edit] : What if I have to add to a GroupBy clause

Collection.GroupBy(????);

  • 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. 2026-05-11T05:07:44+00:00Added an answer on May 11, 2026 at 5:07 am

    Another LINQ-style answer (without the overhead of a dictionary):

    var name = (from part in location.Split(',')             let pair = part.Split('=')             where pair[0].Trim() == 'Name'             select pair[1].Trim()).FirstOrDefault(); 

    re group by (edit):

        var records = new[] {         new {Foo = 123, Location='Theater=2, Name=regal, Area=Area1'},         new {Foo = 123, Location='Name=cineplex, Area=Area1, Theater=1'},         new {Foo = 123, Location='Theater=2, Area=Area2, Name=regal'},     };     var qry = from record in records               let name = (from part in record.Location.Split(',')                           let pair = part.Split('=')                           where pair[0].Trim() == 'Name'                           select pair[1].Trim()).FirstOrDefault()               group record by name;     foreach (var grp in qry)     {         Console.WriteLine('{0}: {1}', grp.Key, grp.Count());     } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got a collection. The coll has strings: Location=Theater=1, Name=regal, Area=Area1 Location=Theater=34, Name=Karm,
I have got a collection of viewModels(InputViewModel) in an other viewModel(ScenarioManager). each InputviewModel has
I have got mongo db using only one collection and consuming average cpu usage
I have got an Entity model which contains a collection of Message objects which
I've got a collection of movies which have various properties (title, release year, rating,
So I am putting together a very simple app and have got a bit
I've got a collection of strings, and I need to know the first index
let's assume I have got a collection of points ( PointCollection ). What I
All, I have been writing some code to attempt to extract a collection of
I have got a big ListBox with vertical scrolling enabled, my MVVM has New

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.