Click here to Skip to main content
15,899,313 members

Comments by kbrandwijk (Top 90 by date)

kbrandwijk 16-Aug-15 9:52am View    
As I guess you are using a DataReader to fill a DataTable, add a column to your DataTable with an Expression, see http://www.codeproject.com/Articles/447249/Calculated-Columns-in-NET-DataTables-Csharp for an example. Then bind that column as any other column.
kbrandwijk 16-Aug-15 9:43am View    
I have already described that in my comment above as well. Please try it out yourself, and if you get stuck somewhere, please post back here with a specific question.
kbrandwijk 16-Aug-15 9:24am View    
That really depends on the situation. I would use ToString() if what you're after is a simple human readable representation of your class (as the documentation states) for either GUI or dev/debug purposes. In your case, you want all properties of a class presented in a certain way, so I would use a separate method, and not use the ToString() override. But it all comes down to personal preference.
kbrandwijk 16-Aug-15 7:35am View    
That is possible, or again, create an abstract method for this in the base class (ExecuteSpecificMethods()) and override this method in the inherited classes. Then, you can just always call the ExecuteSpecificMethods method on every item in the list without type checking etc. Again, knowledge about the implementation should be put as close as possible to the implementation, in this case, in the inherited classes themselves, and preferably not where you process the list.
If this approach works for you, then please accept my solution as the answer to your question.
kbrandwijk 15-Aug-15 21:05pm View    
Duplicate of http://www.codeproject.com/Questions/1018520/How-do-I-pass-this-total-to-textblock-in-another-x