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

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.IsNullOrEmpty(_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 FocusGroupStructure
{
/// <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 1252
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*****@newsgroup.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.com>
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
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 >>...
22
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...
5
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,...
18
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...
3
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...
10
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'...
8
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...
4
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
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.