TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
aidin
NA
4
0
How do you use classes that are in seperate files !?
Dec 29 2003 8:54 AM
I"m new to C#. Something that is really easy in Java & C++, I can't seem to get it work in C#. When you make a class yourself in Java, you create a file called for example "File1.java" when you compile this it gets compiled in to a file called "File1.class" Lets say I want to make an object of a class that is in "File2.class" In "File1.class" You will have to define: Import File2.class; // The only condition is that both classes have to be in the same directory. After that you can start making objects of the File2 class. What I've learned from C# is that it is NOT necessary for the class name to have the same name as the file name. In C++ you would just simply write: #include "File1.h" // The name of the header file... Right now I'm using ASP .NET with C#. In my "example.aspx" file I have: <%@ Page inherits="File1" src ="CodeBehind.cs" %> In my "CodeBehind.cs" file I have: using System; using myown; public class File1 : Page { //Here I want to make an object of the second class "File2" that is in a seperate file ! I called the second file "SecondFile.cs" namespace myown; public class File2 { // Definitions of properties, methods, fields, and events. } MY QUESTION IS: HOW DO I TELL THE "CODEBEHIND.CS" FILE THAT IT HAS TO LOOK IN "SECONDFILE.CS" TO FIND THE CLASS "FILE2" This shouldn't be very hard !???? Anybody HELP !?
Reply
Answers (
1
)
What is serialization?
Forms Count in C#