Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
QuestionRe: Who can help me with this C# Project. Pin
thatraja13-Feb-14 7:29
professionalthatraja13-Feb-14 7:29 
AnswerRe: Who can help me with this C# Project. Pin
horoz07413-Feb-14 7:32
horoz07413-Feb-14 7:32 
GeneralRe: Who can help me with this C# Project. Pin
thatraja13-Feb-14 7:47
professionalthatraja13-Feb-14 7:47 
QuestionDropDownlist keeps disappearing Pin
vkEE13-Feb-14 5:47
vkEE13-Feb-14 5:47 
SuggestionRe: DropDownlist keeps disappearing Pin
Richard MacCutchan13-Feb-14 7:03
mveRichard MacCutchan13-Feb-14 7:03 
QuestionOut of Memory error while generating TreeView Pin
Member 768043413-Feb-14 2:04
Member 768043413-Feb-14 2:04 
AnswerRe: Out of Memory error while generating TreeView Pin
Dave Kreskowiak13-Feb-14 2:35
mveDave Kreskowiak13-Feb-14 2:35 
AnswerRe: Out of Memory error while generating TreeView Pin
Eddy Vluggen13-Feb-14 2:59
professionalEddy Vluggen13-Feb-14 2:59 
AnswerRe: Out of Memory error while generating TreeView Pin
BillWoodruff13-Feb-14 3:24
professionalBillWoodruff13-Feb-14 3:24 
QuestionNumericString Sort Pin
Member 1059316812-Feb-14 20:52
Member 1059316812-Feb-14 20:52 
AnswerRe: NumericString Sort Pin
V.12-Feb-14 21:37
professionalV.12-Feb-14 21:37 
GeneralRe: NumericString Sort Pin
harold aptroot12-Feb-14 22:39
harold aptroot12-Feb-14 22:39 
AnswerRe: NumericString Sort Pin
DaveyM6912-Feb-14 23:37
professionalDaveyM6912-Feb-14 23:37 
AnswerRe: NumericString Sort Pin
Richard Deeming13-Feb-14 0:50
mveRichard Deeming13-Feb-14 0:50 
QuestionHow to Serialize & De-Serialize Any Controls Property in C# Pin
Tridip Bhattacharjee12-Feb-14 20:26
professionalTridip Bhattacharjee12-Feb-14 20:26 
AnswerRe: How to Serialize & De-Serialize Any Controls Property in C# Pin
BillWoodruff12-Feb-14 22:57
professionalBillWoodruff12-Feb-14 22:57 
QuestionWhat is the difference between JavaScript 'var' and C# 'dynamic' Pin
Sanju Uthaiah Bollera12-Feb-14 20:08
Sanju Uthaiah Bollera12-Feb-14 20:08 
AnswerRe: What is the difference between JavaScript 'var' and C# 'dynamic' Pin
Richard MacCutchan12-Feb-14 21:41
mveRichard MacCutchan12-Feb-14 21:41 
AnswerRe: What is the difference between JavaScript 'var' and C# 'dynamic' Pin
BillWoodruff12-Feb-14 22:40
professionalBillWoodruff12-Feb-14 22:40 
Questiondatagridview combobox Pin
abdul rafi12-Feb-14 19:29
abdul rafi12-Feb-14 19:29 
AnswerRe: datagridview combobox Pin
Eddy Vluggen13-Feb-14 9:06
professionalEddy Vluggen13-Feb-14 9:06 
Question3D Model Pin
Kadam dIgambar12-Feb-14 18:07
Kadam dIgambar12-Feb-14 18:07 
SuggestionRe: 3D Model Pin
Richard MacCutchan12-Feb-14 21:39
mveRichard MacCutchan12-Feb-14 21:39 
GeneralRe: 3D Model Pin
JV999914-Feb-14 3:07
professionalJV999914-Feb-14 3:07 
QuestionConverting Back from Decimal to Byte Pin
computerpublic12-Feb-14 10:03
computerpublic12-Feb-14 10:03 
/*
First Phase:: I attempting to copy a file off my desktop into a byte array. Then transposing all the bytes into an equivalent decimal array. The decimal array is must (it is very important).

Second Phase:: I am attempting to convert the same decimal array back to a byte array and write the file back to the desktop or a folder or path. 

The first phase was accomplish with help from the forum, but the second gives me back a garbage file on the desktop. I was attempting to use WriteAllBytes, but I do not know how to use this method. Can you someone please assist me with "WriteAllBytes" or show simply show me how to stop getting garbage file?
*/
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Applica
{
    class Program
    {
        static void Main(string[] args)
        {
            long Totbyte = 0;
            string filePath = null;
            DirectoryInfo da = new DirectoryInfo("C:\\Folder");
            FileInfo[] Arr = da.GetFiles();
 
            foreach (FileInfo ap in Arr)
            {
                Totbyte = ap.Length;
                filePath = ap.FullName;
            }
            Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
            string temPath = Path.GetTempFileName();
            byte[] data = new byte[Totbyte];
 
            if (File.Exists(temPath))
            {
                data = File.ReadAllBytes(filePath);
                File.WriteAllBytes(temPath, data);
            }
            decimal[] arry = new decimal[Totbyte];
            for (int count = 0; count < data.Length; count++)
            {
                arry[count] = data[count];
             //   Console.WriteLine("Byte to Decimal = {0},,,,,, count = {1}", arry[count], count);
            }
            ///////////ABOVE: READ IN FILE AND CHANGE EACH BYTE TO DECIMAL
            ///////////BELOW: TRYING TO REVERSE THE ABOVE PROCESS
            byte[] data2 = new byte[Totbyte];
            for (int count = 0; count < arry.Length; count++)
            {
                data2[count] = (byte)arry[count];
            }
            FileStream file = new FileStream(filePath, FileMode.Create);
            BinaryWriter binarystream = new BinaryWriter(file);
            binarystream.Write(data2);
            binarystream.Close();
        }
    }
}

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.