Public member of a Namespace unavailable outside the namespace

A

Arlyn_L

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;
 
M

Marc Gravell

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.
 
A

Arlyn_L

Deleting the reference and the re-adding it solved the problem.

Thank you.

Regards;
 
J

Jon Skeet [C# MVP]

Arlyn_L said:
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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top