Here is my code:
C# |
I appreciate the help
C# |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted Jul 20, 2010, 11:24 AM EDT
That's a part of code performance checking from VS 2010. A variable is using without a default value. So u need to change ur declaration like below i.e. with default value
string anotherStr = string.Empty;
Ben5 reputationPosted Jul 20, 2010, 11:49 AM EDT
Thanks a lot for the help
theLizardRank #1,079 · 1.8K reputationPosted Jul 20, 2010, 2:17 PM EDT
Sam HobbsRank #107 · 20.5K reputationPosted Jul 20, 2010, 7:26 PM EDT
Jaish MathewsRank #225 · 11K reputationPosted Jul 21, 2010, 12:13 AM EDT
It's actually not additional code, but optional only. All code analysis mesages are optional. i.e. if you don't need VS to check some of code analysis, you can ternoff by right click on the machine and select supress. It may nt available in express edition. But in team system version I am seeing it.
Sam HobbsRank #107 · 20.5K reputationPosted Jul 21, 2010, 5:14 PM EDT
Ben5 reputationPosted Jul 21, 2010, 8:53 PM EDT
manas maadul3 reputationPosted Jul 22, 2010, 7:16 AM EDT
Jaish MathewsRank #225 · 11K reputationPosted Jul 22, 2010, 11:18 AM EDT
It was typo. I meant for message, not machine.
Right click on the error message displaying in VisualStudio and select supress message to skip that part by FxCop[This is the internal tool doing code analysis] .It may not available in express edition. But in team system version I am seeing it.
Sam HobbsRank #107 · 20.5K reputationPosted Jul 22, 2010, 11:58 AM EDT
Are you sure that the message is just a warning? I thought that .Net requires that string objects be initialized.
Jaish MathewsRank #225 · 11K reputationPosted Jul 23, 2010, 7:08 AM EDT
You are right. The supress message is for un used variables, not for non initialized variables. More over after any VS 2005 version you will get this error. Below link saying about that why made this change.
http://msdn.microsoft.com/en-us/library/4y7h161d.aspx