[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using an external namespace (C# class)

Posted on 2002-07-12
6
Medium Priority
?
287 Views
Last Modified: 2010-08-05
Hello Experts,
I'm trying to use a C# class defined in an extra file aaa.cs inside several other bbb.asmx.cs files.
aaa.cs contains global functions.
I expect that it is related to using, alias and namespace.
But I didn't find a good and easy sample to understand that.

Thank you HStrix

0
Comment
Question by:HStrix
  • 3
  • 3
6 Comments
 
LVL 4

Accepted Solution

by:
kpkp earned 80 total points
ID: 7149608
If you are using Visual Studio, yo need to include aaa.cs in your project.  Right click the project name in the soloution explorer and choose add - add existing item.

At the top of bbb.asmx.cs add a 'using' statement for the namespace defines in aaa.cs

For example if the namespace in the top of aaa.cs is defined as

namespace myAAANamespace

Then you need to put

using myAAANamespace at the top of bbb.asmx.cs

In bbb.asmx.cs You will then have access to the public class(es) defined in aaa.cs
0
 

Author Comment

by:HStrix
ID: 7149870
OK so far,
what do I need to do in the case that aaa.cs does not contain a namespace information.
It only contains a class statment 'public class myglob inherits page'.
0
 
LVL 4

Expert Comment

by:kpkp
ID: 7149924
in that case the class is in the default namespace and should be accessable without a using statement
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
LVL 4

Expert Comment

by:kpkp
ID: 7149945
just make sure you include aaa.cs in your project.
0
 

Author Comment

by:HStrix
ID: 7150200
aaa.cs (has class myglob) is now part of the project.
If I'm trying to use the method 'inaaa' in aaa.cs,
I'm getting the message that the method 'inaaa' does not exist in the class or namespace of myproject.bbb.
The project has as members bbb.aspx with code behind bbb.aspx.cs (has namespace myproject and class bbb).

0
 

Author Comment

by:HStrix
ID: 7152133
I got it to work.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question