|
Hi gurus, I'm looking for a collection that combines the functionality of a list and dictionary. I basically want to be able to keep the order in which the items are added and at the same time do fast lookup? O(log n) as opposed to O(n), does this thing exist or do I have to write it myself?
Regards
|
|
|
|
|
If you can use a SortedDictionary, it's loopup is a O(log n) operation.
Otherwise you need to write it yourself. Just wrap a List and a Dictionary in a class, write an Add method that adds an item to both collections, and properties to get the values by index and by key.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guess you have to write it yourself, like KeyList<T> with members List<T> and Dictionary<T> to which you delegate. But then I'm not a guru...
|
|
|
|
|
Thanks guys for your replies, seems like I'll have to write myself .. just wanted to be sure I'm not wasting my time in reinventing the wheel ..
|
|
|
|
|
Does SortedList in the System.Collections.Generic namespace not work for you? It has a GetByIndex method along with key lookup!
|
|
|
|
|
Thanks for your reply, actually I want to keep the same order in which items are inserted, this is why SortedListed and SortedDictionary are not suitable for the job ..
|
|
|
|
|
Greetings!
I'd like to do this:
I have a Button which defines the value of a bool Parameter:
public bool ListenMode { get; set; }
private void Button_Click(object sender, RoutedEventArgs e)
{
ListenMode = !ListenMode;
}
Further I have a Grid which can contain certain Items.
What I want to do is, that if ListenMode is true, and the next element clicked on is one of those Items, get the item.
The problem (if it is one) is, that I don't know how to catch all the next clicks while ListenMode is true.
Any suggestions would be apreciated.
PS: It's done in WPF if this is of any matter.
Thank you in advance,
eza
|
|
|
|
|
hi friends
i am working on a project. in this project we simulate a search engine to achieve some specific information about our users.
in this search engine i want to save the rank of a site in the database. but i dont know how can i get the rank of a site programmatically??? i write this application with c#.net
thank you for your reply.
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
First you have to specify what the rank for a web site should be in your application.
After that you should know what the input data needs to be so that you can collect it, and what formula to use to calculate the rank from the input data.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
thank you
but i did it, i calculate rank t any site with my formula
but i want to save google page rank( with google formula) too.
there are some site to get u a google page rank if u enter the url address on it.
i want get the google page rank in win application with c#.net
nobody help you...
you have to help you yourself
and this is success way.
|
|
|
|
|
I want to get the data while single or double clicking the row in the view grid in C#.NET2.0.
|
|
|
|
|
Use event DoubleClick from DataGridView.
If the event comes, then read the value, for example :
dataGridView1.SelectedRows[0].Cells[0].Value
|
|
|
|
|
Can someone give me an search and replacement pattern to regular expression for this convertion.
From text:
for (<br />
; rs.Read(); <br />
)<br />
{<br />
AddFromRecordSet(rs);<br />
}
To text:
while(rs.Read())<br />
{<br />
AddFromRecordSet(rs);<br />
}
Thanks.
With greate code, comes greate complexity, so keep it simple stupid...
|
|
|
|
|
I don't see any candidate for a regex here, what are you trying to do ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
|
I think I found the answer, let me know if its wrong:
Search pattern: \bfor\b \((.*?);\s(.*?)\;(.*?)\)
Replace pattern: while($2)
RegOption.Singleline = on
With greate code, comes greate complexity, so keep it simple stupid...
|
|
|
|
|
Is it possible to create a installer/setup file and make it as a CD and we should use this CD in one PC. If that CD is already used in particular PC and that CD should not support other PC. Is this possible.
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
1. That is no possibilities to write to CD (except if you have a CD Recorder)...
2. It's like Mission Impossible ... this CD will be explode in 5 sec..
Change your application, that the user must be register first.
If you create a serial number for that PC, you must take for example MAC-Address for the serial number.
That means, that serial number is valid only for that MAC-Address. Not for other PC.
|
|
|
|
|
I have saw some software CD's that can be used in only one PC. If that CD is used in one machine you cannot use that CD in another machine. I heared that they have used embedded systems. I did not find any clue please advice
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
I found one implementation here[^]. But I need similar functionality in C#.
Any Ideas?
Thanks
Sukhjinder...
|
|
|
|
|
|
Another Link I found on the above mentioned page http://msdn.microsoft.com/en-us/library/ms996463.aspx[^]
It seems I need to work with low level implementations (Windows Messages/Hooks, etc.). I'm looking for something which works well with MS .NET runtime and possibly with Mono as well.
It would be great if I can find some custom (not extended) implementation of OpenFileDialog with Preview box...
Thanks for all the information...
Looking for help on my OpenSource Media Player LetsYo
|
|
|
|
|
The OpenFileDialog Class is also using Windows API.
That means, you must search it again. Until now, I don't found any 100% .NET Codes of FileDialog.
|
|
|
|
|
Hi All
Already developed client(Developing for OPC) I am having code like below
1. OPCserverObj = Activator.CreateInstance( typeofOPCserver );
2. ifServer = (IOPCServer) OPCserverObj;
// connect all interfaces
3. ifCommon = (IOPCCommon) OPCserverObj;
4.ifBrowse = (IOPCBrowseServerAddressSpace) ifServer;
5.ifItmProps = (IOPCItemProperties) ifServer;
6.cpointcontainer= (UCOMIConnectionPointContainer) OPCserverObj;
Create different types of objects(type castings) with the same source object.
Note: IOPCServer, IOPCCommon, IOPCBrowseServerAddressSpace ..etc are different Interfaces.
How to achive this? How to decalre to object to get all 6 points.
Thanks in advance for your help
Satya
|
|
|
|
|
How about:
typeofOPCserver OPCserverObj = (typeofOPCserver)Activator.CreateInstance( typeofOPCserver ); ??
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|