473,394 Members | 1,774 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,394 software developers and data experts.

Seperating Classes

Hi,

am writing c# web applications and am trying to now seperate my code
into seperate DLLs. Mainly so that the code is easier to manage and I
can more easily 'plug in' seperatepieces of code without having to
trawl through a single page of thousands of lines of code.

is probably something simple but am having trouble finding the answer.

Basically I want a main DLL which is called by the .aspx page and then
below that I want seperate DLLs which hold different classes /
functions. the closest i have got is with the following :

FIRST DLL CODE :

using System;
using System.Web;
using System.Web.UI;

namespace WHATEVER.TEMPLATE.Web
{

public class TEMPLATEPage : System.Web.UI.Page
{
}
}
Dec 4 '07 #1
3 1283
Hi,

am writing c# web applications and am trying to now seperate my code
into seperate DLLs. Mainly so that the code is easier to manage and I
can more easily 'plug in' seperatepieces of code without having to
trawl through a single page of thousands of lines of code.
is probably something simple but am having trouble finding the
answer.
Basically I want a main DLL which is called by the .aspx page and
then
below that I want seperate DLLs which hold different classes /
functions. the closest i have got is with the following :
FIRST DLL CODE :
using System;
using System.Web;
using System.Web.UI;
using GDD.WHATEVER;

namespace WHATEVER.TEMPLATE.Web
{
public class TEMPLATEPage : System.Web.UI.Page
{
public string strTest=setParameter.strTest();
}
}

in the second DLL I have :

using System;
using System.Configuration;
using System.Web.Mail;
using System.Web.UI;

namespace WHATEVER.CMN
{
public class setParameter
{
public string strTest()
{
return "Hello";
}
}
}

Ideally I would like to set some public variables in the second lot of
code that is accessible from the first and from the main .aspx pages
at the front.

When compiling i get the error :

An object reference is required for the nonstatic field, method or
property 'WHATEVER.CMN.SetParameter.strTest()'

also have got

'WHATEVER.CMN.SetParameter' is inaccessible due to its protection
level...?

pretty stuck, any ideas please...
Dec 4 '07 #2
ok third time lucky ;)

that top 'using GDD.WHATEVER; '

should read 'using WHATEVER.CMN; '
Dec 4 '07 #3
On 4 Dec, 01:15, Andrew G <agreg...@hotmail.co.ukwrote:
ok third time lucky ;)

that top 'using GDD.WHATEVER; '

should read 'using WHATEVER.CMN; '
You're trying to treat strTest as a static variable.

Try something like:

{

public class b
{
private string GetStrTest = c.strTest; //works as strTest is static
private string GetStrTest2; //set in constructor

public b() //constructor
{
c aC = new c();
GetStrTest2 = aC.strTest2; //strTest2 is not static so need to
create a c
}
}
public class c
{
public static string strTest = "test";
public string strTest2 = "test2";
}
}

Dec 4 '07 #4

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

Similar topics

5
by: TonyB | last post by:
Hi, I've searched the group and need more information and guidance on this issue I need to resolve next week. I work for the local school system and I am working on a way to parse a CSV file of...
1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
9
by: Jack | last post by:
Hello I have a library of calculationally intensive classes that is used both by a GUI based authoring application and by a simpler non-interactive rendering application. Both of these...
6
by: Jo K. | last post by:
I have a bounded field called Name. It's used to type in the full name of a customer (intentionally set up that way instead of seperating the first and last names) I would like to be able to...
2
by: joye | last post by:
Hello, My question is how to use C# to call the existing libraries containing unmanaged C++ classes directly, but not use C# or managed C++ wrappers unmanaged C++ classes? Does anyone know how...
18
by: Edward Diener | last post by:
Is the packing alignment of __nogc classes stored as part of the assembly ? I think it must as the compiler, when referencing the assembly, could not know how the original data is packed otherwise....
0
by: AnkitAsDeveloper [Ankit] | last post by:
As all we know, in order to remove cyclic includes in C++ we seperate the declarations and definitions of classs and it's member in two files Header (*.h) and source files (*.cpp). This is not a...
6
by: ivan.leben | last post by:
I want to write a Mesh class using half-edges. This class uses three other classes: Vertex, HalfEdge and Face. These classes should be linked properly in the process of building up the mesh by...
0
by: ivan.leben | last post by:
I am writing this in a new thread to alert that I found a solution to the problem mentioned here: http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7970afaa089fd5b8 and to avoid...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.