|
Here you need to manipulate with lot of string values. String in immutable in nature . In this sort of senario StringBuilder class is ideal . Please check the properties and Methods of StringBuilder class which avilable in System.Text namespace and all members of this class are self explanatory in nature(MSDN). And apply little logic to achive your result.;)
Sreejith Nair
[ My Articles ]
|
|
|
|
|
hi,
Thank u Mr.Nair.
yes i have done it. now im using a hashtable and it is faster. but there is one more problem. serialization takes much time than parsing the file.
after parsing all the files, i add all the files in an ArrayList and then i gave that arraylist to serialize. i used the serialization at the end.
help me out.
thank u.
|
|
|
|
|
Insted of ArryList Try to use SortedList and compare the performance.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I want to invoke the DeviceIoControl() API in C#,then how to define IOCTL_SCSI_PASS_THROUGH ?
//vc++ code :
DeviceIoControl( hFile, IOCTL_SCSI_PASS_THROUGH, &SPTWB, length,&SPTWB, length, &dwBytesReturned, FALSE );
Thanks!
|
|
|
|
|
|
//vc++ code:
......
int *point,low;
point1 = &low;
point = point1;
if (point == null)
{......}
......
How to convert this to C#?
|
|
|
|
|
CLR won't execute the code which is unsafe. Here your requirement is to execute this unsafe code.
For executing unsafe code in managed environment you have to use unsafe keyword.
Eg:
<br />
<br />
using System;<br />
<br />
namespace ConsoleApplication1<br />
{<br />
class Class1<br />
{<br />
public static unsafe void CopyMethod(byte[] src,int cntsrc,byte[] dnc,int cntdnc,int count)<br />
{<br />
if(src==null||cntdnc<0||dnc==null||cntdnc<0||count<0)<br />
throw new ArgumentException();<br />
int srclen=src.Length;<br />
int dnclen=dnc.Length;<br />
if(srclen-cntsrc<count||dnclen-cntdnc<count)<br />
throw new ArgumentException();<br />
fixed(byte* pSrc=src, pDnc=dnc)<br />
{<br />
byte* pscr=pSrc,pdnc=pDnc;<br />
for (int n = count >> 2; n != 0; n--)<br />
{<br />
*((int*)pdnc) = *((int*)pscr);<br />
pdnc += 4;<br />
pscr += 4;<br />
}<br />
for (count &= 3; count != 0; count--)<br />
{<br />
*pdnc = *pscr;<br />
pdnc++;<br />
pscr++;<br />
}<br />
}<br />
}<br />
<br />
static void Main(string[] args) <br />
{<br />
byte[] a = new byte[100];<br />
byte[] b = new byte[100];<br />
for(int i=0; i<100; ++i) <br />
a[i] = (byte)i;<br />
CopyMethod(a, 0, b, 0, 100);<br />
Console.WriteLine("The first 10 elements are:");<br />
for(int i=0; i<10; ++i) <br />
Console.Write(b[i] + "{0}", i < 9 ? " " : "");<br />
Console.WriteLine("\n");<br />
}<br />
}<br />
}<br />
The above example uses pointers to copy an array of bytes from src to dst.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi!Nair,
Thank you for your good example.
I can learn something from this sample code.
So what about the upper two problems?
Thanks!
momer
|
|
|
|
|
can anybody guide me how I can access email account settings like pop3 server,smtp server email address which are stored in ms outlook through c# so far i am able to access default folder of outlook like contacts inbox notes etc.is there any way to access these entries.
Thanking You,
chintan
|
|
|
|
|
|
thank you sreejith..for your reply..but this article give information about the things which i have already done like accessing inbox,notes,contacts..I am still not able to access email account settings of outlook through c#.could you guide me bit more so that i can get the email account settings..
thanking you,
chintan
|
|
|
|
|
Hello,
I have been trying to convert a ulong into it's component bits.
Unfortunately there is no converstion operation, and using pointers this is not possible, since there is no pointer of size 1 bit.
I have also tried the BitArray operation, but this only allows for int32 size variables... so I converted my ulong into 2 ints. However the result was not correct.
Now I do not have any ideas how to proceed.
Could somebody pls help me?
|
|
|
|
|
A combination of masking and shifting will work. For example:
ulong ulValue = 0xF345612347892019UL;
ulong ulMask;
int iBitValue;
for ( int iBit = 0; iBit < 64; ++iBit )
{
ulMask = 1UL << iBit;
iBitValue = (int)((ulValue & ulMask) >> iBit);
System.Console.WriteLine( "Bit {0}: {1}", iBit, iBitValue );
}
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
How to add small pictures for a chat windows (emptions )by shortcut.Buzz type of utility. like this
Learner always
|
|
|
|
|
Hi guys,
just a quick question.
This is my first time ever using GDI+ and C# for graphical output.
I have a Windows Form with 3 Panels, one docked to the middle (center) and 2 docked to the bottom. I use these panels to render graphs and rulers.
If I resize my Window, everything seems to be ok, the panels have a new size (larger or smaller) and look alright. But if I try to draw my graph or render my text, the renderer seems to be only using the "old" width" and height, not the additional area provided by the resize.
Well, I could always prevent the window from being resized, but that is really no help
If you could give me any hints, i would be very grateful.
Cheers
Sebastian
|
|
|
|
|
Try to invalidate the panel after before maximizing from minimized state.
That is call panel.Invalidate() to invalidate the panel region when user choose maximized.
And get back to me if this answer don't serves you.
|
|
|
|
|
Try to invalidate the panel after before maximizing from minimized state.
That is call panel.Invalidate() to invalidate the panel region when user choose maximized.
And get back to me if this answer don't serves you.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Sorry, that did not work :/
Any other ideas?
Cheers
Sebs
|
|
|
|
|
I'm convinced that ScrollToCaret can be used for this, I'm just not sure what this "caret" thing is, but I'll probably figure it out now
|
|
|
|
|
By using AppendText instead of textbox.Text += newtext, it all works.
Thanks anyhow
|
|
|
|
|
Sometimes it's so simple
Too bad, this isn't mentioned on MSDN topic.
www.troschuetz.de
|
|
|
|
|
Yeah i found this method too. I guess the "caret" has something to do with the selection.
I'm sure with a few tries you will find out and make your code work
www.troschuetz.de
|
|
|
|
|
Yeah, that little "blinky" verticle line in a TextBox is the Caret. It call also be called the Insertion Point, Cursor, Blinky Thing, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
how do i convert a c++ declaration of a function like this
FT_STATUS FT_Read(FT_HANDLE, ftHandle, LPVOID IpBuffer, DWORD BytesRead,
LPDWORD BytesReturned)
where
ftHandle - Handle of the device to read.
lpBuffer - Pointer to the buffer that receives the data from the device.
BytesRead - Number of bytes to be read from the device.
BytesReturned - Pointer to a variable of type DWORD which receives the number of bytes read from the device.
to C#
|
|
|
|
|
[DllImport("mydllnamehere.dll")]
int FT_Read(IntPtr ftHandle, byte[] lpBuffer, uint BytesRead, out uint BytesReturned); That's a quick guess; I'm assuming FT_HANDLE is a typedef for void* . When calling it, you need to create the array of appropriate size first.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|