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

  • Home
  • SEARCH
  • 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 8767915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:56:19+00:00 2026-06-13T16:56:19+00:00

For parsing SDP information from an RTSP, currently I use default c# string functions

  • 0

For parsing SDP information from an RTSP, currently I use default c# string functions (like loop the string line by line) and foreach/switch methods. Default SDP information comes from a device in this form:

v=0
o=mhandley 2890844526 2890842807 IN IP4 126.16.64.4
s=SDP Seminar
i=A Seminar on the session description protocol
u=http://www.cs.ucl.ac.uk/staff/M.Handley/sdp.03.ps
e=mjh@isi.edu (Mark Handley)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 3456 RTP/AVP 0
m=video 2232 RTP/AVP 31
m=whiteboard 32416 UDP WB
a=orient:portrait

Im wondering is this string is query-able using LINQ or something instead of foreaching each line, switching the first character and then storing the rest as a value, because this method is very sensitive to malfunction and error (like when 2 attributes/params are on 1 line or the first character isn’t accidentally the right one (e.g. with a space before)). Before I begin to cover every damn exception than can occur, I’m wondering if there’s a technique to query a string for values/keys using LINQ.

  • 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-13T16:56:20+00:00Added an answer on June 13, 2026 at 4:56 pm
    var query = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(line => line.Split('='))
                    .GroupBy(x => x[0], x => x[1])
                    .Select(g => new { Key = g.Key, Values = g.ToList() });
    

    This will return entries grouped by key with values as list.

    Or this way (if Linq Lookup is OK for you):

    var lookup = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)
                     .Select(line => line.Split('='))
                     .ToLookup(x => x[0], x => x[1]);
    

    Usage:

    foreach (var value in lookup["m"])
        // use value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not parsing the parameters in the beginning but parse the input string read from
I have question about parsing in Html helper : I have sth like: @foreach
After parsing the JSON response from a webservice using NSJSONSerialization , I use +isKindOfClass:
When parsing a PDF, given a string (popped from the Tj or TJ operator
I'm parsing text from a file and storing it in a string. The problem
I'm parsing a long string and want to use a regular expression for part
Parsing the string message seems bad. Or was this exception not meant to be
When parsing an xml file in android, I'm doing like this: try { InputStream
I have a problem parsing a XML file which contains special characters like ,
I'm parsing a date from a JSON event feed - but the date shows

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.