Public member of a Namespace unavailable outside the namespace

Public member of a Namespace unavailable outside the namespace

Post by QXJseW5fT » Thu, 15 May 2008 07:16:01


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
 
 
 

Public member of a Namespace unavailable outside the namespace

Post by Marc Grave » Thu, 15 May 2008 07:27:33

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.

 
 
 

Public member of a Namespace unavailable outside the namespace

Post by QXJseW5fT » Thu, 15 May 2008 07:53:00

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

Thank you.

Regards;
--
Arlyn_L
 
 
 

Public member of a Namespace unavailable outside the namespace

Post by Jon Skeet » Thu, 15 May 2008 14:20:25


I'd really urge you to heed Marc's other piece of advice though. Just
say "no" to mutable structs...

--
Jon Skeet - < XXXX@XXXXX.COM >
Web site: http://www.yqcomputer.com/ ~skeet
Blog: http://www.yqcomputer.com/
C# in Depth: http://www.yqcomputer.com/
 
 
 

Public member of a Namespace unavailable outside the namespace

Post by Marc Grave » Thu, 15 May 2008 16:03:29

I'm suddenly thinking "Zammo"... ;-p