试图使用WPF创建一个ListBox,我想用Code填充成员

问题描述

|| 我正在尝试从此网站http://msdn.microsoft.com/zh-cn/library/cc265158(v=vs.95).aspx了解如何,但是代码无法编译,因此我得到了很多错误。 这是我的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bail
{
    public class ListboxMenuItem
    {
        public String FirstName { get; set; }
        public String LastName { get; set; }
        public String Address { get; set; }

        public ListboxMenuItem(String firstName,String lastName,String address)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
            this.Address = address;
        }
    }

    class ListboxMenuItems
    {
        List<ListboxMenuItem> Items;

        Items = new List<ListboxMenuItem>();
        Items.Add(new ListboxMenuItem(\"Michael\",\"Anderberg\",\"12 North Third Street,Apartment 45\"));
        Items.Add(new ListboxMenuItem(\"Chris\",\"Ashton\",\"34 West Fifth Street,Apartment 67\"));
        Items.Add(new ListboxMenuItem(\"Cassie\",\"Hicks\",\"56 East Seventh Street,Apartment 89\"));
        Items.Add(new ListboxMenuItem(\"Guido\",\"Pica\",\"78 South Ninth Street,Apartment 10\"));

    }
}
所有错误均与商品有关 例如“ 1”会产生错误   错误1类,结构或接口成员声明ListboxMenuItems.cs中的无效令牌\'= \'26 15 Bail     

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)