6. var entry = new { Dim entry = New With { _
Title = "Dear Diary", .Title = "Dear Diary", _
DateTime.Now DateTime.Now _
}; }
Console.WriteLine("{0:d}: {1}", Console.WriteLine("{0:d}: {1}", _
entry.Now, entry.Title); entry.Now, entry.Title)
var Dim
7. static Module
using Imports
Imports System.Runtime.CompilerServices
Module StringExtensions
<Extension()> _
Public Sub Print(ByVal aString As String)
Console.WriteLine(aString)
End Sub
End Module
Dim hello = "Hello from StringExtensions"
hello.Print()
34.
from x1 in e1
join x2 in e2 on k1 equals k2
…
from * in ( e1 ) . Join(
e2 , x1 => k1 , x2 => k2 , (x1 , x2) => new { x1 , x2 })
…
o this
o
o
o
o
35.
o EqualityComparer<TKey>.Default
o Equals() GetHashcode()
o
IEqualityComparer<TKey>
o
o
36.
37. into
o
o Func<TOuter, TInner, TResult> resultSelector
into
o
o
o Func<TOuter, IEnumerable<TInner>, TResult> resultSelector
o DefaultIfEmpty()
from x1 in e1
join x2 in e2 on k1 equals k2 into j
from xj in j . DefaultIfEmpty()
…
38. from
o IEnumerable<T>
from x1 in e1
from x2 in e2
…
from * in ( e1 ) . SelectMany(
x1 => e2 , ( x1 , x2 ) => new { x1 , x2 } )
…
*
o
39.
o IEnumerable<T>
o yield return
o
o
o
o
44.
o
o IEnumerable<>
o
o EnumerableRowCollection<DataRow>
AsEnumerable(this DataTable source)
o EnumerableRowCollectionExtensions
o Cast<T>() OfType<T>()
o foreach
from MyType obj in MyArrayList
…
45.
46.
o IQueryable<T>
public interface IQueryable : IEnumerable
{
Type ElementType { get; }
Expression Expression { get; }
IQueryProvider Provider { get; }
}
public interface IQueryable<T> :
IEnumerable<T>, IQueryable, IEnumerable
{ }