Select type from value in CSharp
Description
The following code shows how to select type from value.
Example
// w w w. j a v a 2s. c om
using System;
using System.Linq;
static class TestArray {
static void Main() {
Object[] array = { "String", 12, true, 'a' };
var types =array.Select(item => item.GetType().Name)
.OrderBy(type => type);
foreach(var v in types){
Console.WriteLine(v);
}
}
}
The code above generates the following result.