Global variables across projects within a single solution.

Ask general questions here.
jainaakash
Posts: 48
Joined: Thu Jun 10, 2010 12:06 pm

Global variables across projects within a single solution.

Post by jainaakash » Fri Jul 30, 2010 12:50 pm

Hi Team,

I have a Solution which contains multiple projects (VB.NET).
In my startup project, I have declared a public variable which I can access / use in the project.

Now, I want to use the same variable in another project within the same solution. Please let me know how is this possible. I want to have some global variables, and some global objects which are available across all the projects within a solution.

Thanks and Regards,

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Global variables across projects within a single solution.

Post by Support Team » Mon Aug 02, 2010 1:00 pm

Hi,

It is not recommended to use global variables, because a global variable can potentially be modified from anywhere, (unless they reside in protected memory) and any part of the program may depend on it. A global variable therefore has an unlimited potential for creating mutual dependencies, and adding mutual dependencies increases complexity. But anyway, if you want to use it, the best way would be to create a new project where all global variables are nested. This project refer to all other projects you want to use that global variables. Then you should be able to access these variable across all projects.

Regards,
Peter
Ranorex Team
.
Image