CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    7

    Smile net 3.5 ToArray() looking for code equivalent

    Hello,

    i have working code in net 3.5 that uses lumen framworks CSV reader and it works great!

    however, for distribution purposes, i want to go back to net 2.0.

    apparantly the only thing keeping me at net 3.5 is the ToArray() function which is a net 3.5 thing......

    this converts the IEnumerable to string [][] array

    Code:
    
                StreamReader objStreamReader = new StreamReader(openFileDialog1.FileName);
    
                CachedCsvReader csv;
                if (openFileDialog1.FilterIndex == 2)//txt (Tab Delimited)
                {
                    csv = new CachedCsvReader(new StringReader(objStreamReader.ReadToEnd()), true, '\t');
                }
                else
                {
                    csv = new CachedCsvReader(new StringReader(objStreamReader.ReadToEnd()), true);
                }
                if (csv != null)
                {
                    CSVData = csv.ToArray();
    
                 blah blah parse and place in datasource now....

    CSVData is defined as follows

    Code:
     public string[][] CSVData = null;
    what other methods can i use to convert the IEnumerate (string) to the string[][] array without ToArray() and keeping in net 2.0???

    thanks!!

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: net 3.5 ToArray() looking for code equivalent

    It's hard to say without knowing the definition of CachedCsvReader. I found a class similar to that, but with no ToArray method. Instead of possibly wasting time with that, could you just post the source? You should look at how the class stores it's data internally to get a clue.

  3. #3
    Join Date
    Mar 2009
    Posts
    7

    Re: net 3.5 ToArray() looking for code equivalent

    hey thanks for the reply again!!

    its a huge framework...

    actually its a very nice peice of code

    its lumen framework cached CSV reader...

    which has an MIT open license, so you can use as you wish commercially too.


    i was hoping there was an equivalent net 2.0 function, but judging by your response looke like id need a loop implementation which is not what i wanted to do...

    ill just stick with net 3.5 then

    thanks!!


    p.s. youve helped me out twice now... one more time and ill have to pay you hahahah

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: net 3.5 ToArray() looking for code equivalent

    No, no payment required . You can however upvote my reply if you with (the little scale in the top right of a post).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured