|
Dear friends,
Small clarification.
Can some one tell me which one will be faster?
int a =100000;
string b = a.tostring();
string c = convert.tostring(a);
string d =""+a;
By
Joe.I
|
|
|
|
|
I think in release mode B and C have the same result. But for the purpose a.ToString() is the best one.
The D case is a coding horror for me.
|
|
|
|
|
Short answer: test it
I took a little look with the Reflector and I'm willing to hazard a guess: the first one. Because: the first one just calls Number.Format(something) which is an extern function, the second one calls int.ToString(some stuff) so basically it just adds a method call (which could be inlined by the JIT engine) and the last one also does some string appending, to which JIT magic may also happen, it might have an "if (first.Length == 0) return Second" and then the optimizer in the JIT compiler might decide that since the string is a constant, its Length is also constant, and then it might optimize that test away and skip the string appending completely.
That is very optimistic.
So, still test it..
Who knows, maybe it's even possible to write a faster IntToString method? I would look into it. Especially if a lot is known about the input (probability distribution etc). I wouldn't count on it, but you don't know until you try..
|
|
|
|
|
I don't know exactly. Test it!
However if you use a lot of int to string and then something like "string total = a+b+c+.... "
where a,b,c are strings obtained from ints than StringBuilder is the fastest and less
memory hungry.
|
|
|
|
|
I want to know how can I place a button or clickable label on the windows task bar so when clicking it will show a window just like Microsoft Windows Search?
|
|
|
|
|
jrahma wrote: I want to know how can I place a button or clickable label on the windows task bar so when clicking it will show a window just like Microsoft Windows Search?
Sounds like you're looking for an "Explorer Band"[^]
I are Troll
|
|
|
|
|
Google for "Windows 7 Taskbar .NET Integration" and you'll find an SDK you can use that might supply what you need.
|
|
|
|
|
Hi
I have cretae one table in database right?
then added Record in datatable finaly i make update datatable using commmand adapter
It work fine with added row
but when i make delete row then it Give error Like
"Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information"
Thanks In Advance,
Jitendra
|
|
|
|
|
You need to use the data adapters delete command to delete a row
More here[^].
There are only 10 types of people in this world — those who understand binary, and those who don't. |
|
|
|
|
|
Dear all,
I made a setup project for my application. How can i set my onw logo in the setup wizard windows?
Thanks
|
|
|
|
|
In the user interface designer you can change the banner bitmap property to your own image.
|
|
|
|
|
hi,
Can I change the buttons labels from the setup ?
I mean: a button label "NEXT" to this "->", or a button label "CANCEL" to "EXIT SETUP"
Cheer's,
Alex Manolescu
|
|
|
|
|
Not in the Visual Studio designer, though I believe you can control that if you use WIX[^] or some other installer designer to create your installer package.
|
|
|
|
|
It's not easy, but you can add custom dialogs to Visual Studio setups: link.
|
|
|
|
|
Thanks,
I found that, however there is another issue, the size of the logo.
I made it 500px/70px, bud still it takes all the space on the welcome text section. I even made it smaller then 500/70 px, it still does not fit into the wizard
modified on Tuesday, January 12, 2010 7:51 AM
|
|
|
|
|
I have developed a web applicaiton in c#
I have created a test case using c# but how do i run it with "gui runner"
There is no executable ?
Would appreciate any help or pointers to information source.
Thank you in advance
G.
|
|
|
|
|
Hello, I have a routine that loops through all the controls on my form.
The purpose is to set the Edit Mode or Read Only mode.
To find textboxes and buttons inside a TabPage or GroupBox the routine runs recursive.
To convert a Windows.Forms.Control in to a Texbox I validate and use ..
if (c is TextBox)
{
ToggleTextBox((c as TextBox), flgEditMode);
}
So Far So Good.
If I do the same for a ToolStripButton I get the message:
Cannot convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.ToolStripButton'
Please can you help me with a work around?
Kind regards Arjen
|
|
|
|
|
Hello,
The ToolStripButton class doesn't Inherit from Control .
Inheritance Hierarchy:
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.ToolStripItem
System.Windows.Forms.ToolStripButton
So you have to look for the ToolStrip class (which inherits from Control ) an than iterate over the Items property.
Like this:
foreach (Control c in this.Controls)
{
if (c is ToolStrip)
{
ToolStrip ts = c as ToolStrip;
foreach (ToolStripItem tsi in ts.Items)
{
ToolStripButton tsb = tsi as ToolStripButton;
if(tsb != null)
{
...
}
}
}
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Dear Martin,
Thank you for your quick reply and solution!
With kind regards,
Arjen
|
|
|
|
|
ArjenGroeneveld wrote: Thank you for your quick reply and solution!
Glad I could help!
All the best,
Martin
|
|
|
|
|
I have created a tablelayoutpanel with 2 columns. data is being retrieved from sql server and linklabels are being generated at runtime for each data in the tablelayoutpanel. My question is how do i generate a click event on the linklabel created at runtime inside the tablelayoutpanel.
very urgent.
thanks
Maneesh
|
|
|
|
|
It's done the exact same way you wire up any other event in C#. Lesson 1[^]
|
|
|
|
|
|
Hey there
It seems that from .Net 3.0 and onwards the System.Speech assembly was added: Article[^]
Hope this helps
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
Thank you
the accent isn't good
can you give me another example ?
|
|
|
|