Click here to Skip to main content
15,304,711 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
I am new in C# and maybe you can help me.

I have an array with 6 dimension:

string S1,string S2,double d1,double d2,double d3,double d4

The first S1 is the key.

I need something like dictionary but dictionary has only 2 parameters.

I don't know what to use to get something like this:

(S1,S2,d1,d2,d3,d4) on one position.


Wow. Well, arrays have integer indicies so I wouldn't call that technically an array. The double thing is a concern as well as you can end up with fractional rounding errors which if your attempting to use those to look up a value could create misses.

Perhaps one approach would be to create a new class which has all six fields in it. Override the GetHashCode and Equals methods, then use this as the key in a dictionary. This approach will only work well (well not very well at all with doubles) if its a sparsely populated 'cube.'

...unless you mean one dimension and 5 measures??
If I understand OP correctly, Rob Philpott is right with the 1-dimension-5-measures-approach. I would therefore

1. Create a custom object holding S2, d1, d2, d3 and d4.

2. Use a Dictionary<string/*S1*/, CustomObject>()
BobJanova 7-Sep-11 6:03am
I think so too ('S1 is the key').
If I get you correctly and if you are using .Net 4.0 then you could use a Tuple<string,string,double,double,double,doubel>.

Here[^] is the MSDN page.

Hope this helps
Try this..

'Declare Structure
Public Structure MyColumns
        Public _Col1 As String
        Public _Col2 As String
        Public _Col3 As Double
        Public _Col4 As Integer
        Public _Col5 As Boolean
        Public _Col6 As String

End Structure

'Declare Collection Object Variable

Private ObjTemp As New List(Of MyColumns)

Dim x As New MyColumns
x._Col1 = ""
x._Col2 = ""


' MsgBox(ObjTemp(0)._Col1)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900