Skip to content

Instantly share code, notes, and snippets.

View jlamch's full-sized avatar

Joanna Lamch jlamch

View GitHub Profile
@startuml Aritco register device
skinparam participant {
FontColor black
AttributeFontColor black
FontSize 17
AttributeFontSize 15
AttributeFontname Droid Sans Mono
BackgroundColor #b9e1fa
BorderColor black
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- master
pool:
name: Hosted VS2017
/* ==Scripting Parameters==
Source Server Version : SQL Server 2016 (13.0.4001)
Source Database Engine Edition : Microsoft SQL Server Express Edition
Source Database Engine Type : Standalone SQL Server
Target Server Version : SQL Server 2017
Target Database Engine Edition : Microsoft SQL Server Standard Edition
Target Database Engine Type : Standalone SQL Server
*/
SELECT columns
FROM TableA
LEFT OUTER JOIN TableB
ON A.columnName = B.columnName
select *
from dbo.girls g
left join dbo.girltype gt
on g.typeid = gt.id
public static class LeftJoin
{
public static IEnumerable<Girl> LeftJoinUsingSqlLikeSyntax(
IEnumerable<Girl> girls,
IEnumerable<GirlType> girlTypes)
{
var result = from g in girls
join gt in girlTypes on g.TypeId equals gt.Id into gr
from output in gr.DefaultIfEmpty()
select new Girl()
List one
List count 5
Id:1; TypeId:4; Name:Kyra; TypeName:Queen
Id:2; TypeId:2; Name:Anna; TypeName:
Id:3; TypeId:0; Name:Hanna; TypeName:None
Id:4; TypeId:3; Name:Daria; TypeName:General
Id:5; TypeId:1; Name:Harriet; TypeName:Engineer
List two
public void SetOperations()
{
List<Girl> listOne = DataGenerator.GetGilsListOne();
List<Girl> listTwo = DataGenerator.GetGilsListTwo();
var unionLists = listOne.Union(listTwo, new GirlByNameComparer());
var intersectedLists = listOne.Intersect(listTwo, new GirlByNameComparer());
var oneExceptTwoLists = listOne.Except(listTwo, new GirlByNameComparer());
var simetricDifference = listOne.Except(intersectedLists, nameComparer)
.Concat(listTwo.Except(intersectedLists, nameComparer));
public static List<Girl> GetGilsListOne()
{
return new List<Girl>
{
new Girl{ Name = "Kyra", Id = 1, TypeId = 4, TypeName="Queen" },
new Girl{ Name = "Anna", Id = 2, TypeId = 2, TypeName="" },
new Girl{ Name = "Hanna", Id = 3, TypeId = 0, TypeName="None" },
new Girl{ Name = "Daria", Id = 4, TypeId = 3, TypeName="General" },
new Girl{ Name = "Harriet", Id = 5, TypeId = 1, TypeName="Engineer"},
};
public class GirlByNameComparer : IEqualityComparer<Girl>
{
public bool Equals(Girl girl1, Girl girl2)
{
if (girl2 == null && girl1 == null)
{ return true; }
if (girl1.Name.Equals(girl2.Name))
{ return true; }
public static class InnerJoin
{
public static IEnumerable<Girl> InnerJoinTwoCollectionUsingSqlLikeSyntax(
IEnumerable<Girl> girls,
IEnumerable<GirlType> girlTypes)
{
var result = from g in girls
join gt in girlTypes on g.TypeId equals gt.Id
select new Girl() { Id = g.Id, Name = g.Name, TypeName = gt.Name, TypeId = g.TypeId };
return result;