By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,939 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,939 IT Pros & Developers. It's quick & easy.

Can FxCop check my calls to String.Format etc. for parameter countmatch?

P: n/a
Hi, everyone,
The question is whether there is (or can be) an FxCop rule that makes
sure I don't do this:
String.Format("{0}-{1}-{2}", 5);
Or similar things.

Some explanations:
1) of course I only mean cases where the format string is a constant
string literal in the code - that's 99% of the cases anyway
2) similar cases are Console.Write(), etc., I know
Nov 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Uri,

I don't think that there is a rule in there for that. However, FXCop is
extensible, and you can easily write your own rules. Check out the
gotdotnet.com workspace for it, located at (watch for line wrap):

http://www.gotdotnet.com/team/fxcop/

Check out the section titled "FxCop User Samples".

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Uri Dor" <ta****@newsgroups.nospam> wrote in message
news:eD**************@TK2MSFTNGP15.phx.gbl...
Hi, everyone,
The question is whether there is (or can be) an FxCop rule that makes sure
I don't do this:
String.Format("{0}-{1}-{2}", 5);
Or similar things.

Some explanations:
1) of course I only mean cases where the format string is a constant
string literal in the code - that's 99% of the cases anyway
2) similar cases are Console.Write(), etc., I know

Nov 16 '05 #2

P: n/a
Thanks, Nicholas, but actually...
I tried today and didn't see a single sample there.

Nicholas Paldino [.NET/C# MVP] wrote:
Uri,

I don't think that there is a rule in there for that. However, FXCop is
extensible, and you can easily write your own rules. Check out the
gotdotnet.com workspace for it, located at (watch for line wrap):

http://www.gotdotnet.com/team/fxcop/

Check out the section titled "FxCop User Samples".

Hope this helps.

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.