Link to home
Start Free TrialLog in
Avatar of Nugs
Nugs

asked on

Last item in the array

I am trying to get the last item in an array every time... The array may be any size but i know that the last item in the array is always the value i need... I am trying to do this and the code is failing:

int arySize = aryItem.Length;
in MyVariable = Convert.ToInt32(aryItem[arySize]);

How can i get the last array item every time?

Nugs
ASKER CERTIFIED SOLUTION
Avatar of Sean McIlvenna
Sean McIlvenna
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PHD
PHD

Did you test the upperbound method of the array ?
Avatar of Nugs

ASKER

realevergod: that worked, thanks..

PHD: I tried out LowerBound... Maybe i used it wrong but did not get the results i needed

Nugs
upperbound