Friday 15 February 2013

c# - Code Analysis Warnings in Visual Studio 2010 - CA1007 -


I changed CA 1007 to error in the rule set. Then I wrote the code below to violate this rule, but still did not recognize it as a warning or error. Not sure where I'm making a mistake, is it in code or in the rule?

  class program {public static zero swap (ref object object 1, ref object object 2) {object temp = object 1; Object1 = object2; Object2 = temp; } Static zero main (string [] args) {string string1 = "swap"; String string 2 = "this"; Object object1 = (object) string 1; Object object 2 = (object) string 2; Program Speech (Ref: Object 1, Ref: Object 2); String1 = (string) object1; String 2 = (string) object 2; Console.light line ("{0} {1}", string 1, string 2); Console.ReadLine (); }}   

Any suggestions? Thanks!

Since program is a private class (it is not a modifier on it) , So it is a mistake for private), the public statutory method is not visible from the outside, to ensure that the public API uses a good signature, but the rules of internal, private and otherwise visible by this rule Are not free.

No comments:

Post a Comment