Click here to Skip to main content
15,883,813 members
Home / Discussions / C#
   

C#

 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic13-Feb-14 10:48
computerpublic13-Feb-14 10:48 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic16-Feb-14 6:00
computerpublic16-Feb-14 6:00 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic16-Feb-14 6:03
computerpublic16-Feb-14 6:03 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming17-Feb-14 1:46
mveRichard Deeming17-Feb-14 1:46 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic18-Feb-14 22:51
computerpublic18-Feb-14 22:51 
GeneralRe: Converting Back from Decimal to Byte Pin
computerpublic18-Feb-14 23:03
computerpublic18-Feb-14 23:03 
GeneralRe: Converting Back from Decimal to Byte Pin
Richard Deeming19-Feb-14 1:59
mveRichard Deeming19-Feb-14 1:59 
GeneralRe: Converting Back from Bit to Byte Pin
computerpublic13-Mar-14 8:16
computerpublic13-Mar-14 8:16 
C#
<pre>/*If I am generating a series of bits ONE BIT AT A TIME for example {10101000}. How do I turn the entire series into one byte after I generate the 8th bit. I am trying to back track using the example you gave me, but I am getting some errors.*/

using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Applica
{
    class Program
    {
        static Random _random = new Random ();////Start: Fisher-Yates Array Shuffler
        public static void Shuffle<T>(T[] array)
        {
            var random = _random;
            for (int i = array.Length; i > 1; i--)
            {
                int j = random.Next(i);
                T tmp = array[j];
                array[j] = array[i - 1];
                array[i - 1] = tmp;
            }
        }////////////////////////////////////////////End: Fisher-Yates Array Shuffer
        static void Main(string[] args)
        {
            byte[] outdata = new byte[1];
            BitArray[] bits2 = new BitArray[8];
            char[] array = {'1','0','1','0','1','0','1','0'};
            Shuffle(array);
            for (int i = 0; i < 8; i++)
                bits2[i] = array[1];//Error: Cannot Implicitly convert type 'char' to 'System.Collections.BitArray'
            outdata[i] = (byte)bits2;//Error: Cannot convert type 'System.Collections.BitArray[]' to 'byte' 
        }
    }
}


AnswerRe: Converting Back from Decimal to Byte Pin
Eddy Vluggen12-Feb-14 11:21
professionalEddy Vluggen12-Feb-14 11:21 
QuestionRe: Converting Back from Decimal to Byte Pin
Richard MacCutchan12-Feb-14 21:38
mveRichard MacCutchan12-Feb-14 21:38 
Questiontreeview and database Pin
danmor49812-Feb-14 6:45
danmor49812-Feb-14 6:45 
QuestionRe: treeview and database Pin
Ravi Bhavnani12-Feb-14 7:28
professionalRavi Bhavnani12-Feb-14 7:28 
AnswerRe: treeview and database Pin
danmor49812-Feb-14 7:52
danmor49812-Feb-14 7:52 
QuestionRe: treeview and database Pin
Richard MacCutchan12-Feb-14 21:27
mveRichard MacCutchan12-Feb-14 21:27 
AnswerRe: treeview and database Pin
danmor49813-Feb-14 8:58
danmor49813-Feb-14 8:58 
GeneralRe: treeview and database Pin
Richard MacCutchan13-Feb-14 21:45
mveRichard MacCutchan13-Feb-14 21:45 
QuestionASP.NET Project Files Pin
Sandhya Bandar12-Feb-14 2:29
Sandhya Bandar12-Feb-14 2:29 
AnswerRe: ASP.NET Project Files Pin
Richard MacCutchan12-Feb-14 4:42
mveRichard MacCutchan12-Feb-14 4:42 
QuestionThe file version maintain utility Pin
sahani from india12-Feb-14 1:56
sahani from india12-Feb-14 1:56 
AnswerRe: The file version maintain utility Pin
Pete O'Hanlon12-Feb-14 2:16
mvePete O'Hanlon12-Feb-14 2:16 
GeneralRe: The file version maintain utility Pin
OriginalGriff14-Feb-14 22:27
mveOriginalGriff14-Feb-14 22:27 
QuestionHelp needed XNA and Window Forms Pin
larsp77712-Feb-14 0:57
larsp77712-Feb-14 0:57 
AnswerRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:09
professionalDaveyM6912-Feb-14 1:09 
GeneralRe: Help needed XNA and Window Forms Pin
larsp77712-Feb-14 1:13
larsp77712-Feb-14 1:13 
GeneralRe: Help needed XNA and Window Forms Pin
DaveyM6912-Feb-14 1:39
professionalDaveyM6912-Feb-14 1:39 

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.