Dimitry,

SomeClass is private by default. It does not inherit the scope of the class.
You must specify "public" to the array.
Personally I define the scope of all my variables just after the class
definition.

  using System;

internal class SomeClass {}

public class ReflectionTest
{
  public SomeClass [] sc = new SomeClass [0];
   public static void Main ()
   {
      Console.WriteLine (sc.GetType().IsPublic); // True ???
      Console.WriteLine (sc.GetType().GetElementType ().IsPublic); //
False - OK
   }
}

Allaoua Cheraitia


-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Dmitry Shaporenkov
Sent: Saturday, May 15, 2004 4:02 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Visibility of an array type and the element type


Hi all,

the output of the following program is a mystery for me:


using System;

internal class SomeClass {}

public class ReflectionTest
{
   public static void Main ()
   {
      SomeClass [] sc = new SomeClass [0];
      Console.WriteLine (sc.GetType().IsPublic); // True ???
      Console.WriteLine (sc.GetType().GetElementType ().IsPublic); //
False - OK
   }
}


It seems that via Reflection I get that the array type SomeClass[] has
public visibility. I would expect it to have
the same visibility as its element type. Any ideas how this can happen?


Regards,
Dmitry Shaporenkov

===================================
This list is hosted by DevelopMentor-  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor╝  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to