나는 vb.net에서 사용자 정의 그래프 알고리즘을 구현하고있어, 나는 다음과 같은 문제에 봉착 :.net collections : 한 컬렉션에서 다른 컬렉션으로 개체를 복사하는 방법은 무엇입니까?
Supose 코드 : ... 도와 주셔서
dim col as new collection
dim myC as new system.collections.genericList(of myClass)
dim obj1 as new myClass
dim obj2 as new myClass
myC.add(obj1)
myC.add(obj2)
dim myC2 as new system.collections.generic.list(of myClass)
myC2 = myC
col.add(myc2)
'In the next statement, the myC2 inside col collection will be decreased to contain
'only obj1, like myC. I supose this is for myC and myC2 contains only a pointer to
'objects obj1 and obj2 as well col contains pointers to myC and myC2
myC.remove(obj2)
'The problem is that I have to only copy myC to myC2, like a ByVal argument in a function,
'instead a ByRef argument, in order to mantain a copy of objects in myC2 while these
'objects should be removed from myC. How should I do it?
감사를
완전히 간단하고 훌륭합니다! 고마워요! – Alex