c# - Possible to force the use of a specific method signature in an application? -
we have helper assembly assists developers logging information. specific method used logging has 2 signatures:
logtouls(string message) logtouls(string message, microsoft.sharepoint.administration.spdiagnosticscategory category)
in application have created static class contains instance of spdiagnosticscategory used time application logs something. if first signature used, generic category assigned , harder find logged information specific application.
my question if it's possible force people use second signature time logtouls
called application or need accomplished through programmer education?
if can't remove method codebase, mark deprecated, other programmers compiler warning whenever call (and intellisense warn against usage):
[obsolete("use logtouls(string, spdiagnosticscategory) instead."] public void logtouls(string message) { // ... }
as per obsoleteattribute
documentation, can pass true
second parameter constructor cause compiler error (not warning), may break existing code.
Comments
Post a Comment