private static IReadScalar <int> getIndex(IReadScalar <INotifyCollectionChanged> sourceScalar) { IReadScalar <IList> listComputing = sourceScalar.Using(s => (IList)s.Value); Expression <Func <int> > indexExpression = () => listComputing.Value != null && listComputing.Value.Count > 0 ? listComputing.Value.Count - 1 : 0; return(indexExpression.Computing()); }