Fastest way to detect duplicate numbers on array vb.net 2005

前端 未结 9 1513
轮回少年
轮回少年 2021-01-20 17:31

I have this project that let user inputs 5 different numbers from 1 to 50. But I want to validate it before saving to DB that i will be 5 unique numbers. What\'s the best an

9条回答
  •  旧巷少年郎
    2021-01-20 18:08

    Put in an array, sort it and check if elements 1,2 2,3 3,4 and 4,5 are different (in a loop).

提交回复
热议问题