Type.IsInterface 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Type 인터페이스인지 여부를 나타내는 값을 가져옵니다. 즉, 클래스 또는 값 형식이 아닙니다.
public:
property bool IsInterface { bool get(); };
public bool IsInterface { get; }
member this.IsInterface : bool
Public ReadOnly Property IsInterface As Boolean
속성 값
true 인터페이스이면 .이 Type 고, false그렇지 않으면 .입니다.
구현
예제
다음 예제에서는 인터페이스를 만들고, 인터페이스 형식을 확인하고, 클래스에 속성 집합이 IsInterface 있는지 여부를 나타냅니다.
using System;
// Declare an interface.
interface myIFace
{
}
class MyIsInterface
{
public static void Main(string []args)
{
try
{
// Get the IsInterface attribute for myIFace.
bool myBool1 = typeof(myIFace).IsInterface;
//Display the IsInterface attribute for myIFace.
Console.WriteLine("Is the specified type an interface? {0}.", myBool1);
// Get the attribute IsInterface for MyIsInterface.
bool myBool2 = typeof(MyIsInterface).IsInterface;
//Display the IsInterface attribute for MyIsInterface.
Console.WriteLine("Is the specified type an interface? {0}.", myBool2);
}
catch(Exception e)
{
Console.WriteLine("\nAn exception occurred: {0}.", e.Message);
}
}
}
/* The example produces the following output:
Is the specified type an interface? True.
Is the specified type an interface? False.
*/
// Declare an interface.
type myIFace = interface end
type MyIsInterface = class end
try
// Get the IsInterface attribute for myIFace.
let myBool1 = typeof<myIFace>.IsInterface
//Display the IsInterface attribute for myIFace.
printfn $"Is the specified type an interface? {myBool1}."
// Get the attribute IsInterface for MyIsInterface.
let myBool2 = typeof<MyIsInterface>.IsInterface
//Display the IsInterface attribute for MyIsInterface.
printfn $"Is the specified type an interface? {myBool2}."
with e ->
printfn $"\nAn exception occurred: {e.Message}."
(* The example produces the following output:
Is the specified type an interface? True.
Is the specified type an interface? False.
*)
' Declare an interface.
Interface myIFace
End Interface
Class MyIsInterface
Public Shared Sub Main()
' Get the IsInterface attribute for myIFace.
Dim myBool1 As Boolean = GetType(myIFace).IsInterface
Console.WriteLine("Is the specified type an interface? {0}.", myBool1)
' Determine whether Example is an interface.
Dim myBool2 As Boolean = GetType(MyIsInterface).IsInterface
Console.WriteLine("Is the specified type an interface? {0}.", myBool2)
Console.ReadLine()
End Sub
End Class
' The example displays the following output:
' Is the specified type an interface? True.
' Is the specified type an interface? False.
설명
ClassSemanticsMask 형식 선언을 클래스, 인터페이스 또는 값 형식으로 구분합니다.
현재 Type 제네릭 형식 또는 제네릭 메서드의 정의에서 형식 매개 변수를 나타내는 경우 이 속성은 항상 반환됩니다 false.
이 속성은 읽기 전용입니다.