المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to create a colletion of properties in a C# class



C# Programming
01-03-2013, 04:43 AM
Hello folks,

Happy New Year!!!

I have a class that has couple of properties.

Can I have a property in that class that can be a collection. Like say the MarketData. can I have a property say "FailedCurves" . It is a string property. But only thing is, this property is an ArrayList or Dictionary object that can have multiple string items in it.

How can I do that in C#? Am I thinking correct?

Thanks much
public class MarketData { #region "Private Data Members" private int _countAdvanceCurve; private int _countAdvancesSBCAgencyCurve; private int _countAdvancesSBCAAACurve; private int _countFhlbsfTreasuryCurve; private int _countDNCOCurve; #endregion "Private Data Members" #region "Public Data Members" public int CountAdvanceCurve { get { return _countAdvanceCurve; } set { _countAdvanceCurve = value; } }}