Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var matches = from item1 in list1
- join item2 in list2 on item1.Email equals item2.Email
- select new { Email = list1.Email };
- NorthwindDataContext dc = new NorthwindDataContext();
- dc.Log = Console.Out;
- var query =
- from c in dc.Customers
- where !(from o in dc.Orders
- select o.CustomerID)
- .Contains(c.CustomerID)
- select c;
- foreach (var c in query) Console.WriteLine( c );
- var answer = list1.Except(list2);
- from item1 in List1
- where !(list2.Any(item2 => item2.Email == item1.Email))
- select item1;
- var itemIds = inMemoryList.Select(x => x.Id).ToArray();
- var otherObjects = context.ItemList.Where(x => !itemIds.Contains(x.Id));
- var secondEmails = (from item in list2
- select new { Email = item.Email }
- ).ToList();
- var matches = from item in list1
- where !secondEmails.Contains(item.Email)
- select new {Email = item.Email};
- List<int> list1 = new List<int>();
- // fill data
- List<int> list2 = new List<int>();
- // fill data
- var results = from i in list1
- where !list2.Contains(i)
- select i;
- foreach (var result in results)
- Console.WriteLine(result.ToString());
- 'Then get the Item Mappings Present for the branch
- Dim _adpt As New gItem_BranchesTableAdapter
- Dim dt As New ds_CA_HO.gItem_BranchesDataTable
- _adpt.FillBranchMappings(dt, BranchId)
- Dim _MappedItems As List(Of LocalItem) = (From _item As LocalItem In _AllItems Join _
- dr As ds_CA_HO.gItem_BranchesRow In dt _
- On _item.Id Equals dr.numItemID _
- Select _item).ToList
- _AllItems = _AllItems.Except(_MappedItems.AsEnumerable).ToList
- Return _AllItems
- var linked =
- from x in dc.X
- from y in dc.Y
- where x.MyProperty == y.MyProperty
- select x;
- var notLinked =
- dc.X.Except(linked);
- class Program
- {
- static void Main(string[] args)
- {
- // creates some foos
- List<Foo> fooList = new List<Foo>();
- fooList.Add(new Foo { Id = 1, BarId = 11 });
- fooList.Add(new Foo { Id = 2, BarId = 12 });
- fooList.Add(new Foo { Id = 3, BarId = 13 });
- fooList.Add(new Foo { Id = 4, BarId = 14 });
- fooList.Add(new Foo { Id = 5, BarId = -1 });
- fooList.Add(new Foo { Id = 6, BarId = -1 });
- fooList.Add(new Foo { Id = 7, BarId = -1 });
- // create some bars
- List<Bar> barList = new List<Bar>();
- barList.Add(new Bar { Id = 11 });
- barList.Add(new Bar { Id = 12 });
- barList.Add(new Bar { Id = 13 });
- barList.Add(new Bar { Id = 14 });
- barList.Add(new Bar { Id = 15 });
- barList.Add(new Bar { Id = 16 });
- barList.Add(new Bar { Id = 17 });
- var linked = from foo in fooList
- from bar in barList
- where foo.BarId == bar.Id
- select foo;
- var notLinked = fooList.Except(linked);
- foreach (Foo item in notLinked)
- {
- Console.WriteLine(
- String.Format(
- "Foo.Id: {0} | Bar.Id: {1}",
- item.Id, item.BarId));
- }
- Console.WriteLine("Any key to continue...");
- Console.ReadKey();
- }
- }
- class Foo
- {
- public int Id { get; set; }
- public int BarId { get; set; }
- }
- class Bar
- {
- public int Id { get; set; }
- }
- var items = FileMaintenanceBusiness.Instance.GetAllCodes();
- var result = (from i in items select i.Code).Max();
- List<int> countLIst = new List<int>();
- for (int i = 1; i <= result; i++)
- {
- countLIst.Add(i);
- }
- var query =
- from c in countLIst
- where !(from o in items
- select o.Code)
- .Contains(c)
- select c;
- int minID= (from q in query select q).Min();
- ID = minID;
Add Comment
Please, Sign In to add comment