instantiating my class

Results 1 to 3 of 3

Thread: instantiating my class

  1. #1
    Join Date
    Dec 1969

    Default instantiating my class

    I&#039;ve written a simple csharp class in it&#039;s own separate file in a subdirectory of my web app. I&#039;ve included a namespace around the class as well. I&#039;m trying to instantiate an object of this class from one of my web forms but am getting:<BR><BR>"The type or namespace name &#039;MyNameSpace&#039; could not be found"<BR><BR>I&#039;m looking for some pointers on how to instantiate one&#039;s own classes.<BR><BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: instantiating my class

    Compile the class into a DLL file. (You can do this in VS.NET by going to Project and then Build, or, if you are not using VS.NET, you must use the commandline compiler, like:<BR><BR>csc /t:library ClassFileName.cs<BR>)<BR><BR>Then, once you have the DLL, copy it to the Web application&#039;s /bin directory. Then you should be able to create an instance of the class in the code of your ASP.NET Web page...<BR><BR>hth

  3. #3
    Join Date
    Dec 1969

    Default would this not require

    adding a reference to the dll?<BR><BR>hmm... here :<BR><BR>MyNameSpace.MyClass e = new MyNameSpace.MyClass();<BR><BR>the easy way :-P

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts