from c in Customers
join o in Orders on new {c.CompanyID, c.CustomerID} equals new {o.CompanyID, o.CustomerID}
Postgresql:
from Customers as c join Orders as o on (c.CompanyID,c.CustomerID) = (o.CompanyID,o.CustomerID)
"Simplicity can't be bought later, it must be earned from the start" -- DB
from c in Customers
join o in Orders on new {c.CompanyID, c.CustomerID} equals new {o.CompanyID, o.CustomerID}
from Customers as c join Orders as o on (c.CompanyID,c.CustomerID) = (o.CompanyID,o.CustomerID)
public class Flight
{
[DisplayWidth(200)]
[FinderController(UseFinder=typeof(CountryFinder), SelectedID="SelectedCountryCode")]
public string CountryCode { get; set; }
[DisplayWidth(200)]
[Color(Color.Blue)]
[FinderController(UseFinder=typeof(CityFinder), SelectedID="SelectedCityID", CascadingField="CountryCode")]
public int CityID { get; set; }
[DisplayWidth(100)]
[Spinner(From=1,To=30)]
public int StayDuration { get; set; }
}
public class Flight
{
public int CountryID { get; set; }
public int CityID { get; set; }
public int StayDuration { get; set; }
}
[FinderController(UseFinder=typeof(CityFinder), SelectedID="SelectedCityID", CascadingField="CountryCode")]
public int CityID { get; set; }
public class Flight
{
public int CountryCode { get; set; }
public int CityID { get; set; }
public int StayDuration { get; set; }
}
public class FlightInput : InputMap<Flight>
{
public FlightInput ()
{
Input(x => x.CountryCode) // Use C# 3's Expression
.DisplayWidth(200)
.Color(KnownColor.Blue)
.UseFinder<CountryFinder>().SelectedID(x => x.SelectedCountryCode);
Input(x => x.CityID)
.DisplayWidth(200)
.Color(KnownColor.Blue)
.UseFinder<CityFinder>().SelectedID(x => x.SelectedCityID).CascadingField(x => x.CountryCode);
Input(x => x.StayDuration)
.DisplayWidth(100).Color(KnownColor.Green)
.UseSpinner(1,10);
}
}
public ActionResult GetSoap()
{
return Json(new Soap { Name = "Tide", Feature = "With Calamansi" } );
}
public JsonResult GetSoap()
{
return Json(new Soap { Name = "Tide", Feature = "With Calamansi" } );
}
public object GetSoap()
{
return Json(new Soap { Name = "Tide", Feature = "With Calamansi" } );
}
[Test]
public void SomeTest()
{
// unnecessary casting
JsonResult r = (JsonResult) GetSoap();
Soap s = (Soap)r.Model;
}
[Test]
public void SomeTest()
{
JsonResult r = GetSoap();
Soap s = (Soap)r.Model;
}
using System;
namespace Craft
{
public delegate string Greeter(string s);
public class HeyAttribute : Attribute
{
public Greeter GreetAction { get; set; }
}
// Strongly-typed mechanism on attribute is no joy in C#, it's not
// possible. C# language designers reduces the attributes "complexity" :
// http://stackoverflow.com/questions/294216/why-does-c-sharp-forbid-generic-attribute-types
[Hey(GreetAction = Mate.Yo)] // This will not compile, despite the simplicity
public class Test
{
}
public class Mate
{
public static string Yo(string s)
{
return "Hello " + s;
}
}
class Program
{
static void Main(string[] args)
{
}
}
}
static void TestBanker()
{
Console.WriteLine(Math.Round(0.5)); // 0
Console.WriteLine(Math.Round(1.5)); // 2
Console.WriteLine(Math.Round(2.5)); // 2
Console.WriteLine(Math.Round(3.5)); // 4
Console.WriteLine(Math.Round(4.5)); // 4
Console.WriteLine(Math.Round(5.5)); // 6
Console.WriteLine(Math.Round(6.5)); // 6
Console.WriteLine(Math.Round(7.5)); // 8
Console.WriteLine(Math.Round(8.5)); // 8
Console.WriteLine(Math.Round(9.5)); // 10
}
static void TestCommon()
{
Console.WriteLine(Math.Round(0.5, MidpointRounding.AwayFromZero)); // 1
Console.WriteLine(Math.Round(1.5, MidpointRounding.AwayFromZero)); // 2
Console.WriteLine(Math.Round(2.5, MidpointRounding.AwayFromZero)); // 3
Console.WriteLine(Math.Round(3.5, MidpointRounding.AwayFromZero)); // 4
Console.WriteLine(Math.Round(4.5, MidpointRounding.AwayFromZero)); // 5
Console.WriteLine(Math.Round(5.5, MidpointRounding.AwayFromZero)); // 6
Console.WriteLine(Math.Round(6.5, MidpointRounding.AwayFromZero)); // 7
Console.WriteLine(Math.Round(7.5, MidpointRounding.AwayFromZero)); // 8
Console.WriteLine(Math.Round(8.5, MidpointRounding.AwayFromZero)); // 9
Console.WriteLine(Math.Round(9.5, MidpointRounding.AwayFromZero)); // 10
}