The title is pretty much my entire question.
I'm doing a code review for an off-shore developer who has several static methods inside a non-static class. Before I challenge the developer and mark this as "needs changing", I just want to make sure.
I understand the purpose of a static class: It can not be instantiated and can be used directly. But I can't see any reason to have a static method in a non-static class. Is there any valid use-case for this?
The methods in question are all private
and are called from non-static methods.
Here's an example:
public ViewResult ClaimDetails(ClaimDetails claim)
{
if (claim.ClaimNumber != 0)
{
claim = Get_ClaimDetails(claim);
}
return View("ClaimDetails", claim);
}
private static ClaimDetails Get_ClaimDetails(ClaimDetails claim)
{
ClaimsRepository claimsRepository = new ClaimsRepository();
_claimDetails = new ClaimDetails();
_claimDetails = claimsRepository.GetClaimDetails(claim.ClaimNumber);
return _claimDetails;
}