I believe the following should do the trick:
Contract.Requires(
Contract.ForAll(
coll,
obj => (coll.Where(x=>x.PropA = obj.PropA).Count==1)
)
);
, coll , PropA , . ().
B.
ForAll, , . , , , , , - , ...
, :
Contract.Requires(
Contract.ForAll(
coll.GroupBy(x=>x.PropA),
group => group.Count==1)
)
);
, , , ( - linq).
:
HashSet<object> propAValues = new HashSet<object>();
Contract.Requires(
!coll.Any(x=>!hashset.Add(x.PropA))
);
hashset , Add false, . , Add (, , ), Any true, , , .
, , , (, , . , ( , , ).