示例#1
0
        public IList <Share> CollectActiveShares(string _fromAddress, double _amountTransaction)
        {
            IList <Share>       Shares;
            IList <Share>       UsableShares = new List <Share>();
            Share               LocalShare;
            double              amountFree = 0;
            IEnumerator <Share> ShareEnumerator;

            Shares = GetOwnerShares(_fromAddress);

            ShareEnumerator = Shares.GetEnumerator();

            while (ShareEnumerator.MoveNext())
            {
                LocalShare = ShareEnumerator.Current;

                if (!IsShareSpend(LocalShare))
                {
                    amountFree += LocalShare.Amount;
                    UsableShares.Add(LocalShare);

                    if (amountFree >= _amountTransaction)   //If we found enough shares value to send from, break
                    {
                        return(UsableShares);
                    }
                }
            }

            return(null);
        }