Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: End of line Pin
T Manjaly23-Mar-04 16:05
T Manjaly23-Mar-04 16:05 
GeneralRe: End of line Pin
Nguyen Vu Cuong23-Mar-04 16:42
Nguyen Vu Cuong23-Mar-04 16:42 
GeneralDesktop Control Pin
Member 69108923-Mar-04 15:04
Member 69108923-Mar-04 15:04 
GeneralRe: Desktop Control Pin
Heath Stewart23-Mar-04 18:08
protectorHeath Stewart23-Mar-04 18:08 
GeneralRe: Desktop Control Pin
Anonymous24-Mar-04 14:09
Anonymous24-Mar-04 14:09 
GeneralRe: Desktop Control Pin
Heath Stewart24-Mar-04 17:00
protectorHeath Stewart24-Mar-04 17:00 
GeneralDistinct - DataView/DataTable Pin
Ruchi Gupta23-Mar-04 13:57
Ruchi Gupta23-Mar-04 13:57 
GeneralRe: Distinct - DataView/DataTable Pin
Heath Stewart23-Mar-04 14:09
protectorHeath Stewart23-Mar-04 14:09 
The best way is to use the DISTINCT keyword in your SQL statement that fills the DataSet (which contains the DataTable) or the DataTable, but if for some reason you can't you could try a couple different ways.

The default implementation does support getting distinct values as a simple method call, but you could either sort the DataView, enumerate it and skip adjacent duplicates; or keep a look-up table of what you've already enumerated and compare that as you enumerate your DataTable. In most cases, the former method would be faster and would consume less space.

If you use a look-up table, consider a Hashtable with the distinct field as the key and a reference to your DataRow as the value (it'll be a reference, not a copy, making retrieval faster...unless you clone).

 

Microsoft MVP, Visual C#
My Articles
GeneralRe: Distinct - DataView/DataTable Pin
Ruchi Gupta23-Mar-04 14:41
Ruchi Gupta23-Mar-04 14:41 
GeneralRe: Distinct - DataView/DataTable Pin
Heath Stewart23-Mar-04 18:00
protectorHeath Stewart23-Mar-04 18:00 
GeneralXML Serialization and ArrayLists Pin
raindog23-Mar-04 13:23
raindog23-Mar-04 13:23 
GeneralRe: XML Serialization and ArrayLists Pin
Heath Stewart23-Mar-04 13:45
protectorHeath Stewart23-Mar-04 13:45 
GeneralWindows XP P2P SDK wrapped in .Net Pin
schnee2k323-Mar-04 13:03
schnee2k323-Mar-04 13:03 
GeneralRe: Windows XP P2P SDK wrapped in .Net Pin
Heath Stewart23-Mar-04 13:34
protectorHeath Stewart23-Mar-04 13:34 
GeneralRe: Windows XP P2P SDK wrapped in .Net Pin
schnee2k323-Mar-04 13:40
schnee2k323-Mar-04 13:40 
GeneralRe: Windows XP P2P SDK wrapped in .Net Pin
Matthew Hazlett23-Mar-04 14:48
Matthew Hazlett23-Mar-04 14:48 
GeneralRe: Windows XP P2P SDK wrapped in .Net Pin
leppie24-Mar-04 6:17
leppie24-Mar-04 6:17 
GeneralRe: Windows XP P2P SDK wrapped in .Net Pin
schnee2k324-Mar-04 13:07
schnee2k324-Mar-04 13:07 
QuestionHow to change url of running iexplorer instance? Pin
ckl_8823-Mar-04 12:47
ckl_8823-Mar-04 12:47 
AnswerRe: How to change url of running iexplorer instance? Pin
Heath Stewart23-Mar-04 13:01
protectorHeath Stewart23-Mar-04 13:01 
GeneralRe: How to change url of running iexplorer instance? Pin
ckl_8823-Mar-04 13:50
ckl_8823-Mar-04 13:50 
GeneralRe: How to change url of running iexplorer instance? Pin
Heath Stewart23-Mar-04 14:01
protectorHeath Stewart23-Mar-04 14:01 
GeneralStrange problem with ownerdraw listbox Pin
Anders Molin23-Mar-04 12:41
professionalAnders Molin23-Mar-04 12:41 
GeneralRe: Strange problem with ownerdraw listbox Pin
Heath Stewart23-Mar-04 13:05
protectorHeath Stewart23-Mar-04 13:05 
GeneralRe: Strange problem with ownerdraw listbox Pin
Anders Molin23-Mar-04 13:22
professionalAnders Molin23-Mar-04 13:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.