|
Because a HashTable uses object for both the key and value it is possible to do soemthing like this
Hashtable ht = new Hashtable();<br />
ht.Add("one", 1);<br />
ht.Add(1, 1);
Not very type safe and it incurs the boxing/unboxing penalty. Where as the Dictionary uses the specified types for key and value the above would not be possible (unless you used object as the key)
only two letters away from being an asset
|
|
|
|
|
So basically the two does exactly the same thing, but Dictionary is just type safe? Does a Dictionary also hash the key when storing key/value pairs? They say Hashtables are optimized for fast retrievals and that is what I need for a multi-lingual website.
|
|
|
|
|
Mark Nischalke wrote: ht.Add("one", 1);
ht.Add(1, 1);
|
|
|
|
|
If you have very few items a hashtable is the fastest.
A Dictionary is still a key value pair and boxes unless you use a generic.
Dictionaries are easier to use than a hashtable. But, since you will be storing many words or something, then a dictionary would be more useful to store unique sets. But, then again thats why globalization namespace was made.
1 line of code equals many bugs. So don't write any!!
|
|
|
|
|
Dictionary class is implemented as a hash table and it's a generic class and performance wise it's close to O(1). Therefore I'm not sure why would one use hash table unless for backward compatability.
More here:
ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref2/html/T_System_Collections_Generic_Dictionary`2.htm
Regards.
modified 17-Jul-19 21:02pm.
|
|
|
|
|
I'm trying to wrap my head around this pattern and apply it to some real world designs.
One thing I'm not sure about is whether tiny bits of logic should go out of the View (the WinForms control) and into the Presenter. Take the following code for example:
myMenuItem.MouseUp += MyMenuItemMouseUpHandler;
void MyMenuItemMouseUpHandler(object sender, MouseEventArgs e)
{
if(e.Button == MouseButtons.Right)
{
ShowOurContextMenu();
}
}
That is in the View (it's inside a WinForms control class). Since there is logic going on here, it seems maybe the logic part should be rolled out of the View and into the Presenter. Is that right? If that logic should go in the presenter, what would the code look like?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Hi, Judah.
1. Is ShowOurContextMenu() a part of your IView interface?
2. Does your Presenter know about myMenuItem or this is a private part of your view?
3. Does this behaviour common for all views or it is specific only for the concrete view?
|
|
|
|
|
ShowOurContextMenu is not part of the interface, but it easily could be.
The presenter does not know about myMenuItem.
This behavior is for only one particular view.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Messianic Instrumentals (with audio)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
Then I think you should leave this menu logic in the specific view and don't burden Presenter with it. Presenter must describe the logic which is common for all views.
|
|
|
|
|
i select date field from data base this can be null value
i disply it's data by date time picker i want from the date time picker to
by null value when the field has null value
and when i insert the value to this field sometimes i need null value for intry
how can i solve this problem
thanks for help
MD_NADA
|
|
|
|
|
You can deal with this in the OnFormat and OnParse events of the databinding.
I don't have time to provide an example, but you should be able to find on in MSDN.
|
|
|
|
|
What I wanna know is why they named it a DateTimePicker when you can only pick the date.
|
|
|
|
|
hi,
i have following problem, i have a datagrid that is bigger than my screen, so i have scrollbars (vertical and horizontal).
Now each X seconds, the datagrid is updated with data from the database. So the datagridview is refreshed.
When a user is working on row X, and column Y, and the datagrid is refreshed all the scrollbars get back at position 0. So the horizontal scrollbar is put back to the left side of the screen, and the vertical scrollbar is put back on the top of the screen.
I know how i can get the current cell of the user, and put the cursor back on that row. But how can i make sure that the horizontal scrollbar is put back on a position so the current selected column is viewable?
thx
grtz
|
|
|
|
|
Before you laugh too much ... I am new to this ... so please forgive any obvious questions.
I am needing to represent Government Data (http://www.cotton.org/econ/govprograms/cccloan/ccc-upland-discounts.cfm[^]) using C# as my main platform and SQL 2005 as my Data Source. I would like to represent this data with an XML file (And I presume Displayed by a DataSet) ... I will also need a TreeView that will allow the user to navigate through Saved versions of the same tables.
Any advice would be greatly appreciated.
Sincerely,
Gary
|
|
|
|
|
I'd like to create a C# program that generate the HL7 messages foramt by rooping through the table in database.
I have two tables: Patient and lab result.
I am trying to looping through these tables and generate the HL7 messages. some fields are default and some fields are comming from the database.
Please see the comments
For example,
Here is the data in the tables:
PId lastname firstname
19191919 John Rick
Test Result name
URR 79 John, rick
HGB 11.2 John, rick
and the HL 7 message that generate by the program should look like:
MSH|^&\~|NAPPY|||4|20060705003913||DFT^P03|0|P|2.2
EVN|P03|20060705003913||OVR
PID|||19191919||John^Rick -- -----------> Patient Id 19191919 , and last and first name John^Rick comes from the dataabse
OBX||ST|URR^URR||11||||||R ------------>Lab value: 11 comes from the database
OBX||ST|HCT^HGB||79.2||||||R ----------------->Lab value:79.2 comes from the database
FT1||||20060601||C|ZZ^Load Lab Results^^N^N|||1|||A230||||||586.6 ----------------> A230 comes from the database
BTS|1 -------------------> count of message in file
FTS|1
|
|
|
|
|
Having worked on a medical application that needed to do the same thing we found it best to rely on a third party app for this. Regulatory issues and potential legal issues where not worth writing our own.
Otherwise it's easy to format an output string that is | delimited
only two letters away from being an asset
|
|
|
|
|
can you showme some code examples? I am new to C# and not sure where to start..
|
|
|
|
|
String.Format("PID|||{0}||{1}, PatientID, PatientName);
only two letters away from being an asset
|
|
|
|
|
C# does not produce .obj files, those are object code files, i.e. machine code (.NET does not compile to machine code).
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
Hi All,
can anyone help me on how video in an avi file can be mapped in wave form.
thanks
|
|
|
|
|
I want to know how and where to set Assembly Permission for an assembly.
If in AssemblyInfo.cs then please share a code snippet for doing that.
I'll be really thankful to you.
Best Regards,
Rizwan
|
|
|
|
|
Start->Settings->Control Panel->Administrative Tools->.NET Configuration Settings.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I already new this I was asking How to set these attributes in assembly itself that it requires atleast these permission to successfully do all its operatoion and any zone or user which doesnot allow these permission should not be allowed to even run the assembly
Anyways Thanks alot.
Any Help???
Best Regards,
Rizwan Ahmed
|
|
|
|
|
How is a control programmed to be validated on the browser instead of the server? Is this done by not using the "runat" attribute or is there something else that needs to be done? I would want a control to be validate on the browser to then posted to the browser if the date confirms to anticipated format.
Greg
Coding makes the world go round!!!
|
|
|
|
|
I don't do much ASP.NET but I think that is a control property setting or a Page property setting. Try asking in the ASP.NET forum.
|
|
|
|