As Turo said, when you use the index to access a string, it will return char
. When the two char
fields perform +
operation, they will be automatically converted to int
.
So try to use String.Substring Method to get an individual character.
pin += encodedPinNumber.Substring(startPostion, 1) + encodedPinNumber.Substring(startPostion + step, 1);
pin += encodedPinNumber.Substring(startPostion + 2 * step, 1) + encodedPinNumber.Substring(startPostion + 3 * step, 1);
Or store all characters in a list, and then use the index to access them.
List<string> stringlist = encodedPinNumber.Select(c => c.ToString()).ToList();
pin += stringlist[startPostion] + stringlist[startPostion + step];
pin += stringlist[startPostion + 2 * step] + stringlist[startPostion + 3 * step];
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…