Click here to Skip to main content
15,907,326 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error: Invoke or BeginInvoke cannot be called on a control until the window handle has been created Pin
Member 54067796-Aug-08 2:35
Member 54067796-Aug-08 2:35 
GeneralToolbox control like in VS Pin
Gareth H5-Apr-08 7:50
Gareth H5-Apr-08 7:50 
GeneralC# and Win32_PhysicalMedia SerialNumber from HDD Pin
novadon5-Apr-08 7:02
novadon5-Apr-08 7:02 
GeneralRe: C# and Win32_PhysicalMedia SerialNumber from HDD Pin
Luc Pattyn5-Apr-08 7:42
sitebuilderLuc Pattyn5-Apr-08 7:42 
Generalreading Windows settings (dcom) Pin
Schimaera5-Apr-08 6:33
Schimaera5-Apr-08 6:33 
QuestionHow to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 6:28
darthBug5-Apr-08 6:28 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
mav.northwind5-Apr-08 8:07
mav.northwind5-Apr-08 8:07 
GeneralRe: How to test connectivity to a UDP port on a remote system Pin
darthBug5-Apr-08 8:57
darthBug5-Apr-08 8:57 
General.NET remoting exception Pin
swati245-Apr-08 4:33
swati245-Apr-08 4:33 
GeneralRe: .NET remoting exception Pin
CodingYoshi5-Apr-08 7:31
CodingYoshi5-Apr-08 7:31 
GeneralRe: .NET remoting exception Pin
mav.northwind5-Apr-08 8:12
mav.northwind5-Apr-08 8:12 
QuestionHow to open a form in tableLayoutPanel control while loading? Pin
S a n d y5-Apr-08 2:34
S a n d y5-Apr-08 2:34 
GeneralAdministrate Indexing Server via Web App Pin
Muhammad Nauman Yousuf5-Apr-08 0:56
Muhammad Nauman Yousuf5-Apr-08 0:56 
GeneralBlocking certain website Pin
the pink jedi4-Apr-08 19:57
the pink jedi4-Apr-08 19:57 
GeneralRe: Blocking certain website Pin
Thomas Stockwell5-Apr-08 14:22
professionalThomas Stockwell5-Apr-08 14:22 
Generali need ole total collection and data type Pin
badshah20054-Apr-08 11:57
badshah20054-Apr-08 11:57 
GeneralRe: i need ole total collection and data type Pin
Rick van Woudenberg4-Apr-08 12:12
Rick van Woudenberg4-Apr-08 12:12 
Generalcompare byte array Pin
baranils4-Apr-08 11:37
baranils4-Apr-08 11:37 
GeneralRe: compare byte array Pin
MidwestLimey4-Apr-08 11:55
professionalMidwestLimey4-Apr-08 11:55 
GeneralRe: compare byte array Pin
Rick van Woudenberg4-Apr-08 11:55
Rick van Woudenberg4-Apr-08 11:55 
GeneralRe: compare byte array Pin
baranils4-Apr-08 19:42
baranils4-Apr-08 19:42 
GeneralBinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
baranils4-Apr-08 10:18
baranils4-Apr-08 10:18 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
KaptinKrunch4-Apr-08 10:31
KaptinKrunch4-Apr-08 10:31 
I use the following method to read files. Its pretty fast and then you could use regular expressions to find text within the returned string or what ever else you need to do with the content.

        <br />
public string DecodeFile(string fullpath)<br />
        {<br />
            if (File.Exists(fullpath) == false)<br />
                throw new FileNotFoundException();<br />
<br />
            try<br />
            {<br />
                FileStream fStream = File.OpenRead(fullpath);<br />
                byte[] buffer = new byte[fStream.Length];<br />
                int bytesRead;<br />
                bytesRead = fStream.Read(buffer, 0, buffer.Length);<br />
                fStream.Close();<br />
                fStream.Dispose();<br />
<br />
                if (bytesRead <= 0)<br />
                    throw new Exception("Empty file.");<br />
<br />
                Decoder decoder = Encoding.Default.GetDecoder();<br />
                char[] cBuffer = new char[buffer.Length];<br />
<br />
                int bytesConverted, charsConverted;<br />
                bool bCompleted;<br />
<br />
                decoder.Convert(buffer, 0, buffer.Length, cBuffer, 0, buffer.Length, false, out bytesConverted, out charsConverted, out bCompleted);<br />
                return new String(cBuffer, 0, bytesConverted);<br />
            }<br />
            catch (Exception ex)<br />
            {<br />
                throw new Exception(ex.Message);<br />
            }<br />
<br />
        }<br />


Google search lead me to this info
"Well, its not quite that simple. int.MaxValue is the most the string class
itself could handle, you are right, but since characters take up two bytes,
that many characters would go way beyond the max possible allocation. The
best theoretical high value is 2^31(or 2147483648) characters, since that is
exactly how many would fit in memory. Practially it'd be much, much smaller."

http://bytes.com/forum/thread481655.html[^]

Just because we can; does not mean we should.

GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
baranils4-Apr-08 10:50
baranils4-Apr-08 10:50 
GeneralRe: BinaryRreader The string is prefixed with the length, encoded as an integer seven bits at a time Pin
Zoltan Balazs4-Apr-08 11:16
Zoltan Balazs4-Apr-08 11:16 

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.