RuleArgs -> GetPropertyName function

RuleArgs -> GetPropertyName function

Old forum URL: forums.lhotka.net/forums/t/7483.aspx


rxelizondo posted on Wednesday, August 19, 2009

Hi,

There is a function called GetPropertyName() inside the RuleArgs that is defined as follows:

public static string GetPropertyName(RuleArgs e)

Does anyone have any insight on why this function was declared as static? It looks to me like it would have been more appropriate to have declared this function an instance function rather than static but that just me.

I do realize that it does not really matter if the function was declared as static or instance and that it’s a matter of preference but I can’t help being curious about what was the train of thought that lead to making this function a static one rather than instance.

RockfordLhotka replied on Monday, August 24, 2009

I don't recall the exact thought process, that was a long time ago :)

I suspect my thinking was that the method might be useful in other scenarios and making it static would make it more broadly accessible - but that's just guessing at this point.

rxelizondo replied on Thursday, October 29, 2009

Since we have been talking about refactoring, please keep this post in mind.

I think changing the GetPropertyName() function to an instance method would be harmless and it would be incredibly easy for people to fix in their own code.

Why fix it when is not really a must?? Well, because I think is the right thing to do of course :)

Copyright (c) Marimer LLC