Results 1 to 3 of 3

Thread: Array.Clear ...does it?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Array.Clear ...does it?

    Hello,

    I want to enter 4 names in an array and then I want to clear it completely so that I can enter 4 new names. I have tried the Array.Clear(names) thing, but it is not working. Is that the right way to do it?

    Thanks!

  2. #2
    Lively Member JAtkinson's Avatar
    Join Date
    Feb 2004
    Location
    Richmond, VA
    Posts
    68
    Quoted from http://www.c-sharpcorner.com/Code/20...WithArrays.asp

    Hope this helps. I tested it and it worked for me.

    "The Clear static method of the Array class removes all items of an array and sets its length to zero. This method takes three parameters – first an array object, second starting index of the array and third is number of elements. The following code removes two elements from the array starting at index 1 (means second element of the array). "

    Array.Clear(names, 1, 2);


    James
    Visual Studio .net 2003 EA
    VB .net
    C#

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Hmmm....I have tried that and it is not working. I will have to take another look. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width