|
If I might...
Is it considered really bad practice to do Convert.ToInt32 ?
I have seen stuff (and well, I have used it, too) like:
string x = "10";
int xInt;
try
{
xInt = Convert.ToInt32(x);
}
catch
{
xInt = 0;
}
Would that not do the same as TryParse?
Or is it an unnecessary way around it, or simply, crap?
var question = (_2b || !(_2b));
|
|
|
|
|
Not bad practice, possibly a little slower going via the Convert class but I would have to check the implementation to be sure.
The convert class is great for converting from a built in type to another (not just from string), but I would guess the Int32.Parse or Int32.TryParse methods would be perhaps a little more efficient.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
How can i automatically increments the build number in an AssemblyInfo.cs?
Any example? using macro or function method?
Kelvin
|
|
|
|
|
MS, he say:
The version number has four parts, as follows:
<major version>.<minor version>.<build number>.<revision>
You can specify all the values or you can accept the default build number, revision number, or both by using an asterisk (*). For example, [assembly:AssemblyVersion("2.3.25.1")] indicates 2 as the major version, 3 as the minor version, 25 as the build number, and 1 as the revision number. A version number such as [assembly:AssemblyVersion("1.2.*")] specifies 1 as the major version, 2 as the minor version, and accepts the default build and revision numbers. A version number such as [assembly:AssemblyVersion("1.2.15.*")] specifies 1 as the major version, 2 as the minor version, 15 as the build number, and accepts the default revision number. The default build number increments daily. The default revision number is random.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
williamnw wrote: [assembly:AssemblyVersion("1.2.*")]
I've tried this and I've never been able to get it to work. It always just gives me a version of "1.2.*" on the actual file.
Have you got it working williamnw? (Sorry for hijacking your thread 8kelvin)
For 8kelvin: There are two other options:
1) The AssemblyInfo[^] task can be used to auto increment the version number by modifying the assemblyinfo.cs file prior to the build being run. You just add an include statement to your project file.
2) There's a task in the MSBuild Community Tasks[^] project that can be used to generate a version number and write it into a generated assemblyinfo.cs file prior to the build running. Again, it just requires some additions to your csproj file (or msbuild script if you use it)
To be honest I have problems with both methods in my projects. We have large projects containing multiple assemblies and always end up with references screwed up because one of them is trying to reference versions prior to the number increment, or version numbers getting incremented twice or stupid things like that. This is the one area of our system I'm very unhappy with, but I can't find a decent solution.
Simon
|
|
|
|
|
I just got this version file working. Thanks guys.
For Simon Stevens,
Simon Stevens wrote: It always just gives me a version of "1.2.*" on the actual file.
you need to delete
[assembly: AssemblyFileVersion("1.0.0.0")]
in order to make it work.
Kelvin
modified on Friday, March 20, 2009 2:58 AM
|
|
|
|
|
Thanks. I'll give it a try.
Simon
|
|
|
|
|
Saved me answering, thanks!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hi.
I want to show a control (Like a textbox) with specific opacity !
How can I do it in Win App ?
Could you guide me ?
Thanks in advance.
|
|
|
|
|
I dont think it is posible with built in .Net controls.
You can set opacity of a from, which also alters any opacity for its own controls automatically.
You may have to make a custom control to handle your needs
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi,
How can i get the background colors of all the pixel in a retangle
Thankyou
YPKI
|
|
|
|
|
What kind of rectangle are you talking about?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Read my image processing articles.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
I've a string in RTF with text and emoticons. I can found the text, only the string contain text on the RTF. I cannot extract images. Can someone give comments on that how to do.
Thanks a lot.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
It's not easy.
I worked with RTF a few years ago and it's a real pain. I never did anything with images though, sorry.
Try downloading the RTF Spec[^]. You'll have to read that and understand how images are stored in the RTF file, and figure out how you can extract them.
Simon
|
|
|
|
|
|
I've tried with the RichTextBox in C#. But doesn't work. Only the text can retrieve from the RTF box. Not any icons..
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Hi,
I need to create a windows service in C# what will connect to a Windows Exchange Server via POP3 protocol, and fetch the mails from an account what will be same user on behalf the windows service is running. So I don't want to hard code the authentication infromation what is necessary for POP3 authentication, but I want to use somehow the user information on behalf the service is running.
Does somebody know how can I got the mentioned authentication information?
Thank You in advanced!
Br,
Ernest
|
|
|
|
|
Is Environment.Username the sort of thing you are after?
Regards,
Rob Philpott.
|
|
|
|
|
Partially...
I need user and pass too. I assume I cannot get it in readable format, so I looking for some kind off class what stores all logon information, and I can pass it forward for pop3 authentication.
Thank You!
|
|
|
|
|
Yeah, POP3 is as old as the hills and needs a username/password combination. Windows is not going to give you passwords for obvious reasons. I think you're going to have to create your own mapping from Environment.Username to a POP3 username/password combination.
I guess the password on Exchange will be the same as on the domain. In which case you've got a real problem I'm afraid. Bear in mind too that POP3 is a text based protocol which doesn't do encryption or anything like that, although I think Exchange can SSL it.
Regards,
Rob Philpott.
|
|
|
|
|
|
I didn't know that. Cool. But slightly unpleasant looking...
Regards,
Rob Philpott.
|
|
|
|
|
Thank You! I found it previously, but it isn't solve all of my problems. I still need to give the password manually to the service...
|
|
|
|
|
I've been always wondering on how to show where my applications is currently located in the proccess it is doing.
A good example would be - file moving (big files or something). I would make a "for" loop and go through files located in the selected directory and then move them to some other... but how could i show which file is currently being moved? If i put this inside the "for" - label1.text = file[i]; - it wouldnt show nothing. (as it is too fast to show).
So can you please give me a hint on how to do that? This is not a top priority question. Just my curiosity, so dont judge me on asking how to do it.
Thanks
Have a nice day
Regards,
Matjaž
|
|
|
|