Fetching value from collection
<pre><code>public string GetProductVariantImageUrl(ShoppingCartItem shoppingCartItem)
{
    string pictureUrl = String.Empty;
    ProductVariant productVariant = shoppingCartItem.ProductVariant;
    // **[here the count comes 0]{case1}**
    ProductVariantAttributeValueCollection pvaValues = shoppingCartItem.Attributes; 
}

public string GetAttributeDescription(ShoppingCartItem shoppingCartItem)
{
    string result = string.Empty;

    ProductVariant productVariant = shoppingCartItem.ProductVariant;
    if (productVariant != null)
    {
        // [here count is 1]
        ProductVariantAttributeValueCollection pvaValues = shoppingCartItem.Attributes;
    }
}
</code></pre>

<p><strong>WHY am i not able to get count as 1 for the case1.</strong></p>

<pre><code>/// &lt;summary&gt;
/// Represents a shopping cart item
/// &lt;/summary&gt;
public class ShoppingCartItem : BaseEntity
{
    #region Fields
    private ProductVariant _cachedProductVariant;
    private ProductVariantAttributeValueCollection _cachedPvaValues;
    #endregion

    #region Ctor
    /// &lt;summary&gt;
    /// Creates a new instance of the shopping cart class
    /// &lt;/summary&gt;
    public ShoppingCartItem()
    {
    }
    #endregion

    #region Properties
    /// &lt;summary&gt;
    /// Gets or sets the shopping cart item identifier
    /// &lt;/summary&gt;
    public int ShoppingCartItemID { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the shopping cart type identifier
    /// &lt;/summary&gt;
    public int ShoppingCartTypeID { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the customer session identifier
    /// &lt;/summary&gt;
    public Guid CustomerSessionGUID { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the product variant identifier
    /// &lt;/summary&gt;
    public int ProductVariantID { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the product variant attribute identifiers
    /// &lt;/summary&gt;
    public List&lt;int&gt; AttributeIDs { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the text option
    /// &lt;/summary&gt;
    public string TextOption { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the quantity
    /// &lt;/summary&gt;
    public int Quantity { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the date and time of instance creation
    /// &lt;/summary&gt;
    public DateTime CreatedOn { get; set; }

    /// &lt;summary&gt;
    /// Gets or sets the date and time of instance update
    /// &lt;/summary&gt;
    public DateTime UpdatedOn { get; set; }
    #endregion

    #region Custom Properties

    /// &lt;summary&gt;
    /// Gets the log type
    /// &lt;/summary&gt;
    public ShoppingCartTypeEnum ShoppingCartType
    {
        get
        {
            return (ShoppingCartTypeEnum)ShoppingCartTypeID;
        }
    }

    /// &lt;summary&gt;
    /// Gets the product variant
    /// &lt;/summary&gt;
    public ProductVariant ProductVariant
    {
        get
        {
            if (_cachedProductVariant == null)
            {
                _cachedProductVariant = ProductManager.GetProductVariantByID(ProductVariantID);
            }
            return _cachedProductVariant;
        }
    }

    /// &lt;summary&gt;
    /// Gets the product variant attribute values
    /// &lt;/summary&gt;
    public ProductVariantAttributeValueCollection Attributes
    {
        get
        {
            if (_cachedPvaValues == null)
            {
                ProductVariantAttributeValueCollection pvaValues = new ProductVariantAttributeValueCollection();
                foreach (int attributeID in this.AttributeIDs)
                {
                    ProductVariantAttributeValue pvaValue = ProductAttributeManager.GetProductVariantAttributeValueByID(attributeID);
                    if (pvaValue != null)
                        pvaValues.Add(pvaValue);
                }
                _cachedPvaValues = pvaValues;
            }
            return _cachedPvaValues;
        }
    }

    /// &lt;summary&gt;
    /// Gets the total weight
    /// &lt;/summary&gt;
    public decimal TotalWeigth
    {
        get
        {
            decimal totalWeigth = decimal.Zero;
            ProductVariant productVariant = ProductVariant;
            if (productVariant != null)
            {
                decimal attributesTotalWeight = decimal.Zero;
                foreach (ProductVariantAttributeValue pvaValue in this.Attributes)
                {
                    attributesTotalWeight += pvaValue.WeightAdjustment;
                }
                decimal unitWeight = productVariant.Weight + attributesTotalWeight;
                totalWeigth = unitWeight * Quantity;
            }
            return totalWeigth;
        }
    }

    /// &lt;summary&gt;
    /// Gets a value indicating whether the shopping cart item is free shipping
    /// &lt;/summary&gt;
    public bool IsFreeShipping
    {
        get
        {
            ProductVariant productVariant = this.ProductVariant;
            if (productVariant != null)
                return productVariant.IsFreeShipping;
            return true;
        }
    }
</code></pre>
