• Entrar
  • Microsoft.com
  • Brasil (Português)
    Česká republika (Čeština)Deutschland (Deutsch)España (Español)France (Français)Italia (Italiano)United States (English)Россия (Русский)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語)香港特别行政區 (中文)
 
 
Microsoft Developer Network
 
 
Homepage
 
 
Biblioteca
 
 
Aprender
 
 
Downloads
 
 
Suporte
 
 
Comunidade
 
 
Fóruns
 
 
 
Microsoft Developer Network > Página Inicial dos Fóruns > .NET Base Class Library > Hashtable.Values.CopyTo()
Fazer uma PerguntaFazer uma Pergunta
Pesquisar Fóruns:
  • Pesquisar Fórum .NET Base Class Library Pesquisar Fórum .NET Base Class Library
  • Pesquisar Todos os Fóruns MSDN Pesquisar Todos os Fóruns MSDN
 

RespondidoHashtable.Values.CopyTo()

  • terça-feira, 6 de fevereiro de 2007 11:03HarryBedi Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Votar como Útil
    0

    Hi Guys,

    I am trying to convert the values in my hashtable to an array.  I am using the hashtable.values.CopyTo() function but it always breaks, it doesn't seem to matter if I change my array type.

    The data in the hashtable is a [,] and i would prefer to keep it that way, however I know that I may have to change it to a double[ ] (conincendentaly I have done that) but I still get a error on the lines it doesnt fit.

    Can someone please help.  I have pasted my code below.

    double[]meanR = new double[7];

    theMeanReturn = mean.getMeanCcyReturns(TheReturns);//theMeanReturn returned as a [,]

    double[] TheMeanReaturn = new double[];//parse theMeanReturns to a [ ]

    for (int p = 0; p < theMeanReturn.Length;p++)

    {

    TheMeanReaturn[p] = theMeanReturn[0,p];

    }

    theMeanReturns.Add(CurrencyPairsData,TheMeanReaturn);//Take it to my hashtable

    TheMeanReaturn.Length.ToString();

    theMeanReturns.Values.CopyTo(meanR,0);//This is where i attempt to convert the data from hashtable

     I

    I am either recieving errors that the array does not fit or that the combination is wrong, or Object cannot be stored in an array of this type.  I really dont know what else I shoud do?

    Thanks

    HB

    • ResponderResponder
    • CitaçãoCitação
     

Respostas

  • terça-feira, 31 de julho de 2007 21:22Inbar GazitModeradorMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     Respondido
    Votar como Útil
    0

    If the type of the elements in the Array and the size of the array matches this works just fine.

    Remember that values is an ICollection of objects. You can check the Count property to make sure you have the correct number of values and check that they are of the same correct type and this would sucsseed.

     

    • ResponderResponder
    • CitaçãoCitação
     

Todas as Respostas

  • quarta-feira, 1 de agosto de 2007 12:57Thomas Danecker Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    Votar como Útil
    0

    Please change the names of your variables. There are three variables with nearly the same name! It makes it very very difficult to read your code. There's theMeanReturn, TheMeanReaturn and theMeanReturns. I think meanR should be a jagged array:

     

    Code Snippet

    double[][] meanR;

     

     

    • ResponderResponder
    • CitaçãoCitação
     
Precisa de Ajuda com Fóruns? (FAQ)
 
© 2009 Microsoft Corporation. Todos os direitos reservados.
Gerencie o seu Perfil
|
Nota Legal
|
Newsletter MSDN
|
Fale Conosco
|
Termos de Uso
|
Marcas Comerciais
|
Pol&iacute;tica de Privacidade