Qhov txawv ntawm Array thiab ArrayList C# yog dab tsi?
Qhov txawv ntawm Array thiab ArrayList C# yog dab tsi?

Video: Qhov txawv ntawm Array thiab ArrayList C# yog dab tsi?

Video: Qhov txawv ntawm Array thiab ArrayList C# yog dab tsi?
Video: Thov Txim Qhov Kuv Txav Deb Ntawm Koj (Official Music Video 2022) N. Vajxob Xyooj & N. Vanxay lauj 2024, Kaum ib hlis
Anonim

Ib array lis tsis yog ib qho kev sau uas muaj zog heev. Nws tuaj yeem khaws cov txiaj ntsig ntawm txawv cov ntaub ntawv hom lossis tib datatype. ArrayList muaj cov npe yooj yim ntawm tus nqi. ArrayList siv IList interface siv ib qho array thiab yooj yim heev peb tuaj yeem ntxiv, ntxig, rho tawm, saib thiab lwm yam.

Ib yam li ntawd, nws tau nug, qhov txawv ntawm Array thiab ArrayList hauv C# yog dab tsi?

ArrayList belongs rau System. Hauv Arrays , peb tuaj yeem khaws ib qho datatype xws li int, hlua, char thiab lwm yam hauv ArrayList peb tuaj yeem khaws cov datatype sib txawv. Arrays muaj zog ntaus ntawv uas txhais tau hais tias nws tuaj yeem khaws cov khoom tshwj xeeb lossis cov khoom. Arraylist tsis muaj zog ntaus.

Dab tsi yog qhov txawv ntawm ib qho array thiab ArrayList? 1- Thawj thiab Major qhov sib txawv ntawm Array thiab ArrayList hauv Java yog qhov ntawd Array yog ib tug ruaj ntev cov ntaub ntawv qauv thaum ArrayList yog qhov sib txawv qhov ntev Collection class. 4- Koj tsis tuaj yeem khaws cov primitives hauv ArrayList , nws tsuas muaj Objects. Thaum Array tuaj yeem muaj ob qho tib si primitives thiab Objects hauv Java.

Tom qab ntawd, qhov twg yog qhov zoo dua array lossis npe hauv C #?

A lis yog muab los ntawm Collection uas muaj ntau generic data type whereas Array yog kho thiab khaws cia ntau hom ntaub ntawv muaj zog. Sau npe muaj cov nodes uas muaj lub cim xeeb qhov chaw yuav tsum tsis txhob contiguous nyob rau hauv cov xwm whereas Array muaj cov ntsiab lus nrog lawv qhov chaw nco uas yog sib txuas hauv qhov xwm txheej.

ArrayList C# yog dab tsi?

C# - ArrayList . ArrayList yog ib yam uas tsis yog-generic sau nyob rau hauv C# . Nws tuaj yeem muaj cov ntsiab lus ntawm txhua hom ntaub ntawv. Nws zoo ib yam li array, tshwj tsis yog tias nws loj hlob tuaj thaum koj ntxiv cov khoom hauv nws. Raws li koj tuaj yeem pom los ntawm daim duab saum toj no, lub ArrayList chav kawm siv IEnumerable, ICollection, thiab IList interfaces.

Pom zoo: