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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T09:20:25+00:00 2026-06-06T09:20:25+00:00

I have the following class: private class NodeTemp { public string Content; public NodeTemp

  • 0

I have the following class:

    private class NodeTemp
    {            
        public string Content;
        public NodeTemp Next;
        public NodeTemp Prev;
    }

as you can see I have NodeTemp Next in order to be able to have a reference to the next element on the hash table just like the NodeTemp Prev will have a reference to the previos element on the hash table.

So I have a very large “xml” like text file that I have to parse. I looks something like:

<1><a5>: Abbrev Number: 2 (DW_TAG_base_type)
    <a6>   DW_AT_name        : unsigned short   
    <b5>   DW_AT_byte_size   : 2    
    <b6>   DW_AT_encoding    : 7    (unsigned)
 <1><b7>: Abbrev Number: 2 (DW_TAG_base_type)
    <b8>   DW_AT_name        : unsigned int 
    <c5>   DW_AT_byte_size   : 4    
    <c6>   DW_AT_encoding    : 7    (unsigned)
 <1><c7>: Abbrev Number: 2 (DW_TAG_base_type)
    <c8>   DW_AT_name        : unsigned char    
    <d6>   DW_AT_byte_size   : 1    
    <d7>   DW_AT_encoding    : 8    (unsigned char)
 <1><d8>: Abbrev Number: 4 (DW_TAG_pointer_type)
    <d9>   DW_AT_type        : DW_FORM_ref4 <0x552> 
 <1><de>: Abbrev Number: 2 (DW_TAG_base_type)
    <df>   DW_AT_name        : void 
    <e4>   DW_AT_byte_size   : 0    
    <e5>   DW_AT_encoding    : 5    (signed)
 <1><e6>: Abbrev Number: 4 (DW_TAG_pointer_type)
    <e7>   DW_AT_type        : DW_FORM_ref_udata <0xde> 
 <1><ea>: Abbrev Number: 4 (DW_TAG_pointer_type)
    <eb>   DW_AT_type        : DW_FORM_ref4 <0x180> 
 <1><f0>: Abbrev Number: 4 (DW_TAG_pointer_type)
    <f1>   DW_AT_type        : DW_FORM_ref4 <0x4cb> 
 <1><f6>: Abbrev Number: 4 (DW_TAG_pointer_type)
    <f7>   DW_AT_type        : DW_FORM_ref4 <0x4efb>    
 <1><fc>: Abbrev Number: 2 (DW_TAG_base_type)
    <fd>   DW_AT_name        : char 
    <102>   DW_AT_byte_size   : 1   
    <103>   DW_AT_encoding    : 8   (unsigned char)
.....
....

I have a method that will search through it and return me one chunk at a time. The reason why I am creating a Dictionary<string, NodeTemp> instead of a List<NodeTemp> is for performance cause I have to make several queries in order to look for the node that I need.

so what I have right now is:

var mtch = Regex.Match(GetUnparsedDebugInfo(), @"(?s)<\d+><\w+>.*?(?=\n <)");

int ctr = 0; // counter                       
NodeTemp[] nodes = new NodeTemp[3]; // circular array

while (mtch.Success)
{

    /*  mtch.value should = something like:

              <1><a5>: Abbrev Number: 2 (DW_TAG_base_type)
                <a6>   DW_AT_name        : unsigned short   
                <b5>   DW_AT_byte_size   : 2    
                <b6>   DW_AT_encoding    : 7    (unsigned)

    */

    var index = ctr % 3; // current possition in circular array

    //get key
    var k = Regex.Match(mtch.Value, @"><(\w+)>").Groups[1].Value;

    var cNode = new NodeTemp() { Content = mtch.Value };                           

    dictionary.Add(k, cNode);

    nodes[index] = cNode;

    if (ctr > 0)
    {
        var lastIndex = index - 1;
        if (lastIndex < 0)
        lastIndex = 2;

        nodes[lastIndex].Next = cNode;
        cNode.Prev = nodes[lastIndex];
    }

    ctr++;

    mtch = mtch.NextMatch();
}

This is not working because nodes[index] contains a reference to a object and at the end if I change it it will change all. How can I fix this while loop? I don’t want to create a List then convert that large list to a dictionary. I think that will not be efficient.

Or maybe I can create some other type of data sctucture that will enable me to query quickly for the node that I need and I will also be able to maintain the order.

  • 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-06T09:20:27+00:00Added an answer on June 6, 2026 at 9:20 am

    I think what you may need is an OrderedDictionary. Take a look at: http://msdn.microsoft.com/en-us/library/system.collections.specialized.ordereddictionary.aspx

    Looks like theres also one which uses generics, havent tried it though.
    http://www.codeproject.com/Articles/18615/OrderedDictionary-T-A-generic-implementation-of-IO

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

Sidebar

Related Questions

I have the following abstract class: public abstract class AbstractGroup { private String name;
I have the following class: private class Info{ public String A; public int B;
We have the following class public class TemporalData<T> { private T data; private String
I have the following class: public class Message { private String text; public String
I have following class public class ButtonChange { private int _buttonState; public void SetButtonState(int
I have the following class structure public class Outer{ private Mapper a; .... private
Well, I have the following class definitions: private ObservableCollection<Node> _Nodes; public ObservableCollection<Node> Nodes {
If I have the following registry class: Class registry { private $_vars; public function
I have the following class: class MySQLDatabase { private $connection; public $last_query; private $magic_quotes_active;
I have the following class class Singleton { private: static Singleton *p_inst; Singleton(); public:

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.