属性设置的一些异常行为(二)
2013-05-14 19:34
381 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConTest
{
class Pan
{
public string Name { get; set; }
public double Price { get; set; }
public int Total { get; set; }
/// <summary>
/// 深圳平底锅的价格信息
/// </summary>
public static Pan SZ
{
get
{
return new Pan() {Name="深圳",Price=45.5,Total=100,};
}
}
/// <summary>
/// 上海平底锅的价格信息
/// </summary>
public static Pan SH
{
get
{
return new Pan() { Name = "上海", Price = 46.5, Total = 150, };
}
}
/// <summary>
/// 北京平底锅的价格信息
/// </summary>
public static Pan BJ
{
get
{
return new Pan() { Name = "北京", Price = 48.2, Total = 80, };
}
}
/// <summary>
/// 广州平底锅的价格信息
/// </summary>
public static Pan GZ
{
get
{
return new Pan() { Name = "广州", Price = 43.5, Total = 250, };
}
}
public Pan()
{
}
public Pan(string name ,double price,int total)
{
this.Name = name;
this.Price = price;
this.Total = total;
}
}
}
List<Pan> pans = new List<Pan>() { Pan.BJ, Pan.GZ, Pan.SH, Pan.SZ };
Console.WriteLine("四大城市平底锅的价格基本信息如下:");
foreach (var item in pans)
{
Console.WriteLine("地区:" +item.Name+ "\t平底锅价格:" + item.Price + "\t销量:" + item.Total);
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConTest
{
class Pan
{
public string Name { get; set; }
public double Price { get; set; }
public int Total { get; set; }
/// <summary>
/// 深圳平底锅的价格信息
/// </summary>
public static Pan SZ
{
get
{
return new Pan() {Name="深圳",Price=45.5,Total=100,};
}
}
/// <summary>
/// 上海平底锅的价格信息
/// </summary>
public static Pan SH
{
get
{
return new Pan() { Name = "上海", Price = 46.5, Total = 150, };
}
}
/// <summary>
/// 北京平底锅的价格信息
/// </summary>
public static Pan BJ
{
get
{
return new Pan() { Name = "北京", Price = 48.2, Total = 80, };
}
}
/// <summary>
/// 广州平底锅的价格信息
/// </summary>
public static Pan GZ
{
get
{
return new Pan() { Name = "广州", Price = 43.5, Total = 250, };
}
}
public Pan()
{
}
public Pan(string name ,double price,int total)
{
this.Name = name;
this.Price = price;
this.Total = total;
}
}
}
List<Pan> pans = new List<Pan>() { Pan.BJ, Pan.GZ, Pan.SH, Pan.SZ };
Console.WriteLine("四大城市平底锅的价格基本信息如下:");
foreach (var item in pans)
{
Console.WriteLine("地区:" +item.Name+ "\t平底锅价格:" + item.Price + "\t销量:" + item.Total);
}
相关文章推荐
- 属性设置的一些异常行为
- 使用Unity3d和C#的一些属性来设置特殊行为
- Android中Paint字体属性的一些设置
- CALayer设置图片等的一些属性
- iOS开发--一些UINavigationBar属性的设置
- scrapy spider 一些设置属性说明
- Android中 Paint 字体、粗细等属性的一些设置
- TextView设置抗锯齿,及其他常用的一些属性设置
- 文件属性的设置和一些简单操作
- Flex设置form表单一些属性设置
- 项目开发中的一些注意事项以及技巧总结 基于Repository模式设计项目架构—你可以参考的项目架构设计 Asp.Net Core中使用RSA加密 EF Core中的多对多映射如何实现? asp.net core下的如何给网站做安全设置 获取服务端https证书 Js异常捕获
- Android EditText 一些属性设置
- 数据源通过将 ConflictDetection 属性设置为 CompareAllValues 该属性默认设置为 OverwriteChanges。OverwriteChanges 模式本质上意味着“仅为了更新或删除记录而匹配主键值”。这种行为意味着不管记
- UIButton textAlignment设置和一些属性设置
- RevitAPI: 设置管件族的连接件的半径属性抛异常 - 如何获取关联族参数
- Android中Paint字体属性的一些设置
- 设置DataGridView的某行为焦点(类似Focus属性)
- iOS开发--一些UITabBarItem属性的设置[转]
- WARN com.opensymphony.xwork2.ognl.OgnlValueStack异常的解决办法[提交按钮使用了图片并设置name属性,对应action无gettersetter]
- 根据块和内联元素的特性,为什么一些内联元素有可以设置宽高属性