Share via


DiscardableAttribute 建構函式

定義

使用預設值,初始化 DiscardableAttribute 類別的新執行個體。

public:
 DiscardableAttribute();
public DiscardableAttribute ();
Public Sub New ()

範例

下列程式代碼範例示範如何將 屬性套用 DiscardableAttribute 至類型。

using System;
using System.Runtime.CompilerServices;

[DiscardableAttribute()]
class Program
{

    static void Main(string[] args)
    {

        Console.WriteLine("The DiscardableAttribute attribute was applied.");
    }
}
Imports System.Runtime.CompilerServices


<DiscardableAttribute()> Module Program


    Sub Main(ByVal args() As String)
        Console.WriteLine("The DiscardableAttribute attribute was applied.")
    End Sub


End Module

適用於