I have created a function in a class. and i want to call it throughout my project. but i don’t want to create the object of that class in every page. is there any global declaration for that class so that we can call in every page ? Inheritance is not possible in code behind file of aspx page .cs file.
Share
You need to create a
StaticMethod in your class so that you can call the function without creating an object of that class as shown in following snippet:to call the function just use
you can have look at MSDN: Static Members
Suggestion
One more resolution to your problem is to make use of SINGLETON DESIGN PATTERN
Intent