Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting value from Binary field
Message
De
28/01/2014 04:27:27
 
 
À
28/01/2014 00:37:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01592445
Message ID:
01592478
Vues:
60
This message has been marked as a message which has helped to the initial question of the thread.
>>>
>>>Since the size of the hex presentation is twice the size of the byte array, you have to multiply by 2
>>>
>>>>> StringBuilder sb = new StringBuilder(length * 2);
>>>
>>>
>>>
>>>The bitshift: shifting one bit to the left (provided the argument is not negative) is faster. I prefer that
>>>
>>>
>>>>>           StringBuilder sb = new StringBuilder(length << 1);
>>>
>>
>>Cute :-)
>
>Another thing I have found
>
>(1) You have class with an array member ( I tested static, expect instance also)
>(2) A method using that array frequently ( a loop or so)
>
>It is faster to assign the array to a method variable and use the method variable instead of the class member

Interesting. But how about:
       static string ToHex(byte[] bytes)
        {
            return "0X"+ BitConverter.ToString(bytes).Replace("-",string.Empty);
        }
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform