I do something like this:
Expand|Select|Wrap|Line Numbers
- DataTable ToBeInserted = FunctionThatReturnsDataTable();
- Cache.Insert("CacheTable", ToBeInserted);
- public DataTable function()
- {
- DataTable Results = (DataTable)Cache[CacheTable];
- Results.Columns.Add("Rank");
- return Results;
- }
Shouldn't "Results" be a new DataTable instance? I'm unintentionally adding the column to the Cached item. I just want a copy of the cached datatable to alter and return. When I run the function, I want to create the Results table all over again and modify it without altering the cached datatable.
Any ideas?