Click here to Skip to main content
       

C#

 
QuestionCannot access string in System.String[] [modified] PinmemberAmbiguousName3-Feb-13 21:06 
AnswerRe: Cannot access string in System.String[] Pinmemberjibesh3-Feb-13 21:19 
GeneralRe: Cannot access string in System.String[] PinmemberAmbiguousName3-Feb-13 21:21 
GeneralRe: Cannot access string in System.String[] Pinmemberjibesh3-Feb-13 21:29 
that's the main problem when you work with ArrayList, Add method simply accepts any object you pass. here you are adding the string[] returned by the source.ToArray operation. to Add the array range you should use array.AddRange.
 
My personal recommendation is to avoid using ArrayList in your application and use Generic lists.
 
public void CopySetting(ArrayList mySrcArrayList)
{
    myTargetArrayList.Clear();
    myTargetArrayList.AddRange(mySrcArrayList.ToArray(typeof(string))); //copying the ArrayList
}
Jibesh V P

GeneralRe: Cannot access string in System.String[] PinmemberBobJanova5-Feb-13 4:52 
QuestionC# samples PinmemberNard you3-Feb-13 20:33 
AnswerRe: C# samples PinmentorWayne Gaylard3-Feb-13 20:48 
GeneralRe: C# samples PinmemberNard you3-Feb-13 21:00 
GeneralRe: C# samples PinmentorWayne Gaylard3-Feb-13 21:07 
AnswerRe: C# samples PinmvpAbhinav S3-Feb-13 21:33 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 1 Oct 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid