나는 5 개의 문자열이 들어있는 ArrayList가있는 숙제 프로젝트를 진행하고 있습니다. ArrayList (인덱스 값 사용) 항목을 선택하는 방법은 알고 있지만 객체 문자열에 액세스하는 방법은 알지 못합니다. 어떤 도움이라도 좋을 것입니다. 배열 목록의 모든 항목이의 얼굴에 "객체"하지만, 실제로 내부적으로 장비 객체있어 이후ArrayList에 포함 된 개체 선택
이private ArrayList myComponents;
private int listIndex = 0;
myComponents = new ArrayList(); //Arraylist to hold catalog data
equipment = new Equipment(itemName, itemType, itemDetails, itemMaintenance, itemId);
myComponents.Add(equipment);
// class file is called Equipment.cs
// I know normally that equipment without the arraylist this would work:
// equipment.getitemName();
// but combining with the arraylist is being problematic.
여기에서 "IndexOf"또는 "Contains"방법이 필요하지 않은 이유는 무엇입니까? –