473,884 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Public member of a Namespace unavailable outside the namespace

I have a Namespace compiling to a DLL. It contains 2 classes and 10 structs
all typed as public and it worked. When I added an additional public struct
the added public struct cannot be accessed outside of the containing
namespace. Both the contained namespace and the accessing namespace are part
of the same solution.

The code of the added struct is:

public struct SourceStructure
{
/// <summary>
/// Property to access the prinary key of the source record
/// </summary>
public int MajNum { get; set; }

/// <summary>
/// Property to access the source number as displayed
/// </summary>
public int RefId { get; set; }

/// <summary>
/// Property to access the abreviated title of the source
/// </summary>
public string Abbrev { get; set; }

/// <summary>
/// Property to access the full title of the source
/// </summary>
public string Title { get; set; }

public override string ToString()
{
string _return = Abbrev;
if (string.IsNullO rEmpty(_return. Trim()))
_return = Title;
return _return;
}
}

This struct cannot be accessed outside of the namespace.

Another struct implemented at exactly the same indent level and just below
the unavailable struct in the code is:

public struct FocusGroupStruc ture
{
/// <summary>
/// Property to access the Focus Group ID
/// </summary>
public int GroupNum { get; set; }
/// <summary>
/// Property to access the Focus Group name
/// </summary>
public string Groupname { get; set; }

//Method to return the group name with ToString()
public override string ToString()
{
return Groupname;
}
}

This struct can be accessed in the accessing namespace without any problem.

A using statement pointing to the DLL name space was included in the using
namespace which allowed access to the 2 classes and the other structs.

I am stumpted. Any help will be appreciated.

Rrgards;
--
Arlyn_L
Jun 27 '08 #1
4 1270
It sounds like the dll hasn't been updated in the referencing project
- you could check with reflector - or just drop the reference and re-
add it.

By the way, mutable structs (i.e. structs with properties that can be
set after creation) are a really, really bad idea. Both of these look
like they should be classes.
Jun 27 '08 #2
Deleting the reference and the re-adding it solved the problem.

Thank you.

Regards;
--
Arlyn_L
"Marc Gravell" wrote:
It sounds like the dll hasn't been updated in the referencing project
- you could check with reflector - or just drop the reference and re-
add it.

By the way, mutable structs (i.e. structs with properties that can be
set after creation) are a really, really bad idea. Both of these look
like they should be classes.
Jun 27 '08 #3
Arlyn_L <Ar*****@newsgr oup.nospamwrote :
Deleting the reference and the re-adding it solved the problem.
I'd really urge you to heed Marc's other piece of advice though. Just
say "no" to mutable structs...

--
Jon Skeet - <sk***@pobox.co m>
Web site: http://www.pobox.com/~skeet
Blog: http://www.msmvps.com/jon.skeet
C# in Depth: http://csharpindepth.com
Jun 27 '08 #4
I'm suddenly thinking "Zammo"... ;-p
Jun 27 '08 #5

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

Similar topics

6
2183
by: Chris Mantoulidis | last post by:
Forgive me if I'm wrong but I think there is something like an extra member scope in classes. for example: class abc { ostream & operator << (ostream &, const abc &); istream & operator >> (istream &, abc &); private:
22
2262
by: BRIAN VICKERY | last post by:
I've heard that some compilers reserve the '_' starting a symbol for system variables/symbols. I can not find this documented anywhere (so far). I've used an '_' at the end of member variables (ie. Uint16 bar_; ) to distinquish private fields, but this does not stand out as much as if the '_' were at the begginning of the name as in the following class declaration. class Foo { private: Uint16 _baz;
5
2052
by: rossum | last post by:
Either I have found a puzzle, or I am just being stupid. Inside a namespace I have a class with a static const double member. The member is not an int so I cannot initialise it within the class, I have to initialise it outside the class. The problem is that when I tried putting the initialisation in the header file immediately after the class my compiler (g++) rejected it, citing "multiple definition": g++.exe alphaMain.o alpha.o -o...
18
2104
by: Janaka | last post by:
I'm having a discussion with my colleagues here on good programming standards. One thing we haven't agreed on is the use of properties in classes vs using member variables. Now everyone knows that it is useful to use a property when it has to do some further action on the data such as private double salesAvg; public double SalesAverage { set { salesAvg = value / salesTotal; }
3
10893
by: Joe Fromm | last post by:
Perhaps I'm missing something obvious, but I've been curious about one of the coding practices I see advocated. I'm a longtime C/C++ programmer trying to learn C#, and I started looking around for coding standards/best practices. Several of the documents I've read require that all members be private (or protected), and the get/set properties be provided for any elements exposed to the outside world. In C++ this makes perfect sense,...
10
3686
by: darrel | last post by:
I'm still trying to sort out in my head the differences between public and shared when referring to declaring properties or variables. This is my understanding: shared - akin to a 'global' variable for the application. Any other code within the application can access it. public - can be shared across the application if instatiated. Does that sound about right? It seems these are more useful for methods rather than variables. Most of...
8
16358
by: Jordan | last post by:
AFAIK there are two ways to expose members of a base class to a derived or child class: 1. declare the members public in the base class 2. declare them as 'protected' in the base class Is either of these methods generally recommended over the other? If yes, why? Thanks!
4
3343
by: Joseph Turian | last post by:
Hi, What is the correct syntax to get the bar<T>::f<int, unsigned>() function to compile in the following fragment? Thanks, Joseph class foo {
15
7884
by: akomiakov | last post by:
Is there a technical reason why one can't initialize a cost static non- integral data member in a class?
0
9954
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9591
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7985
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.