Keep common functions in separate cs file? (C#)

c#, function, visual-studio, visual-studio-2008

Solution

if your methods are static within the class, you can do

using modUtilities;

then

var something = modUtilities.AppPath();

if not, you'll need to create an instance of the class.

modUtilities mod = new modUtilities();

Problem

I have a common functions AppPath() that is used in several windows forms of my application, instead of declaring it in each form, I would like to place it in a separate cs file. I have created a separate class cs file, which I gave a different namespace (modUtilities) and put all functions inside a modUtilities class. ``` namespace modUtilities { public class modUtilities { // all functions such as AppPath().... } } ``` But I can't figure out how to use function from modUtilities inside different windows forms where I need it. I am trying to use "using modUtilities", instead of creating new instance (modUtilities modU = new modUtilities()) Can someone help me?

Original source