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

Reference .cs File From .cs File

I have two classes and a web page: test1.cs, test2.cs, and test.aspx.
I know how to add a reference to test1.cs from test.aspx using the
assembly directive (<%@ Assembly Src="test1.cs" %>). This works fine,
but what if test1.cs needs to call a method from test2.cs. How can I
add a reference to test2.cs from test1.cs without compiling either?

--------test.aspx--------
<%@ Page Language="C#"%>
<%@ Assembly Src="test1.cs" %>
<%@ Assembly Src="test2.cs" %>

<script runat="server">
void Page_Load() {
Response.Write(ns1.ClassOne.SomeMethod());
Response.Write("<br>");
Response.Write(ns2.ClassTwo.AnotherMethod());
}
</script>
--------test1.cs--------
namespace ns1 {
public class ClassOne {
public static string SomeMethod() {
return "return from SomeMethod class one";
//How do I call AnotherMethod() from here???
}
}
}
--------test2.cs--------
namespace ns2 {
public class ClassTwo {
public static string AnotherMethod() {
return "return from AnotherMethod class two";
}
}
}
Nov 18 '05 #1
1 3144
inheritance

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"David" <da*********@zoomtown.com> wrote in message
news:36**************************@posting.google.c om...
I have two classes and a web page: test1.cs, test2.cs, and test.aspx.
I know how to add a reference to test1.cs from test.aspx using the
assembly directive (<%@ Assembly Src="test1.cs" %>). This works fine,
but what if test1.cs needs to call a method from test2.cs. How can I
add a reference to test2.cs from test1.cs without compiling either?

--------test.aspx--------
<%@ Page Language="C#"%>
<%@ Assembly Src="test1.cs" %>
<%@ Assembly Src="test2.cs" %>

<script runat="server">
void Page_Load() {
Response.Write(ns1.ClassOne.SomeMethod());
Response.Write("<br>");
Response.Write(ns2.ClassTwo.AnotherMethod());
}
</script>
--------test1.cs--------
namespace ns1 {
public class ClassOne {
public static string SomeMethod() {
return "return from SomeMethod class one";
//How do I call AnotherMethod() from here???
}
}
}
--------test2.cs--------
namespace ns2 {
public class ClassTwo {
public static string AnotherMethod() {
return "return from AnotherMethod class two";
}
}
}

Nov 18 '05 #2

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

Similar topics

7
by: Pablo J Royo | last post by:
Hello: i have a function that reads a file as an argument and returns a reference to an object that contains some information obtained from the file: FData &ReadFile(string FilePath); But ,...
3
by: Whoever | last post by:
To create Excel file, you can Add Reference Visual Studio.NET, browse to ... and then select Microsoft.Office.Interop.Excel, etc. It endsup some reference to GUID in project file. You can then...
6
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: "...
4
by: dhnriverside | last post by:
HI guys I've just written my first independent namespace for my library (yay me!). However, on trying to add it to my website project, it causes an error when I look at the website. It compiles...
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
2
by: AMDRIT | last post by:
Hello Everyone, I am having an issue with my solution and hoping that you all can suggest a resolution. I have a common library that (A) that three other projects make reference of (B,C,D). ...
3
by: Mike | last post by:
I have a web app that is referencing several web services. When I make a change to a web service (add, modify a method), I have to 'Add Web Reference' for the changes to take affect. If I do 'Update...
3
by: drop | last post by:
Hi all, I'm trying to figure out how references works in Web Application Projects. We have a third party dll that we use in many projects. I've created a folder containing that DLL. That way,...
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
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...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: 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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.