var list = new List() { "apple", "banana", "orange" }; CollectionAssert.AllItemsAreInstancesOfType(list, typeof(string));
int[] numbers = { 1, 2, 3, 4, 5 }; CollectionAssert.AllItemsAreInstancesOfType(numbers, typeof(int));Package/Library: This method is part of the NUnit framework, which is a popular unit testing framework for .NET applications. The method is defined in the NUnit.Framework namespace, which means that we need to include the NUnit.Framework package to use it in our C# project.