When creating a criteria in NHibernate I can use
Restriction.In() or
Restriction.InG()
What is the difference between them?
InG is the generic equivalent of In (for collections)
The signatures of the methods are as follows (only the ICollection In overload is shown):
In(string propertyName, ICollection values)
vs.
InG<T>(string propertyName, ICollection<T> values)
Looking at NHibernate's source code (trunk) it seems that they both copy the collection to an object array and use that going forward, so I don't think there is a performance difference between them.
I personally just use the In one most of the time - its easier to read.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With