visual studio - Keep common functions in separate cs file? (C#) -
i have common functions apppath() used in several windows forms of application, instead of declaring in each form, place in separate cs file.
i have created separate class cs file, gave different namespace (modutilities) , put functions inside modutilities class.
namespace modutilities { public class modutilities { // functions such apppath().... } }
but can't figure out how use function modutilities inside different windows forms need it. trying use "using modutilities", instead of creating new instance (modutilities modu = new modutilities()) can me?
if methods static within class, can do
using modutilities;
then
var = modutilities.apppath();
if not, you'll need create instance of class.
modutilities mod = new modutilities();
Comments
Post a Comment