473,320 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Reusability


Hi,

I need to create some code that is always available, independently from where I am in the code (constants, global methods, etc.). I know that in VB6 one can create a module, which contains constants, global methods, etc.

What is the equivalent in C# / OOP?

Thanks.
Mike
Nov 16 '05 #1
4 1679
Mike wrote:

Hi,

I need to create some code that is always available, independently from
where I am in the code (constants, global methods, etc.). I know that in
VB6 one can create a module, which contains constants, global methods,
etc.

What is the equivalent in C# / OOP?

Thanks.
Mike


Just add your own class or classes and add properties and methods to them.

--
incognito @ http://kentpsychedelic.blogspot.com/
Nov 16 '05 #2
Hi,

Have your global members (constants, methods, etc) as public/static in a class (say, Global) of your app. Then use them as Global.<member> from other places.

HTH.

"Mike" <no****@nospam.com> wrote in message news:#o**************@TK2MSFTNGP09.phx.gbl...

Hi,

I need to create some code that is always available, independently from where I am in the code (constants, global methods, etc.). I know that in VB6 one can create a module, which contains constants, global methods, etc.

What is the equivalent in C# / OOP?

Thanks.
Mike
Nov 16 '05 #3

Thanks!
"Shiva" <sh******@online.excite.com> wrote in message news:e7**************@TK2MSFTNGP11.phx.gbl...
Hi,

Have your global members (constants, methods, etc) as public/static in a class (say, Global) of your app. Then use them as Global.<member> from other places.

HTH.

"Mike" <no****@nospam.com> wrote in message news:#o**************@TK2MSFTNGP09.phx.gbl...

Hi,

I need to create some code that is always available, independently from where I am in the code (constants, global methods, etc.). I know that in VB6 one can create a module, which contains constants, global methods, etc.

What is the equivalent in C# / OOP?

Thanks.
Mike
Nov 16 '05 #4
You can add a class with static properties and static methods.

i.e.

class Globals
{
public const int MYVALUE = 3;

public static void GlobalHelperMethod()
{
// ...
}
}

--
Scott
http://www.OdeToCode.com

On Sun, 18 Jul 2004 08:05:32 +0200, "Mike" <no****@nospam.com> wrote:

Hi,

I need to create some code that is always available, independently from where I am in the code (constants, global methods, etc.). I know that in VB6 one can create a module, which contains constants, global methods, etc.

What is the equivalent in C# / OOP?

Thanks.
Mike


Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Maellic | last post by:
Hi, The company I work for often develops databases for clients. Those databases always need to do similar tasks. One company might need a database to do task 1 and task 2, while another company...
3
by: popsovy | last post by:
Hi, This is a code reusability question. I want to include a function that sends an email message from my site. I want to include the code for the function only once and then be able to call this...
47
by: mister catering | last post by:
I have a doubt... why is so dificult to reuse software developed under the same language (not only c of course) and under the same compiler?. It seems the language itself is not enough to build a...
0
by: Jerry Mcnealy | last post by:
There is an interesting article on java.net about SOA reusability, Shrinking the Lag between Business and IT: http://today.java.net/pub/a/today/2007/07/24/soa-reusability-shrinking-lag-time.html...
2
by: Max2006 | last post by:
Hi, Is there any way to break a web application into separated web projects, so we can re-use pages\? I am trying to put aspx pages and/or ascx pages in separated web projects,
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.