G
Guest
Hi all,
What is fastest way removing duplicated value from string array using vb.net?
Here is what currently I am doing but the the array contains over 16000
items. And it just do it in 10 or more minutes.
'REMOVE DUBLICATED VALUE FROM ARRAY +++++++++++++++++
Dim col As New Scripting.Dictionary
Dim ii As Integer = 0
For ii = 0 To DTHESNO_ARRAY.Length - 2
If Not col.Exists(CStr(DTHESNO_ARRAY(ii))) Then
col.Add(CStr(DTHESNO_ARRAY(ii)), ii)
End If
Next
ReDim _DTHESNOKR102A(col.Count - 1)
'ASSIGN NONE DUPLIATED VALUT TO STRING ARRAY ++++++++
Dim iii As Integer = 0
For iii = 0 To col.Count - 1
_DTHESNOKR102A(iii) = col.Keys(iii)
Next
'NOW SORT THE STRING ARRAY ++++++++++++++++++++++++++
Array.Sort(_DTHESNOKR102A)
col = Nothing
Is it possible to clone the col to the _DTHESNOKR102A(col.Count - 1)
Thank you very much for reading my post.
Rgds,
GC
What is fastest way removing duplicated value from string array using vb.net?
Here is what currently I am doing but the the array contains over 16000
items. And it just do it in 10 or more minutes.
'REMOVE DUBLICATED VALUE FROM ARRAY +++++++++++++++++
Dim col As New Scripting.Dictionary
Dim ii As Integer = 0
For ii = 0 To DTHESNO_ARRAY.Length - 2
If Not col.Exists(CStr(DTHESNO_ARRAY(ii))) Then
col.Add(CStr(DTHESNO_ARRAY(ii)), ii)
End If
Next
ReDim _DTHESNOKR102A(col.Count - 1)
'ASSIGN NONE DUPLIATED VALUT TO STRING ARRAY ++++++++
Dim iii As Integer = 0
For iii = 0 To col.Count - 1
_DTHESNOKR102A(iii) = col.Keys(iii)
Next
'NOW SORT THE STRING ARRAY ++++++++++++++++++++++++++
Array.Sort(_DTHESNOKR102A)
col = Nothing
Is it possible to clone the col to the _DTHESNOKR102A(col.Count - 1)
Thank you very much for reading my post.
Rgds,
GC