|
The link I provided is for C++, but the same concept applies to C#.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
And yet is still isn't generic
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
TJoe wrote: In .Net, the class should really implement ICloneable
Not so quick, read Community Content down there
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
I did and I doubt Jonathan speaks for Microsoft. I agree with wekempf's last post. Copy constructor does specify whether it's a deep or shallow copy either. In addition, the ICloneable allows derived classes to more easily override the copy behavior. Finally, there is no way (aside from reflection) to tell if an object has a copy constructor. With the ICloneable interface, you can easy do "if (obj is ICloneable)".
-- Update: I see now that the MS guidelines recommend to not use it. But there are still applications for this interface.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
I'm not going to join debate about copy ctor vs ICloneable now However I wanted to point out there is a debate.
TJoe wrote: -- Update: I see now that the MS guidelines recommend to not use it.
This is where I first saw that
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
N a v a n e e t h wrote: Why a class needs another instance of the same class to be passed as parameter.
You can use this pattern when you want to inicalize your instance using copy of data from another instance.
If you look at XmlSerializerNamespaces with Reflector, you see:
public XmlSerializerNamespaces(XmlSerializerNamespaces namespaces)
{
this.namespaces = null;
this.namespaces = (Hashtable) namespaces.Namespaces.Clone();
}
[ My Blog] "Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - Rüdiger Klaehn "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Yes that made it clear. Thanks
|
|
|
|
|
For data / transactional apps such as LOB, we all want the user to view and update an object (which is usually OR mapped to a datastore) or a list of objects.
I am looking for a UI control which generates a screen at runtime based on the properties AND methods of an object. The PropertyGrid of the ComponentModel does a wonderful job but I cannot present that to users.
Also, its Reflection/Attribute driven model means the end-users cannot influence many of the display characteristics. I am fully prepared to implement an interface which the UI control imposes on me.
Such an interface can request the properties to display, the order, the category, which are updateable, default values, help, and whatever other wonderful things the UI control can do with the info it gets from the interface.
It can also ask me to save any changes the user made (which is limited to the UI type of properties such as position, size, order, etc), so the user can customize his display.
ITypedList (which is used by most grids) is a good example with its GetItemProperties method, why can't PropertyGrid also use such a method iso Attributes ?
But displaying and maintaining properties is only the beginning. Why not include methods, which are then displayed as buttons (or context menus or some other wonderful thing). When the user
clicks on a button, the UI requests values for each parameter from the user (but only after requesting defaults, allowed values, help, etc for each parameter from the implementor of the interface).
This way, Reflection/Attributes represents only one of many ways to influence the UI. I can implement the interface such that the info is called from some config file or metadata database.
Is there something like that or am I missing something ?
|
|
|
|
|
Hello Nico,
sorry for the plug, but you seem to like the PropertyGrid but at the same time you regret it's not flexible enough at runtime. Did you try Smart PropertyGrid? It has been developed from scratch for flexibility and usability (this one, you can present it to your users)...
Let me know in the visualhint helpdesk if you have any question.
|
|
|
|
|
I am running into a weird situation right now. I have a UserControl that contains a MenuStrip. I want to hide certain items depending on the access level of the current user. When I set the top level menu item's Visible property to false...nothing happens and the item is still visible.
There are no references to any of the items anywhere else in the code so I am 100% sure that its not getting set back. If I set the Visible property to false via the designer...it works. Anyone ever encounter this or know whats going on??
|
|
|
|
|
In designer it's working?! Hmm and are you sure, if all of the controls on the menustrip should have Visible property = false ? [Menustrip have Controls property, which is collection of controls placed on that strip].
VirtualVoid.NET
|
|
|
|
|
|
i don't understand u'r question...but still is this what u want..
if(gridview.rows.count == st)
Message.show("Hello");
Koushik
|
|
|
|
|
Pish, editing you message as i type a reply.
My current favourite word is: Waffle
Cheese is still good though.
|
|
|
|
|
suppose st = 5;
i insert the row in gridview. I want to insert a according to variable suppose st=5; when gridview = st then appear message.
|
|
|
|
|
Why did you delete your original question? I didn't see it, so now I have no idea what you are talking about.
---
single minded; short sighted; long gone;
|
|
|
|
|
1) Is there any way of determining/measuring the extent of the floating point part of my computation (as a % of runtime)?
2) Also, is there any way what to determine what currently dominates in my application - (I/O) or compute?
I guess what I need are some sort of monitoring functions?
Cheers
|
|
|
|
|
For 1.) Check out the PerformanceCounter class...you can set it to monitor the % of a method.
For 2.) I take it you want to find out what part of your application is most CPU intensive? If this is the case then check out in Visual Studio: (From the menu)
Tools->Performance Tools->Performance Wizard
This will get you started on getting statistics on all of your project's contained Methods.
|
|
|
|
|
Thank you.... I will check out the PerformanceCounter Class.
I can't find the performance wizard in the tools menu. Is this available in VS 2003?
|
|
|
|
|
I believe it is new to 2005. Check out FxCop
|
|
|
|
|
A better idea. Get a profiler. This[^] is a fine example of one from RedGate.
|
|
|
|
|
I have a csharp windows application, i am using Mysql database, i need to provide a utility from the application to backup and restore database.
I can run the following commands from the Dos shell, but i need to run the same from the csharp code. I used the folder browser and file dialog to get the path
and created the following string "mysqldump -u root -p XXXX emanage > c:\emanage.sql" . can some one help me out by telling how to run a command from csharp code.
Thanks in advance
|
|
|
|
|
To run a command in DOS generally
System.Diagnostics.Process.Start("cmd", "command comes here"); is used
-- modified at 7:34 Thursday 11th October, 2007
Koushik
|
|
|
|
|
The the above script just opens the dos console and does not run the command in the entered string. How do i run the command automatically.
|
|
|
|
|
Hey why don't u keep the required command in a batch (.bat) file and then run the batch file using..
System.Diagnostics.Process.Start(@"filename");
Koushik
|
|
|
|