Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to select a field by name
Message
From
29/08/2012 03:44:09
 
 
To
28/08/2012 23:45:12
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 4.0
OS:
Windows 7
Miscellaneous
Thread ID:
01551564
Message ID:
01551787
Views:
44
If I understand correctly then my suggestion should work ( but maybe tweaking the Linq query if you need a specific row). As Bonnie suggests a Dictionary is also a possibility - but if the number of 'cached' rows is relatively small then a List would be lighter and also fast enough.

Of course that begs the question of why, if you are moving raw data to XML, you are using datasets at all :-}

>Here's what I'm trying to accomplish: an object (A) contains raw data that needs to be processed and stored in tables. Note that I'm planning on exporting these tables to XML, rather than using SQL Server or something similar. These tables are in a subclassed DataSet. Each column of a table's DataRow is calculated in order, but some of these calculations are dependent on the results of previous columns, either in the DataRow or the matching DataRow of previously processed DataTables. So what I was thinking would work would be this: at the beginning of processing of a particular table, stash its DataRow in A so that anything contained in it is available to a subsequent calculation, whether it is the current DataRow or one from a previously processed table.
>
>The actual storage method of the DataRow repository doesn't matter to me - perhaps a dictionary with the name of the DataRow's table as the key and the DataRow as the value would work.
>
>Comments?
>
>David
>
>
>>Or am I going about this the wrong way?
>>Probably :-}
>>Maybe you could use a collection:
>>public class MyClass()
>>{ 
>>     List<DataRow> stachedRows = new List<DataRow>();
>>
>>    public void AssignRow(DataRow input)
>>    {
>>           stachedRows.Add(input);
>>    }
>>
>>   //To get rows for a specific table:
>>
>>   public IEnumerable<DataRow> GetRowsFromTable(string tablename)
>>  {
>>         return stachedRows.Where(x=>x.Table.TableName==tablename);
>>  }
>>
>>}
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform