Click here to Skip to main content
16,019,263 members
Home / Discussions / C#
   

C#

 
GeneralRe: Extract Data from PDF's Pin
Pete O'Hanlon1-Aug-23 19:46
mvePete O'Hanlon1-Aug-23 19:46 
GeneralRe: Extract Data from PDF's Pin
OriginalGriff1-Aug-23 20:51
mveOriginalGriff1-Aug-23 20:51 
GeneralRe: Extract Data from PDF's Pin
Pete O'Hanlon1-Aug-23 23:02
mvePete O'Hanlon1-Aug-23 23:02 
AnswerRe: Extract Data from PDF's Pin
Randor 1-Aug-23 16:38
professional Randor 1-Aug-23 16:38 
AnswerRe: Extract Data from PDF's Pin
jschell11-Aug-23 10:45
jschell11-Aug-23 10:45 
QuestionShould we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek31-Jul-23 11:32
Paulo Zemek31-Jul-23 11:32 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Gerry Schmitz31-Jul-23 16:50
mveGerry Schmitz31-Jul-23 16:50 
SuggestionRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Richard Deeming31-Jul-23 22:04
mveRichard Deeming31-Jul-23 22: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 1:25
Paulo Zemek1-Aug-23 1:25 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 1:46
Paulo Zemek1-Aug-23 1:46 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Richard Deeming1-Aug-23 1:50
mveRichard Deeming1-Aug-23 1:50 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 11:35
Paulo Zemek1-Aug-23 11:35 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
BillWoodruff1-Aug-23 2:15
professionalBillWoodruff1-Aug-23 2:15 
AnswerRe: Should we ever create enums? (C#, maybe valid for C++) Pin
trønderen1-Aug-23 12:37
trønderen1-Aug-23 12:37 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
Paulo Zemek1-Aug-23 15:14
Paulo Zemek1-Aug-23 15:14 
GeneralRe: Should we ever create enums? (C#, maybe valid for C++) Pin
harold aptroot2-Aug-23 6:37
harold aptroot2-Aug-23 6:37 
QuestionNew Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver29-Jul-23 20:23
pr1mem0ver29-Jul-23 20:23 
AnswerRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
Pete O'Hanlon29-Jul-23 23:28
mvePete O'Hanlon29-Jul-23 23:28 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver30-Jul-23 10:44
pr1mem0ver30-Jul-23 10:44 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
Pete O'Hanlon30-Jul-23 20:23
mvePete O'Hanlon30-Jul-23 20:23 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff31-Jul-23 3:26
professionalBillWoodruff31-Jul-23 3:26 
AnswerRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff30-Jul-23 1:22
professionalBillWoodruff30-Jul-23 1:22 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
OriginalGriff30-Jul-23 2:35
mveOriginalGriff30-Jul-23 2:35 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
BillWoodruff30-Jul-23 3:54
professionalBillWoodruff30-Jul-23 3:54 
GeneralRe: New Kind of Application for me (centralized/cloud). Looking for learning resources. Pin
pr1mem0ver30-Jul-23 11:13
pr1mem0ver30-Jul-23 11: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.