Click here to Skip to main content
15,923,689 members
Home / Discussions / C#
   

C#

 
AnswerRe: Casting to Abstract 'parent' rather than casting to Interface ? Pin
BobJanova30-Oct-11 23:36
BobJanova30-Oct-11 23:36 
QuestionC# linq working with list controls Pin
classy_dog28-Oct-11 14:33
classy_dog28-Oct-11 14:33 
AnswerRe: C# linq working with list controls Pin
BillWoodruff28-Oct-11 14:59
professionalBillWoodruff28-Oct-11 14:59 
GeneralRe: C# linq working with list controls Pin
classy_dog28-Oct-11 17:02
classy_dog28-Oct-11 17:02 
GeneralRe: C# linq working with list controls Pin
BillWoodruff28-Oct-11 18:57
professionalBillWoodruff28-Oct-11 18:57 
QuestionWhat does this code segment mean?? Pin
Goalie3528-Oct-11 11:01
Goalie3528-Oct-11 11:01 
AnswerRe: What does this code segment mean?? PinPopular
harold aptroot28-Oct-11 11:17
harold aptroot28-Oct-11 11:17 
QuestionBitconverter.GetBytes() issue Pin
Blubbo28-Oct-11 8:16
Blubbo28-Oct-11 8:16 
I'm not sure if I'm overlooking something here... this "WriteDat" variable is the byte array that I plan to use to write to the memory chip. the variable "nudSerialNumber" is the numericUpDown control that consists of new serial number. I need to plug the serial number into Writedat (without over-writing the first 2 MSB bits). Its in little edian value. (3rd line inside bracket is what threw an exception.)

C#
void InsertSerialNumber(ref byte[] WriteDat)
{
    byte[] serialNumberBytes = new byte[2] { WriteDat[0x60], WriteDat[0x61] };
    Array.Reverse(serialNumberBytes);
    Int32 serialNumberInt = BitConverter.ToInt32(serialNumberBytes, 0);
    serialNumberInt &= 0xC0;

    int newSerialNumberIntToWrite = (int)(nudSerialNumber.Value);
    newSerialNumberIntToWrite |= serialNumberInt;
         
    serialNumberBytes = BitConverter.GetBytes(newSerialNumberIntToWrite);
    Array.Reverse(serialNumberBytes);
    Array.Copy(WriteDat, 0x60, serialNumberBytes, 0, 2);
}

To clarify this:
WriteDat:  1111 1111 1111 1111  (no serial number applied)
New Ser#:  0000 0000 1010 0011  (serial number from nudSerialNumber

WriteDat:  1100 0000 1010 0011  (new serial number applied)
           ^^                   (first 2 MSB is untouched)

AnswerRe: Bitconverter.GetBytes() issue Pin
Mark Salsbery28-Oct-11 8:36
Mark Salsbery28-Oct-11 8:36 
AnswerRe: Bitconverter.GetBytes() issue Pin
Dennis E White28-Oct-11 9:40
professionalDennis E White28-Oct-11 9:40 
AnswerRe: Bitconverter.GetBytes() issue Pin
harold aptroot28-Oct-11 9:42
harold aptroot28-Oct-11 9:42 
QuestionWriting plugin for IE Pin
johnsson7727-Oct-11 19:44
johnsson7727-Oct-11 19:44 
AnswerRe: Writing plugin for IE Pin
Richard MacCutchan27-Oct-11 23:23
mveRichard MacCutchan27-Oct-11 23:23 
QuestionWhere Did Microsoft.CSharp Go? Pin
Roger Wright27-Oct-11 18:49
professionalRoger Wright27-Oct-11 18:49 
AnswerRe: Where Did Microsoft.CSharp Go? Pin
Abhinav S27-Oct-11 19:35
Abhinav S27-Oct-11 19:35 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
Roger Wright27-Oct-11 20:07
professionalRoger Wright27-Oct-11 20:07 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
Alisaunder28-Oct-11 1:30
Alisaunder28-Oct-11 1:30 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
BobJanova28-Oct-11 2:24
BobJanova28-Oct-11 2:24 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
Alisaunder28-Oct-11 4:19
Alisaunder28-Oct-11 4:19 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
BobJanova30-Oct-11 23:50
BobJanova30-Oct-11 23:50 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
Alisaunder31-Oct-11 3:45
Alisaunder31-Oct-11 3:45 
JokeRe: Where Did Microsoft.CSharp Go? Pin
Mycroft Holmes27-Oct-11 19:44
professionalMycroft Holmes27-Oct-11 19:44 
GeneralRe: Where Did Microsoft.CSharp Go? Pin
Roger Wright27-Oct-11 20:01
professionalRoger Wright27-Oct-11 20:01 
AnswerRe: Where Did Microsoft.CSharp Go? Pin
Bernhard Hiller27-Oct-11 21:27
Bernhard Hiller27-Oct-11 21:27 
AnswerRe: Where Did Microsoft.CSharp Go? Pin
Subin Mavunkal27-Oct-11 22:35
Subin Mavunkal27-Oct-11 22:35 

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.