LINQ to Water

May 22, 2008 09:16 by admin

Well, not really, but The Great LINQ shows a usage of LINQ to Objects over a chemistry domain:

 

from atom in molecule.Atoms
where atom.Element == Element.Hydrogen
and atom.Bonds.Count == 1
from atom2 in atom.Bonds[0].FindAtom(a => a != atom && a.Element == Element.Oxygen)
where atom2.FindBonds(b => b != atom.Bonds[0]).Count == 1
select atom2.FindBonds(b => b != atom.Bonds[0])[0].FindAtom(a => a != atom2)

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

January 6. 2009 01:30