متدهای Insert() و AddRange() و InsertRange() برای ArrayList در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، متدهای Insert() و AddRange() و InsertRange() برای ArrayList در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی پروژه به این صورت می باشد:
myArrayList[0] = is
myArrayList[1] = is
myArrayList[2] = a
myArrayList[3] = test
myArrayList[4] = Here's
myArrayList[5] = some
myArrayList[6] = more
myArrayList[7] = text
myArrayList[1] = is
myArrayList[2] = a
myArrayList[3] = test
myArrayList[4] = Here's
myArrayList[5] = some
myArrayList[6] = more
myArrayList[7] = text
متدهای Insert() و AddRange() و InsertRange() برای ArrayList :
using System;
using System.Collections;
class MainClass
{
public static void Main()
{
ArrayList myArrayList = new ArrayList();
myArrayList.Add("is");
myArrayList.Insert(1, "is");
string[] myStringArray = {"a", "test"};
myArrayList.AddRange(myStringArray);
string[] anotherStringArray = {"Here's", "some", "more", "text"};
using System.Collections;
class MainClass
{
public static void Main()
{
ArrayList myArrayList = new ArrayList();
myArrayList.Add("is");
myArrayList.Insert(1, "is");
string[] myStringArray = {"a", "test"};
myArrayList.AddRange(myStringArray);
string[] anotherStringArray = {"Here's", "some", "more", "text"};