Skip to content

Instantly share code, notes, and snippets.

View rafaelsc's full-sized avatar

Rafael Sliveira Cordeiro rafaelsc

  • Vancouver - BC - Canada
  • 19:18 (UTC -07:00)
View GitHub Profile
internal static IEnumerable<T> MyIntersect<T>(this IEnumerable<T> first, IEnumerable<T> second) {
Debug.Assert(first != null);
Debug.Assert(second != null);
var firstHashset = first as HashSet<T>;
var secondHashset = second as HashSet<T>;
if (firstHashset != null && secondHashset != null) {
return (firstHashset.Count > secondHashset.Count)
? firstHashset.Intersect(second)
: secondHashset.Intersect(first);
}
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//