This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T DequeueReusableCell<T> (this UITableView tableView) where T : UITableViewCell | |
{ | |
var identifier = typeof(T).Name; | |
var cell = tableView.DequeueReusableCell (identifier); | |
if (cell == null) | |
{ | |
// Nib with the class name MUST exist in the name bundle | |
var nib = UINib.FromName (identifier, NSBundle.MainBundle); | |
tableView.RegisterNibForCellReuse (nib, identifier); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[BaseType (typeof (NSObject))] | |
interface Braintree | |
{ | |
/* existing methods */ | |
delegate void CompletionCallback (string nonce, NSError error); | |
[Export ("tokenizeCard:completion:")] | |
[Async] | |
void TokenizeCard (BTClientCardTokenizationRequest request, CompletionCallback callback); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace Haskell | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var countData = Console.ReadLine().Split(' '); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
namespace Haskell | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
var pattern = Console.ReadLine(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace Haskell | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyEntity | |
{ | |
// This will be used for EF queries | |
public DbGeography Location { get; set; } | |
// This will be used by OData | |
public GeographyPoint Coordinates | |
{ | |
get | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyContext : DbContext | |
{ | |
protected override void OnModelCreating(DbModelBuilder modelBuilder) | |
{ | |
modelBuilder.Entity<MyEntity>() | |
.Ignore(e => e.Coordinates); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GeoDistanceVisitor : ExpressionVisitor | |
{ | |
private static readonly MethodInfo distanceMethod = typeof(GeographyOperationsExtensions).GetMethod("Distance"); | |
private static readonly MethodInfo distanceMethodDb = typeof(DbGeography ).GetMethod("Distance"); | |
private static PropertyInfo constantExpressionValuePropertyInfo; | |
protected override Expression VisitMethodCall(MethodCallExpression node) | |
{ | |
if (node.Method == distanceMethod) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyComplexEntity | |
{ | |
public DbGeography FirstPointLocation { get; set; } | |
public GeographyPoint FirstPointCoordinates { /* ... */ } | |
public DbGeography SecondPointLocation { get; set; } | |
public GeographyPoint SecondPointCoordinates { /* ... */ } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VisitorActionFilterAttribute : ActionFilterAttribute | |
{ | |
private static readonly GeoDistanceVisitor geoDistanceVisitor = new GeoDistanceVisitor(); | |
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) | |
{ | |
if (actionExecutedContext.Response != null && actionExecutedContext.Exception == null) | |
{ | |
var objectContent = actionExecutedContext.Response.Content as ObjectContent; | |
if (objectContent != null) |
OlderNewer