Click here to Skip to main content
15,887,585 members
Home / Discussions / C#
   

C#

 
AnswerRe: Read and write JSON in c# WinForms Pin
Richard Deeming29-Nov-18 1:09
mveRichard Deeming29-Nov-18 1:09 
GeneralRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 9:47
professionaljkirkerx29-Nov-18 9:47 
AnswerRe: Read and write JSON in c# WinForms Pin
jkirkerx29-Nov-18 9:46
professionaljkirkerx29-Nov-18 9:46 
AnswerI finally got it Pin
jkirkerx29-Nov-18 10:42
professionaljkirkerx29-Nov-18 10:42 
QuestionGet Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 5:48
professionalKevin Marois28-Nov-18 5:48 
AnswerRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 5:55
mveOriginalGriff28-Nov-18 5:55 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 7:03
professionalKevin Marois28-Nov-18 7:03 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 8:15
mveOriginalGriff28-Nov-18 8:15 
Laugh | :laugh: I'll see what I can do - I'm on a tablet, so code is difficult (as is spelling, typing quickly, ...)

Numbers aren't stored in base ten - you know that - they are stored in binary, with each bit in the number representing a power of 2:
... 24 23 22 21 20
... 16  8  4   2  1
So, if you start with a mask of 1 that checks just the bottom bit. Shift the mask left one place, and then it equals 2 and checks just the second bit. Shift it again - 4 - and it checks just the third bit. Again - 8 - and it's the fourth.
So if the mask checks just one bit and the mask is the binary value of that bit the AND will check the bits for the values you are looking for.

9 == 1001 binary
mask 0001 - 1 - yes, add one to your array
mask 0010 - 2 - no, don't add it.
mask 0100 - 4 - no, don't add it.
mask 1000 - 8 - yes, add eight to your array
No bits left, so you're done.
1 + 8 == 9

Try it on paper, and you'll see what I mean.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Get Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 8:42
professionalKevin Marois28-Nov-18 8:42 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
OriginalGriff28-Nov-18 9:12
mveOriginalGriff28-Nov-18 9:12 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
Richard Deeming28-Nov-18 8:22
mveRichard Deeming28-Nov-18 8:22 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
Kevin Marois28-Nov-18 8:41
professionalKevin Marois28-Nov-18 8:41 
GeneralRe: Get Numbers That Make Up A Binary Number Pin
BillWoodruff1-Dec-18 16:54
professionalBillWoodruff1-Dec-18 16:54 
QuestionHow to set Custom property of a user control in windows Application Pin
getarijit21-Nov-18 22:25
getarijit21-Nov-18 22:25 
AnswerRe: How to set Custom property of a user control in windows Application Pin
OriginalGriff21-Nov-18 23:00
mveOriginalGriff21-Nov-18 23:00 
GeneralRe: How to set Custom property of a user control in windows Application Pin
getarijit22-Nov-18 0:44
getarijit22-Nov-18 0:44 
GeneralRe: How to set Custom property of a user control in windows Application Pin
Eddy Vluggen22-Nov-18 1:20
professionalEddy Vluggen22-Nov-18 1:20 
GeneralRe: How to set Custom property of a user control in windows Application Pin
getarijit22-Nov-18 1:31
getarijit22-Nov-18 1:31 
GeneralRe: How to set Custom property of a user control in windows Application Pin
Eddy Vluggen22-Nov-18 1:41
professionalEddy Vluggen22-Nov-18 1:41 
GeneralRe: How to set Custom property of a user control in windows Application Pin
getarijit22-Nov-18 4:43
getarijit22-Nov-18 4:43 
GeneralRe: How to set Custom property of a user control in windows Application Pin
Dave Kreskowiak22-Nov-18 8:21
mveDave Kreskowiak22-Nov-18 8:21 
QuestionDisable or remove menustrip item background when mouse over Pin
uniservice33321-Nov-18 7:09
uniservice33321-Nov-18 7:09 
AnswerRe: Disable or remove menustrip item background when mouse over Pin
Afzaal Ahmad Zeeshan21-Nov-18 11:27
professionalAfzaal Ahmad Zeeshan21-Nov-18 11:27 
AnswerRe: Disable or remove menustrip item background when mouse over Pin
Eddy Vluggen22-Nov-18 2:02
professionalEddy Vluggen22-Nov-18 2:02 
QuestionDBF File Pin
satishkhokhar21-Nov-18 3:42
satishkhokhar21-Nov-18 3:42 

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.