Software Development Network>> Visual C#>> How to convert string in ABCD format in to Unique integer
You are right, I skipped the method name.
int n = BitConverter.ToInt32 (Encoding.ASCII.GetBytes ("ABCD"), 0);
Sorry.
--mc
If it's always a 4-letter code and you don't care about getting large numbers, you could do something like:
int n = BitConverter (Encoding.ASCII.GetBytes ("ABCD"), 0);
HTH--mc
I'm sure there is, but you are going to have to better define the parameters of this conversion.
Basically, tell me how you'd do it on paper, and I'll tell you how to do it on a computer.
How to convert string in ABCD format in to Unique integer
Jkumar
You are right, I skipped the method name.
int n = BitConverter.ToInt32 (Encoding.ASCII.GetBytes ("ABCD"), 0);
Sorry.
--mc
MaggieChan
SCarmeli
If it's always a 4-letter code and you don't care about getting large numbers, you could do something like:
int n = BitConverter (Encoding.ASCII.GetBytes ("ABCD"), 0);
HTH
--mc
Balsoft
I don't care about getting large numbers.
But there is an error in your code
Error 1 'System.BitConverter' is a 'type' but is used like a 'variable'
PatrickDonohue
I'm sure there is, but you are going to have to better define the parameters of this conversion.
Basically, tell me how you'd do it on paper, and I'll tell you how to do it on a computer.