جستجو در ArrayList با متود Contains و IndexOf و LastIndexOf در #C
سلام بر تمامی برنامه نویسان سی شارپ 😉 در این مطلب ، جستجو در ArrayList با متود Contains و IndexOf و LastIndexOf در سی شارپ #C رو براتون آماده کردم. انشاالله که این کد براتون مفید باشه.
خروجی پروژه به این صورت می باشد:
myArrayList does contain the word 'text'
'text' first occurs at index 0
'text' last occurs at index 3
'text' first occurs at index 0
'text' last occurs at index 3
جستجو در ArrayList با متود Contains و IndexOf و LastIndexOf :
using System;
using System.Collections;
public class MainClass
{
public static void Main()
{
ArrayList myArrayList = new ArrayList();
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
string[] anotherStringArray = {"text", "some", "more", "text"};
myArrayList.SetRange(0, anotherStringArray);
using System.Collections;
public class MainClass
{
public static void Main()
{
ArrayList myArrayList = new ArrayList();
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
myArrayList.Add("A");
string[] anotherStringArray = {"text", "some", "more", "text"};
myArrayList.SetRange(0, anotherStringArray);