开发者

class with arrays windows phone 7, is this correct?

hi im going to create an object called "day" which stores all the users movements for the day(longditude, latitude).. think of the day as a session, that will be listed in a Listbox, i just want one name but multible longditudes&latitudes.

now is this correct for me to just declare that these are arrays with no popper size??(until an instance is created)

    public class day : INotifyPropertyChanged
{
    private string name;
    /// <summary>
    /// Sample ViewModel property; this property is used in the view to display its value using a Binding.
    /// </summary>
    /// <returns></returns>
    [DataMember]
    public string Name
    {
        get
        {
            return name;
        }
        set
        {
            if (value != name)
            {
                name = value;
                NotifyPropertyChanged("Name");
            }
        }
    }
    private string[] longitude;
    [DataMember]
    public string[] Longitude
    {
        get
        {
            return longitude;
        }
        set
        {
            if (value != longitude)
            {
                longitude = value;
                NotifyPropertyChanged("Longitude");
            }
        }
    }


    private string[] latitude;
    [DataMember]
    public string[] Latitude
    {
        get
        {
            return latitude;
        }
        set
        {
            if (value != latitude)
            {
                latitude = value;
                NotifyPro开发者_Python百科pertyChanged("Latitude");
            }
        }
    }


    // Save to isoldated storage (dat file) 
    public void Save()
    {
        ObservableCollection<day> currentDay = IsolatedStorage.Load<ObservableCollection<day>>(App.daysFileName);
        currentDay.Add(this);
        IsolatedStorage.Save<ObservableCollection<day>>(App.daysFileName, currentDay);
    }


Yes, that is correct. Arrays in .NET are created and sized at runtime as opposed to compile time.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜