|
BadKarma wrote: This is not entirely true. string is a special class. It is indeed a reference type but it behaves like a value type.
There is nothing special about the string class. It may seem like it behaves like a value type, but actually it doesn't.
BadKarma wrote: If it was a reference type like any other the following should return true but it doesn't.
It's a reference type just like any other, and just as with any other reference type, replacing a reference to an object neither changes the content of the object nor any other reference to the object.
This is what the code is doing:
1. Declare a string reference called "s1".
2. Get the reference to the "hello" literal string.
3. Store the reference in the "s1" variable.
- The s1 variable now contains a reference to "hello".
4. Declare a string reference called "s2".
5. Get the reference from the "s1" variable.
6. Store the reference in the "s2" variable.
- The s2 variable now contains a reference to "hello".
7. Get the reference to the "world" literal string.
8. Store the reference in the "s1" variable.
- The s1 varaible now contains a reference to "world".
9. Compare the contents of the strings that s1 and s2 reference.
- As s1 references "world" and s2 references "hello", the comparison returns false.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
If you must do something, use string.Empty as a temporary value.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: If you must do something
Christian Graus wrote: use string.Empty as a temporary value
Will this cause the new to be called?
// "In the end it's a little boy expressing himself." Yanni
while (I_am_alive) { cout<<"I love to do more than just programming."; }
|
|
|
|
|
Nope, it simply changes your variable's reference to refer to an empty string.
modified on Wednesday, June 11, 2008 12:56 PM
|
|
|
|
|
S. Senthil Kumar wrote: Nope, it simply changes your variable's reference to refer to an empty string.
Which means if the variable is null, it news a string and assigns it to the variable.
// "In the end it's a little boy expressing himself." Yanni
while (I_am_alive) { cout<<"I love to do more than just programming."; }
|
|
|
|
|
Hamed Mosavi wrote: S. Senthil Kumar wrote:
Nope, it simply changes your variable's reference to refer to an empty string.
Which means if the variable is null, it news a string and assigns it to the variable.
Nope. The empty string already exists as a constant, so there is no new string object created.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Got it. Thanks.
// "In the end it's a little boy expressing himself." Yanni
while (I_am_alive) { cout<<"I love to do more than just programming."; }
|
|
|
|
|
No, it's an empty string, your string would have a reference to it, that's the point of using it.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
string.Empty has no advantage over the literal "" ; I see no point in its inclusion in the framework.
|
|
|
|
|
I'm trying to do a minor upgrade from v1.0.1 to 1.0.2 for instance.
I change the version code and visual studio recommends that I change the product code. If I do this though I end up with 2 versions of the software installed. If I don't do it I get an error when I attempt to install telling me that the program is already installed.
How do i get the installer to just overwrite the stuff it needs to without forcing the user to manually uninstall and without them ending up with a ne add/remove programs entry everytime they upgrade?
Cheers,
Russell
|
|
|
|
|
This is typically a nightmare, especially with the under powered installation stuff built into VS. You probably need to buy a real installation tool.
However, what I tend to do, is deploy patches that just replace the exe. I write the path to my exe in the registry, so I can easily write an app that finds the path, and copies in a new exe.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
I might end up resorting to something like that but I'll try leppie's approach for the moment as I'm a bit up against it time wise at the moment.
Cheers,
Russell
|
|
|
|
|
Russell Jones wrote: How do i get the installer to just overwrite the stuff it needs to without forcing the user to manually uninstall and without them ending up with a ne add/remove programs entry everytime they upgrade?
After several attempts to get that working back in the haydays of VS2003, I gave up, chose NSIS, and never looked back.
|
|
|
|
|
Thanks leppie,
I played with NSIS a while back, it's pretty cool as I remember I'll take a look.
Do you get it to create packages as part of the build process?
Russell
|
|
|
|
|
It is quite powerful, and sure it could be run from the commandline, but the learning curve for more advanced stuff is a bit high!
|
|
|
|
|
can it add stuff to the GAC, or should i put all the GAC stuff for my app in an msi and add i that way?
|
|
|
|
|
You just use nsExec I think, so you can do exactly what you do on the commandline, also look at the .NET detecting script example, you will probably need that path.
|
|
|
|
|
Seeing you strapped for time, have a look at InnoSetup too, also very flexible, and much easier to learn.
|
|
|
|
|
there's a "RemovePreviousVersions" property that you can set to TRUE to take care of that for you.
|
|
|
|
|
Hi Russell,
I'm pretty sure the answer you need is in the post from Jimmanuel.
One other thing to keep in mind is, when the user runs the newer installer, with the higher numbered installer version, different product code, and RemovePreviousVersions property set to True, the older version is removed then the new one installed.
If the installer is adding Registry entries or other changes beyond just files, they might get undone. There are properties to control some of these things as well.
Good luck!
BDF
A learned fool is more a fool than an ignorant fool.
-- Moliere
|
|
|
|
|
That's not the effect I'm seeing here.
I have removepreviousversions set to true I have updated the version number and the product code and I still have 2 entries in add/remove programs
Russell
|
|
|
|
|
I'm not sure why that would be. I'll give you all the details I can remember from my recent struggle with this issue.
We're using VS 2005 to build the apps and services, written in C# targeting .NET 2.0. The installers are also created with VS 2005. The version scheme I'm using for the product is currently 2.0.4.*. When I have a new build to test, I change the version of the installer from 2.0.400n to 2.0.400n+1. (Unfortunately the installer version is limited to x.x.xxxx rather than the same scheme allowed for the programs.) After I change the installer version number, VS asks me if I want to change the ProductCode. I choose "Yes" keeping my eye on it to make sure it changes. (Always has.)
As discussed earlier, RemovePreviousVersion is set to True. Two other things that I know are involved, which you might want to check, are these. Do not change the UpgradeCode, although it seems like a logical thing to do. Second, the value of DetectNewerInstalledVersion, should be set to True.
(From my mixed-up way of thinking, ProductCode and UpgradeCode should be switched around.)
When the n+1 installer runs, it removes the older files and directories installed by the n installer. It also removes all Registry settings, which is an issue I need to deal with in the future, and it removes its previous entry in the Remove Programs list. The n+1 installer then creates new directories, puts files in them, and adds a few things to the Registry.
Prior to making .msi installers, we were using installers produced by Setup Factory (Version 7.) These .exe installers would simply overwrite existing files on the hard drive with newer ones from its cache of compressed files. I think it's based on the time stamp of the file rather than any version info that may be in the file. I know others have suggested some other alternatives as well.
Hope that helps.
BDF
A learned fool is more a fool than an ignorant fool.
-- Moliere
|
|
|
|
|
how to set font size body color in c# web application(.cs file) in c# codebehind (set this in codebehind not in .aspx ).plz suggest a sol for this.
with regards
priya.
priya
|
|
|
|
|
senpriya wrote: codebehind
I guess you wanted the ASP.NET forum ?
To do this for the whole page, you need to wrap the page in a control, such as a placeholder, so you can set the properties in the style of that control and all it contains. Same as HTML works.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
1. Learn to read, as you are posting it in the wrong forum. Try ASP.NET one instead.
2. Not very hard. But it depends on whether you are using WebControls or HtmlControls, so refer to solution #1 and seek the answer there (with a bit more specific information).
|
|
|
|