Type.IsVisible 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
어셈블리 외부의 코드에서 Type 액세스할 수 있는지 여부를 나타내는 값을 가져옵니다.
public:
property bool IsVisible { bool get(); };
public bool IsVisible { get; }
member this.IsVisible : bool
Public ReadOnly Property IsVisible As Boolean
속성 값
true 현재 Type 형식이 public 형식이거나 모든 바깥쪽 형식이 public이 되도록 공용 중첩 형식이면 이고, false그렇지 않으면 입니다.
예제
다음 코드 예제에서는 두 클래스를 테스트하며, 그 중 하나만 어셈블리 외부에 표시됩니다.
using System;
internal class InternalOnly
{
public class Nested {}
}
public class Example
{
public class Nested {}
public static void Main()
{
Type t = typeof(InternalOnly.Nested);
Console.WriteLine(
"Is the {0} class visible outside the assembly? {1}",
t.FullName,
t.IsVisible
);
t = typeof(Example.Nested);
Console.WriteLine(
"Is the {0} class visible outside the assembly? {1}",
t.FullName,
t.IsVisible
);
}
}
/* This example produces the following output:
Is the InternalOnly+Nested class visible outside the assembly? False
Is the Example+Nested class visible outside the assembly? True
*/
module internal InternalOnly =
type Nested() = class end
module Example =
type Nested() = class end
let t = typeof<InternalOnly.Nested>
printfn $"Is the {t.FullName} class visible outside the assembly? {t.IsVisible}"
let t2 = typeof<Example.Nested>
printfn $"Is the {t2.FullName} class visible outside the assembly? {t2.IsVisible}"
(* This example produces the following output:
Is the InternalOnly+Nested class visible outside the assembly? False
Is the Example+Nested class visible outside the assembly? True
*)
Friend Class InternalOnly
Public Class Nested
End Class
End Class
Public Class Example
Public Class Nested
End Class
Public Shared Sub Main()
With GetType(InternalOnly.Nested)
Console.WriteLine("Is the " & .FullName _
& " class visible outside the assembly? " & .IsVisible)
End With
With GetType(Example.Nested)
Console.WriteLine("Is the " & .FullName _
& " class visible outside the assembly? " & .IsVisible)
End With
End Sub
End Class
' This example produces the following output:
'
'Is the InternalOnly+Nested class visible outside the assembly? False
'Is the Example+Nested class visible outside the assembly? True
설명
이 속성을 사용 하 여 형식 구성 요소 어셈블리의 공용 인터페이스의 일부인지 여부를 확인 합니다.