@@ -564,8 +564,7 @@ from order in orders.AsEnumerable()
564
564
Console . WriteLine ( "Orders that were made after 12/1/2002:" ) ;
565
565
foreach ( DataRow order in query )
566
566
{
567
- Console . WriteLine ( "OrderID {0} Order date: {1:d} " ,
568
- order . Field < int > ( "SalesOrderID" ) , order . Field < DateTime > ( "OrderDate" ) ) ;
567
+ Console . WriteLine ( $ "OrderID { order . Field < int > ( "SalesOrderID" ) } Order date: { order . Field < DateTime > ( "OrderDate" ) : d} ") ;
569
568
foreach ( DataRow orderDetail in order . GetChildRows ( "SalesOrderHeaderDetail" ) )
570
569
{
571
570
Console . WriteLine ( $ " Product ID: { orderDetail [ "ProductID" ] } Unit Price { orderDetail [ "UnitPrice" ] } ") ;
@@ -665,10 +664,7 @@ static void TakeSimple()
665
664
Console . WriteLine ( "First 5 contacts:" ) ;
666
665
foreach ( DataRow contact in first5Contacts )
667
666
{
668
- Console . WriteLine ( "Title = {0} \t FirstName = {1} \t Lastname = {2}" ,
669
- contact . Field < string > ( "Title" ) ,
670
- contact . Field < string > ( "FirstName" ) ,
671
- contact . Field < string > ( "Lastname" ) ) ;
667
+ Console . WriteLine ( $ "Title = { contact . Field < string > ( "Title" ) } \t FirstName = { contact . Field < string > ( "FirstName" ) } \t Lastname = { contact . Field < string > ( "Lastname" ) } ") ;
672
668
}
673
669
//</SnippetTakeSimple>
674
670
}
@@ -691,9 +687,7 @@ static void SkipSimple()
691
687
Console . WriteLine ( "All but first 5 contacts:" ) ;
692
688
foreach ( DataRow contact in allButFirst5Contacts )
693
689
{
694
- Console . WriteLine ( "FirstName = {0} \t Lastname = {1}" ,
695
- contact . Field < string > ( "FirstName" ) ,
696
- contact . Field < string > ( "Lastname" ) ) ;
690
+ Console . WriteLine ( $ "FirstName = { contact . Field < string > ( "FirstName" ) } \t Lastname = { contact . Field < string > ( "Lastname" ) } ") ;
697
691
}
698
692
//</SnippetSkipSimple>
699
693
}
@@ -891,10 +885,7 @@ orderby product.Field<string>("Name"),
891
885
892
886
foreach ( DataRow product in query )
893
887
{
894
- Console . WriteLine ( "Product ID: {0} Product Name: {1} List Price {2}" ,
895
- product . Field < int > ( "ProductID" ) ,
896
- product . Field < string > ( "Name" ) ,
897
- product . Field < Decimal > ( "ListPrice" ) ) ;
888
+ Console . WriteLine ( $ "Product ID: { product . Field < int > ( "ProductID" ) } Product Name: { product . Field < string > ( "Name" ) } List Price { product . Field < Decimal > ( "ListPrice" ) } ") ;
898
889
}
899
890
//</SnippetThenByDescendingSimple>
900
891
}
@@ -922,10 +913,7 @@ static void ThenByDescendingComparer_MQ()
922
913
923
914
foreach ( DataRow product in query )
924
915
{
925
- Console . WriteLine ( "Product ID: {0} Product Name: {1} List Price {2}" ,
926
- product . Field < int > ( "ProductID" ) ,
927
- product . Field < string > ( "Name" ) ,
928
- product . Field < Decimal > ( "ListPrice" ) ) ;
916
+ Console . WriteLine ( $ "Product ID: { product . Field < int > ( "ProductID" ) } Product Name: { product . Field < string > ( "Name" ) } List Price { product . Field < Decimal > ( "ListPrice" ) } ") ;
929
917
}
930
918
//</SnippetThenByDescendingComparer_MQ>
931
919
}
@@ -1066,10 +1054,8 @@ Month into mg
1066
1054
Console . WriteLine ( $ "\t \t Month= { monthGroup . Month } ") ;
1067
1055
foreach ( var order in monthGroup . Orders )
1068
1056
{
1069
- Console . WriteLine ( "\t \t \t OrderID= {0} " ,
1070
- order . Field < int > ( "SalesOrderID" ) ) ;
1071
- Console . WriteLine ( "\t \t \t OrderDate= {0} " ,
1072
- order . Field < DateTime > ( "OrderDate" ) ) ;
1057
+ Console . WriteLine ( $ "\t \t \t OrderID= { order . Field < int > ( "SalesOrderID" ) } ") ;
1058
+ Console . WriteLine ( $ "\t \t \t OrderDate= { order . Field < DateTime > ( "OrderDate" ) } ") ;
1073
1059
}
1074
1060
}
1075
1061
}
@@ -1420,8 +1406,7 @@ static void FirstCondition_MQ()
1420
1406
DataRow startsWith = contacts . AsEnumerable ( ) .
1421
1407
First ( contact => contact . Field < string > ( "EmailAddress" ) . StartsWith ( "caroline" ) ) ;
1422
1408
1423
- Console . WriteLine ( "An email address starting with 'caroline': {0}" ,
1424
- startsWith . Field < string > ( "EmailAddress" ) ) ;
1409
+ Console . WriteLine ( $ "An email address starting with 'caroline': { startsWith . Field < string > ( "EmailAddress" ) } ") ;
1425
1410
//</SnippetFirstCondition_MQ>
1426
1411
}
1427
1412
@@ -1805,9 +1790,7 @@ group order by order.Field<Int32>("ContactID") into g
1805
1790
Console . WriteLine ( $ "ContactID: { orderGroup . Category } ") ;
1806
1791
foreach ( var order in orderGroup . smallestTotalDue )
1807
1792
{
1808
- Console . WriteLine ( "Minimum TotalDue {0} for SalesOrderID {1}: " ,
1809
- order . Field < decimal > ( "TotalDue" ) ,
1810
- order . Field < Int32 > ( "SalesOrderID" ) ) ;
1793
+ Console . WriteLine ( $ "Minimum TotalDue { order . Field < decimal > ( "TotalDue" ) } for SalesOrderID { order . Field < Int32 > ( "SalesOrderID" ) } : ") ;
1811
1794
}
1812
1795
Console . WriteLine ( "" ) ;
1813
1796
}
@@ -1893,9 +1876,7 @@ group order by order.Field<Int32>("ContactID") into g
1893
1876
Console . WriteLine ( $ "ContactID: { orderGroup . Category } ") ;
1894
1877
foreach ( var order in orderGroup . CheapestProducts )
1895
1878
{
1896
- Console . WriteLine ( "Average total due for SalesOrderID {1} is: {0}" ,
1897
- order . Field < decimal > ( "TotalDue" ) ,
1898
- order . Field < Int32 > ( "SalesOrderID" ) ) ;
1879
+ Console . WriteLine ( $ "Average total due for SalesOrderID { order . Field < Int32 > ( "SalesOrderID" ) } is: { order . Field < decimal > ( "TotalDue" ) } ") ;
1899
1880
}
1900
1881
Console . WriteLine ( "" ) ;
1901
1882
}
@@ -1981,9 +1962,7 @@ group order by order.Field<Int32>("ContactID") into g
1981
1962
Console . WriteLine ( $ "ContactID: { orderGroup . Category } ") ;
1982
1963
foreach ( var order in orderGroup . CheapestProducts )
1983
1964
{
1984
- Console . WriteLine ( "MaxTotalDue {0} for SalesOrderID {1}: " ,
1985
- order . Field < decimal > ( "TotalDue" ) ,
1986
- order . Field < Int32 > ( "SalesOrderID" ) ) ;
1965
+ Console . WriteLine ( $ "MaxTotalDue { order . Field < decimal > ( "TotalDue" ) } for SalesOrderID { order . Field < Int32 > ( "SalesOrderID" ) } : ") ;
1987
1966
}
1988
1967
}
1989
1968
//</SnippetMaxElements_MQ>
@@ -2505,12 +2484,8 @@ group product by product.Field<string>("Size") into g
2505
2484
Console . WriteLine ( $ "{ productGroup . Category } :") ;
2506
2485
foreach ( var product in productGroup . Products )
2507
2486
{
2508
- Console . WriteLine ( " Name: {0} Color: {1}" ,
2509
- product . Field < string > ( "Name" ) ,
2510
- product . Field < string > ( "Color" ) ) ;
2511
- Console . WriteLine ( " List price: {0} Size: {1}" ,
2512
- product . Field < Decimal > ( "ListPrice" ) ,
2513
- product . Field < string > ( "Size" ) ) ;
2487
+ Console . WriteLine ( $ " Name: { product . Field < string > ( "Name" ) } Color: { product . Field < string > ( "Color" ) } ") ;
2488
+ Console . WriteLine ( $ " List price: { product . Field < Decimal > ( "ListPrice" ) } Size: { product . Field < string > ( "Size" ) } ") ;
2514
2489
}
2515
2490
}
2516
2491
}
0 commit comments