|
Mark Sanders wrote:
Is there a better way to do this, performance wise? Or is this implementation a decent one?
Maybe there is another way of doing it, but the only one that passes through my mind now is the SortedList container.
Do you really need to have a Sort method or can the list be sorted all the time? If this is the case, then deriving from or aggregating a SortedList can give you the best performance.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
The collection cannot be automatically sorted. In use, the collection will usually be unsorted. Only on occasion will sorting be necessary. Thanks.
Mark Sanders
sanderssolutions.com
|
|
|
|
|
Since you're inheriting from CollectionBase you can use the underlying ArrayList's Sort method. That will (should anyway) in turn call the underlying Array's Sort method.
You can access the ArrayList by the protected InnerList property on the CollectionBase.
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
James T. Johnson wrote:
Since you're inheriting from CollectionBase you can use the underlying ArrayList's Sort method. That will (should anyway) in turn call the underlying Array's Sort method.
It actually calls an quicksort implementation. Saw it many moons back. Quite fast as well.
Hey leppie! Your "proof" seems brilliant and absurd at the same time. - Vikram Punathambekar 28 Apr '03
|
|
|
|
|
leppie wrote:
Quite fast as well.
If the data is not already sorted (which is the worst case of the QuickSort algorithm)
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
hi,
i have a databound datagrid control in a winform. i need work arounds for some problems.
1. When i click the last row in the datagrid a new row is automatically added. i need to control this new row addition. Before adding a new row I need to check existing rows in the datagrid and validate against some criteria. Depending on the values existing in the datagrid I want to reject or accept the addition of the row. How can i do this. I tried onRowchanging event of the table the datagrid is bound to but got into some other problems.
2. How can i undo a latest edit made in a databound datagrid again based on some criteria.
3. I have included a combobox inside the datacolum and the combobox again includes a tree view inside. i got most of the job done but whenever i try to add a new row in the datagrid it adds up three new rows. Then when i click on the first of the newly added rows the other two disappear but when i click on the 2nd and 3rd i get the arrayindexoutofbounds exception. Any solutions for this?
hope I get some replies.
Thanks.
|
|
|
|
|
When I call StartService() Web Method of my Web Service, aspnet_wp.exe consumes around 100% cpu utilization. What is wrong with this?
[WebMethod]
public void StartService()
{
threadListener = new Thread(new ThreadStart(Listen));
threadListener.Start();
}
private void Listen()
{
//Some code for creating a init tcp listner
threadListener.Suspend();
}
Sonork ID 100:25668
|
|
|
|
|
Plz,
examine the memory consumption
using some tools. Tools such as System Monitor or Task Manager can isolate
those processes. When using System Monitor, if both the "Private Bytes"
counter and the ".NET # of Bytes in all Heaps" counter increase at the same
rate, this is evidence of managed memory consumption. Look at the size of
allocated managed memory and consider what the garbage collector is doing.
The allocation profiler might be helpful to you:
http://www.gotdotnet.com/userfiles/MaheshP/AllocationProfiler.zip
also check this article on MSDN,
[1]
http://support.microsoft.com/default.aspx?scid=kb;en-us;q286350
[2]
http://support.microsoft.com/default.aspx?scid=kb;en-us;q321792
hope this helps though,
- Paresh
|
|
|
|
|
I want to make a browser likes IE, but .NET doesn't provide a web browser control ( I want something that I can configure it easily, not hard). Please help me.
|
|
|
|
|
The VS.NET Toolbox window can be customized to add ActiveX controls such as the web browser control. When you drop this control onto your form, interop libraries will be automatically built and used.
|
|
|
|
|
please tell me how to use that control( and what they are)!!!
|
|
|
|
|
Tutorial[^]. What this article does not say is that, instead of using the cmdline to extract what's known as interop libraries, you can let the VC#.NET IDE do it for you, by simply dragging the "Microsoft Web Browser control" COM component from the Toolbox to your Form.
|
|
|
|
|
I need to convert a string variable to an array of integers (An ASCII code for each character) and send it over to a Fortran code.
First, I have converted the string var. to an array of char (see below), but how can I convert this (kurt) to an array of integers?
string SetupPath;
char [] kurt;
int [] intFilePath;
.
.
.
kurt=SetupPath.ToCharArray();
intFilePath = ????
.
.
fdc
|
|
|
|
|
I have solved it, with something like this:
for (i=0;i
|
|
|
|
|
|
I create a Windows Service, I allow it to interact with the desktop and I can see the NotifyIcon in the try bar when the service start, but I can't use the Icon.
I explain better:
_I can see the icon
_I can see the tooltip
_I can see the baloon
_I can't see the Context menu when i click with the right mouse button
_I can't execute the action that I assign to the left mouse button.
So, the service can intercact with the desktop, but the user can't interact with the try Icon.
There is a solution?
Thanks for any help.
Regards,
Emanuele
|
|
|
|
|
The NotifyIcon only addresses the issue of the icon in the toolbar. In order for the user to interact with this icon, you have to create the context menu and click events for that menu.
|
|
|
|
|
I have create all.
If i run the app all run ok,
but if i do the same in a service there is that problem....
|
|
|
|
|
|
I have a problem with pointers in C#. In my code, i have to define a struct and one of the element of this struct is a string. But C# don't let us use a string in structs when we use it with pointer. So in struct i use "char". Then when assigning a char to pointer, c# only assigns the first character of the variable. As you see, i have to use a char array with pointers for this. But i couldn't that. Is anybody can tell me how can i do that?
Sierra
|
|
|
|
|
Are you doing this for interop? If so, I suggest reading the "using win32 and other libraries from C#" column here:
http://www.gotdotnet.com/team/csharp/learn/columns/ericgu_column.aspx
|
|
|
|
|
Post your code, I'll give it a look.
|
|
|
|
|
Hi !
I want to read the text shown inside a word document to a string variable.
The problem is the normal appraoch
FileInfo f = new FileInfo(loadedPage);
StreamReader s = f.OpenText();
myvar = s.ToString();
which is used to read normal text files will not work with word.
Thanx !
|
|
|
|
|
Sorry to disappoint you but a word document contains format codes. Open it up using note pad and a you will understand. You need to save it as a text file. In addition, if you save word in rtf, you can open it up using the rtf control provided by MS.
Hope this helps.
Robocop
Robocop
|
|
|
|
|
Hi !
I wont to call a flash exe inside a form I've created.
How can I do this.
(ps: I've heard there is a ocx that can be added but i dont know the name)
Thanx in advance
|
|
|
|