Click here to Skip to main content
15,897,704 members
Home / Discussions / C#
   

C#

 
GeneralRe: copy paste file remotly Pin
Eddy Vluggen8-Apr-18 0:19
professionalEddy Vluggen8-Apr-18 0:19 
QuestionOCR project Pin
Member 130706852-Apr-18 7:40
Member 130706852-Apr-18 7:40 
AnswerRe: OCR project Pin
Pete O'Hanlon2-Apr-18 7:45
mvePete O'Hanlon2-Apr-18 7:45 
QuestionWorking on OCR as my final year project. Pin
Member 130706852-Apr-18 7:17
Member 130706852-Apr-18 7:17 
AnswerRe: Working on OCR as my final year project. Pin
Dave Kreskowiak2-Apr-18 8:41
mveDave Kreskowiak2-Apr-18 8:41 
AnswerRe: Working on OCR as my final year project. Pin
User 41802543-Apr-18 14:22
User 41802543-Apr-18 14:22 
QuestionOCR project Pin
Member 130706852-Apr-18 7:13
Member 130706852-Apr-18 7:13 
AnswerRe: OCR project Pin
Dave Kreskowiak2-Apr-18 8:39
mveDave Kreskowiak2-Apr-18 8:39 
QuestionGenerate unique number from C# string Pin
MiteshUmta2-Apr-18 2:37
MiteshUmta2-Apr-18 2:37 
AnswerRe: Generate unique number from C# string Pin
Dave Kreskowiak2-Apr-18 2:53
mveDave Kreskowiak2-Apr-18 2:53 
AnswerRe: Generate unique number from C# string Pin
#realJSOP2-Apr-18 22:09
professional#realJSOP2-Apr-18 22:09 
AnswerRe: Generate unique number from C# string Pin
BillWoodruff2-Apr-18 23:41
professionalBillWoodruff2-Apr-18 23:41 
GeneralRe: Generate unique number from C# string Pin
MiteshUmta3-Apr-18 5:16
MiteshUmta3-Apr-18 5:16 
GeneralRe: Generate unique number from C# string Pin
BillWoodruff3-Apr-18 7:46
professionalBillWoodruff3-Apr-18 7:46 
AnswerRe: Generate unique number from C# string Pin
MadMyche4-Apr-18 5:16
professionalMadMyche4-Apr-18 5:16 
SuggestionRe: Generate unique number from C# string Pin
Richard Deeming4-Apr-18 7:30
mveRichard Deeming4-Apr-18 7:30 
MadMyche wrote:
// Get the numeric value of this byte
int ByteValue = Convert.ToInt32(SingleByte);

// Convert this byte into 3 character string
// "Right(3)" is an extension method that will return rightmost (x) characters
string ByteValueString = ("000" + ByteValue.ToString()).Right(3);

// Add this characters numeric string 
OutputBuilder.Append(ByteValueString);

  • No need to convert to an Int32 - a Byte is already numeric;
  • No need for custom padding or extensions methods, when the built-in format strings will do the work for you;

C#
string ByteValueString = SingleByte.ToString("D3");
OutputBuilder.Append(ByteValueString);

Standard Numeric Format Strings | Microsoft Docs[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


AnswerRe: Generate unique number from C# string Pin
Pete O'Hanlon4-Apr-18 8:45
mvePete O'Hanlon4-Apr-18 8:45 
AnswerRe: Generate unique number from C# string Pin
BillWoodruff4-Apr-18 14:00
professionalBillWoodruff4-Apr-18 14:00 
QuestionSerialPort.ReadLine() ? Pin
ibrahimayhans2-Apr-18 2:11
ibrahimayhans2-Apr-18 2:11 
AnswerRe: SerialPort.ReadLine() ? Pin
Gerry Schmitz2-Apr-18 6:49
mveGerry Schmitz2-Apr-18 6:49 
Questiondesigning around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 15:21
Alexander Kindel1-Apr-18 15:21 
AnswerRe: designing around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 16:02
Alexander Kindel1-Apr-18 16:02 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel1-Apr-18 20:25
Alexander Kindel1-Apr-18 20:25 
GeneralRe: designing around the need for an abstract static method Pin
#realJSOP2-Apr-18 1:05
professional#realJSOP2-Apr-18 1:05 
GeneralRe: designing around the need for an abstract static method Pin
Alexander Kindel2-Apr-18 8:45
Alexander Kindel2-Apr-18 8:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.