Query Using the Query Expression Syntax

image_pdfimage_print

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
public static void Main() {

string[] names = { “A123123”, “B123”, “C123123”, “E123”, “W” };
IEnumerable sequence = from n in names
where n.Length < 6 select n; foreach (string name in sequence) { Console.WriteLine("{0}", name); } } } [/csharp]

This entry was posted in LINQ. Bookmark the permalink.