By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

How to use class library when anthor class is used

P: n/a
Hello!

I'm trying to build a class library which has a class called
AvestaPlantFunc.
In this project building a class libray exist a class called
AvestaPlantFunc. In this class is there a method called IsBottomMixValid.
Code not relevant for the question has been removed.
This method IsBottomMixValid has one parameter and the type for this
parameter is MeltPracDataGmix meaning passing class reference
MeltPracDataGmix.

Now to my question the definition for class MeltPracDataGmix does not exist
in the same project as
the class AvestaPlantFunc. Class MeltPracDataGmix exist in another project
that build the exe file.

When a class has a reference to another class as in my example is it
nesessary that the full definition to class MeltPracDataGmix is existing in
the same project.

I assume if this was C++ it would be enough to include the class declaration
which is the header file and not the implementation.

But in C# we don't have any header files. So how do I do here?

What is the solution to this problem when the class need another class.
using System;
using MeltPracData;

namespace Common
{

public class AvestaPlantFunc
{
public bool IsBottomMixValid(MeltPracDataGmix mix)
{
//here is there some code
}
}
}

//Tony
Mar 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
tony wrote:
I'm trying to build a class library which has a class called
AvestaPlantFunc.
In this project building a class libray exist a class called
AvestaPlantFunc. In this class is there a method called IsBottomMixValid.
Code not relevant for the question has been removed.
This method IsBottomMixValid has one parameter and the type for this
parameter is MeltPracDataGmix meaning passing class reference
MeltPracDataGmix.

Now to my question the definition for class MeltPracDataGmix does not exist
in the same project as
the class AvestaPlantFunc. Class MeltPracDataGmix exist in another project
that build the exe file.


You need to add a reference to that project then. Just adding the
reference should be enough.

Jon

Mar 20 '06 #2

P: n/a
Hi Tony,
when you want to use a type definition that has been defined inside a
different assembly (either dll or exe) you will need to make sure you include
the assembly as a reference to your project, then if the object you want to
use is inside a different namespace you will have to import the namespace
using the "using" keyword or use the fully qualified name.

You do not need source code because .Net is self describing because each
assembly contains metadata about all of the types declared inside of it. By
just including the reference to an assembly you will get all the information
you need, without having to have source code or header files.

In VS2005 you can reference either a DLL or an EXE but in VS2000 you can
only reference DLL's

Mark Dawson
http://www.markdawson.org
"tony" wrote:
Hello!

I'm trying to build a class library which has a class called
AvestaPlantFunc.
In this project building a class libray exist a class called
AvestaPlantFunc. In this class is there a method called IsBottomMixValid.
Code not relevant for the question has been removed.
This method IsBottomMixValid has one parameter and the type for this
parameter is MeltPracDataGmix meaning passing class reference
MeltPracDataGmix.

Now to my question the definition for class MeltPracDataGmix does not exist
in the same project as
the class AvestaPlantFunc. Class MeltPracDataGmix exist in another project
that build the exe file.

When a class has a reference to another class as in my example is it
nesessary that the full definition to class MeltPracDataGmix is existing in
the same project.

I assume if this was C++ it would be enough to include the class declaration
which is the header file and not the implementation.

But in C# we don't have any header files. So how do I do here?

What is the solution to this problem when the class need another class.
using System;
using MeltPracData;

namespace Common
{

public class AvestaPlantFunc
{
public bool IsBottomMixValid(MeltPracDataGmix mix)
{
//here is there some code
}
}
}

//Tony

Mar 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.