Click here to Skip to main content
15,795,402 members
Home / Discussions / C#
   

C#

 
GeneralRe: Extract Data from PDF's Pin
Pete O'Hanlon1-Aug-23 20:46
subeditorPete O'Hanlon1-Aug-23 20:46 
GeneralRe: Extract Data from PDF's Pin
OriginalGriff1-Aug-23 21:51
mvaOriginalGriff1-Aug-23 21:51 
GeneralRe: Extract Data from PDF's Pin
Pete O'Hanlon2-Aug-23 0:02
subeditorPete O'Hanlon2-Aug-23 0:02 
AnswerRe: Extract Data from PDF's Pin
Randor 1-Aug-23 17:38
professional Randor 1-Aug-23 17:38 
AnswerRe: Extract Data from PDF's Pin
jschell11-Aug-23 11:45
jschell11-Aug-23 11:45 
QuestionShould we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek31-Jul-23 12:32
mvaPaulo Zemek31-Jul-23 12:32 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Gerry Schmitz31-Jul-23 17:50
mveGerry Schmitz31-Jul-23 17:50 
SuggestionRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Richard Deeming31-Jul-23 23:04
mveRichard Deeming31-Jul-23 23:04 
Your DecimalDigit struct should be marked as readonly, since it will never be mutated.

You could also replace the backing field with a read-only auto property.

You'll probably want to implement IEquatable<T>, and possibly IComparable<T>. And override ToString. At which point, it might be better to use a readonly record struct.

And after all that, without having to resort to reflection or unsafe code, you can still create an invalid instance:
C#
ReadOnlySpan<byte> span = new byte[] { 42 };
DecimalDigit digit = System.Runtime.InteropServices.MemoryMarshal.Read<DecimalDigit>(span);
Console.WriteLine(digit.ByteValue); // 42




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

GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 2:25
mvaPaulo Zemek1-Aug-23 2:25 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 2:46
mvaPaulo Zemek1-Aug-23 2:46 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Richard Deeming1-Aug-23 2:50
mveRichard Deeming1-Aug-23 2:50 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 12:35
mvaPaulo Zemek1-Aug-23 12:35 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
BillWoodruff1-Aug-23 3:15
professionalBillWoodruff1-Aug-23 3:15 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
trønderen1-Aug-23 13:37
trønderen1-Aug-23 13:37 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 16:14
mvaPaulo Zemek1-Aug-23 16:14 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
harold aptroot2-Aug-23 7:37
harold aptroot2-Aug-23 7:37 
QuestionNew Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver29-Jul-23 21:23
pr1mem0ver29-Jul-23 21:23 
AnswerRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
Pete O'Hanlon30-Jul-23 0:28
subeditorPete O'Hanlon30-Jul-23 0:28 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver30-Jul-23 11:44
pr1mem0ver30-Jul-23 11:44 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
Pete O'Hanlon30-Jul-23 21:23
subeditorPete O'Hanlon30-Jul-23 21:23 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff31-Jul-23 4:26
professionalBillWoodruff31-Jul-23 4:26 
AnswerRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff30-Jul-23 2:22
professionalBillWoodruff30-Jul-23 2:22 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
OriginalGriff30-Jul-23 3:35
mvaOriginalGriff30-Jul-23 3:35 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff30-Jul-23 4:54
professionalBillWoodruff30-Jul-23 4:54 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver30-Jul-23 12:13
pr1mem0ver30-Jul-23 12:13 

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.