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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:10:16+00:00 2026-06-11T04:10:16+00:00

I have a file containing likes written like this: [NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE]. E.g.:

  • 0

I have a file containing likes written like this:

[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].

E.g.:

[Person]: [Age]-[21], [HairColor]-[Turqoise], [Gender]-[Other].

While I’m familiar with Linq, I’m having a lot of trouble figuring out how I would parse this, using Linq.

I’d like to be able to just go over all the lines:

[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].
[NAME]: [PROPERTY]-[VALUE], [PROPERTY]-[VALUE], [PROPERTY]-[VALUE].

… And do something with each person retrieved.

Any ideas? Any help at all will be much appreciated.

  • 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-11T04:10:18+00:00Added an answer on June 11, 2026 at 4:10 am

    Here is an example, if I’ve got what you need correctly, of course:

            File.ReadAllLines("Utils.txt")
                .Select(s => new
                {
                    Name = s.Substring(1, s.IndexOf("]:") - 1),
                    Values = s.Substring(s.IndexOf(":") + 2)
                              .Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries)
                              .ToDictionary(l => l.Substring(1, l.IndexOf("]-") - 1),
                                            l => l.Substring(l.IndexOf("-[") + 2).Trim(']'))
                })
                .ToList()
                .ForEach(o =>
                    {
                        Console.WriteLine(o.Name);
                        o.Values.ToList().ForEach(p => Console.WriteLine(string.Format("\t{0}:\t{1}", p.Key, p.Value)));
                    });
    

    So, here you get a list of anonymous objects with two properties:

    1. Name just a string
    2. Values – a dictionary of pairs where a key is your property and a value is your value

    In my example I do a simple loop through what I’ve read, printing it into the console

    The content of the test file (Utils.txt) was the following:

    [NAME]: [PROPERTY1]-[VALUE1], [PROPERTY2]-[VALUE2], [PROPERTY3]-[VALUE3] 
    [Person]: [Age]-[21], [HairColor]-[Turqoise], [Gender]-[Other]
    

    The output:

    NAME
        PROPERTY1:  VALUE1
        PROPERTY2:  VALUE2
        PROPERTY3:  VALUE3
    Person
        Age:    21
        HairColor:  Turqoise
        Gender: Other
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml file containing certain expressions like this :- 1. AAaaaaa-1111 2.
I have a text file containing entries like this: @markwarner VIRGINIA - Mark Warner
I have written a very simple file managing database that basicly looks like this:
I have 1 text file containing Ips .Like this iptextfile.txt 10.0.0.1 192.168.1.1 123.123.123.123 And
i have a .txt file containing data like: He: 22.1 Ar: 21.1 K: 1.22
I have a XML file containing metadata like a field's maximum length. I have
I have a file containing substituted variables ( #{...} ) and I would like
I have a text file containing words separated by newline , like the following
I have to filter a text file filter.tmp containing two types of lines, this
I have written a program which reads a file containing multidimensional data (most commonly

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.