Another example:
using System;
namespace NS {
class Class1 {
[STAThread]
static void Main(string[] args) {
NewNS.NewNS ns = new NewNS.NewNS();
Console.WriteLine(ns.thevalue);
}
}
}
namespace NewNS {
public class NewNS {
public string thevalue= "Got C#?";
}
}
Build, no errors, executes just fine.
With namespaces and classes the same, you just need to watch out for
which item your referring to. For example if I had:
using System;
namespace NS {
class Class1 {
[STAThread]
static void Main(string[] args) {
NS ns = new NS();
Console.WriteLine(ns.thevalue);
}
}
public class NS {
public string thevalue= "Got C#?";
}
}
Notice:
NS ns = new NS();
Is referring the the class within the same namespace. In this instance,
I would not be able to specify the namespace directly like:
NS.NS ns = new NS.NS();
/rob
-----Original Message-----
From: David L. Penton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 12:12 PM
To: ActiveServerPages
Subject: RE: ASP.NET: Namespace registered, but datatype not recognized
Since when?
http://www.davidpenton.com/testsite/scratch/namespace.conflict.aspx
David L. Penton, Microsoft MVP
JCPenney Technical Specialist / Lead
"Mathematics is music for the mind, and Music is Mathematics for the
Soul. - J.S. Bach" [EMAIL PROTECTED]
Do you have the VBScript Docs or SQL BOL installed? If not, why not?
VBScript Docs: http://www.davidpenton.com/vbscript
SQL BOL: http://www.davidpenton.com/sqlbol
-----Original Message-----
From: Matthew Small [mailto:[EMAIL PROTECTED]]
I figured it out... I can't have the namespace the same as the class.
Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com
-----Original Message-----
From: Matthew Small [mailto:[EMAIL PROTECTED]]
Hi,
I have just written a small class for some custom list functions
that I am planning to use in this app and future web apps that I create.
I have compiled it with no problem, but when I try to use it in my app,
the datatype is not recognized. Any ideas? I've done this once already
with no problems, I don't understand why I am having problems now.
Code Snippet:
<%@ register tagprefix="data" namespace="AccessControl"
Assembly="AccessControl" %> <%@ register tagprefix="list"
namespace="WebList" Assembly="WebList" %>
...
<script runat="server">
dim product as WebList = New WebList
dim quantity as WebList = New WebList
dim category as String
Error: (on line 14)
Compilation Error
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: BC30182: Type expected.
Source Error:
Line 12: <meta
content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
Line 13: <script runat="server">
Line 14: dim product as WebList = New WebList
(error here)
Line 15: dim quantity as WebList = New WebList
Line 16: dim category as String
Source File: C:\Inetpub\asp.office\shoponline\index.aspx Line: 14
thanks
Matthew Small
IT Supervisor
Showstopper National Dance Competitions
3660 Old Kings Hwy
Murrells Inlet, SC 29576
843-357-1847
http://www.showstopperonline.com
---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED] To unsubscribe send a blank email to
%%email.unsub%%
---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]