Use Methods in more than one static class
hi guys,
as topic says i'm having few static classes (they have static) , set of methods use in every static class.
the clue is, these methods shall access fields of classes, why (i think) have called within class.
is there way use these methods without copy , pasting in each of static classes?
thanks
simon
>>is there way use these methods without copy , pasting in each of static classes?
no, not if methods access private fields of class in defined since static class cannot derive class.
if have common functionality used in more 1 class, should create non-static base class , put common code in there , create other non-static classes derives base class. makes no sense share class specific funtionality between static classes since static class not related static class.
you of course put methods don't operate on class specific fields in static class , access static class , methods other classes.
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment