Assert.AreAllNotNull 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| AreAllNotNull(IEnumerable, String, String) |
測試指定集合中的所有項目是否非空,若任一元素為空則拋出例外。 |
| AreAllNotNull<T>(Span<T>, String, String) |
測試指定區間內的所有項目是否為非空。 |
| AreAllNotNull<T>(ReadOnlySpan<T>, String, String) |
測試指定區間內的所有項目是否為非空。 |
| AreAllNotNull<T>(ReadOnlyMemory<T>, String, String) |
測試指定記憶體中所有項目是否為非空。 |
| AreAllNotNull<T>(IEnumerable<T>, String, String) |
測試指定集合中的所有項目是否非空,若任一元素為空則拋出例外。 |
| AreAllNotNull<T>(Memory<T>, String, String) |
測試指定記憶體中所有項目是否為非空。 |
AreAllNotNull(IEnumerable, String, String)
測試指定集合中的所有項目是否非空,若任一元素為空則拋出例外。
public static void AreAllNotNull(System.Collections.IEnumerable? collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : System.Collections.IEnumerable * string * string -> unit
Public Shared Sub AreAllNotNull (collection As IEnumerable, Optional message As String = "", Optional collectionExpression As String = "")
參數
- collection
- IEnumerable
用來搜尋空元素的集合。
- message
- String
當例外中包含的 collection 訊息包含一個空元素。 該訊息會顯示在測試結果中。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。
例外狀況
若 collection 為空或包含至少一個空元素,則拋出。
適用於
AreAllNotNull<T>(Span<T>, String, String)
測試指定區間內的所有項目是否為非空。
public static void AreAllNotNull<T>(Span<T> collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : Span<'T> * string * string -> unit
Public Shared Sub AreAllNotNull(Of T) (collection As Span(Of T), Optional message As String = "", Optional collectionExpression As String = "")
類型參數
- T
跨度項目的類型。
參數
- collection
- Span<T>
搜尋空元素的區間。
- message
- String
當斷言失敗時,例外中應包含訊息。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。
適用於
AreAllNotNull<T>(ReadOnlySpan<T>, String, String)
測試指定區間內的所有項目是否為非空。
public static void AreAllNotNull<T>(ReadOnlySpan<T> collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : ReadOnlySpan<'T> * string * string -> unit
Public Shared Sub AreAllNotNull(Of T) (collection As ReadOnlySpan(Of T), Optional message As String = "", Optional collectionExpression As String = "")
類型參數
- T
跨度項目的類型。
參數
- collection
- ReadOnlySpan<T>
搜尋空元素的區間。
- message
- String
當斷言失敗時,例外中應包含訊息。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。
適用於
AreAllNotNull<T>(ReadOnlyMemory<T>, String, String)
測試指定記憶體中所有項目是否為非空。
public static void AreAllNotNull<T>(ReadOnlyMemory<T> collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : ReadOnlyMemory<'T> * string * string -> unit
Public Shared Sub AreAllNotNull(Of T) (collection As ReadOnlyMemory(Of T), Optional message As String = "", Optional collectionExpression As String = "")
類型參數
- T
記憶物品的種類。
參數
- collection
- ReadOnlyMemory<T>
用來搜尋空元素的記憶體。
- message
- String
當斷言失敗時,例外中應包含訊息。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。
適用於
AreAllNotNull<T>(IEnumerable<T>, String, String)
測試指定集合中的所有項目是否非空,若任一元素為空則拋出例外。
public static void AreAllNotNull<T>(System.Collections.Generic.IEnumerable<T>? collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : seq<'T> * string * string -> unit
Public Shared Sub AreAllNotNull(Of T) (collection As IEnumerable(Of T), Optional message As String = "", Optional collectionExpression As String = "")
類型參數
- T
收藏品的類型。
參數
- collection
- IEnumerable<T>
用來搜尋空元素的集合。
- message
- String
當例外中包含的 collection 訊息包含一個空元素。 該訊息會顯示在測試結果中。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。
例外狀況
若 collection 為空或包含至少一個空元素,則拋出。
適用於
AreAllNotNull<T>(Memory<T>, String, String)
測試指定記憶體中所有項目是否為非空。
public static void AreAllNotNull<T>(Memory<T> collection, string? message = "", string collectionExpression = "");
static member AreAllNotNull : Memory<'T> * string * string -> unit
Public Shared Sub AreAllNotNull(Of T) (collection As Memory(Of T), Optional message As String = "", Optional collectionExpression As String = "")
類型參數
- T
記憶物品的種類。
參數
- collection
- Memory<T>
用來搜尋空元素的記憶體。
- message
- String
當斷言失敗時,例外中應包含訊息。
- collectionExpression
- String
由編譯器透過呼叫者參數表達式所提供的收集語法表達式。 使用者不應該傳遞這個參數的值。