Implicitly Typed arrays in c#
- Implicitly typed arrays are those arrays in which the type of the array is deduced from the element specified in the array initialiser.
- The implicitly typed arrays are similar to implicitly typed variables.
- In general, implicitly typed arrays are used in the query expression.
class Implicitly
{
static public void Main()
{
// Creating and initializing 1-D
// implicitly typed array
var author_names = new[] {"Shilpa", "Soniya",
"Shivi", "Ritika"};
Console.WriteLine("List of Authors is: ");
// Display the data of the given array
foreach (string data in author_names)
{
Console.WriteLine(data);
}
Console.ReadLine();
}
}
No comments