This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
// 初始化一个context | |
var cxt = new Context(); | |
cxt.StepModel1 = new StepModel1{ Name = "foo1" }; | |
cxt.StepModel2 = new StepModel2{ Name = "foo2" }; | |
// 从context一个方法的内部的集合中取出一个model | |
var model1 = cxt.GetStepModel(1); | |
// 试着更新它 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 修改前报异常。Entity中缺少新增的字段A,但是返回的异常是一个类型转换相关的 | |
short minSecId = queryNoCached.Min(prc => prc.CacheHour); | |
// 修改后, 运行时容忍了Entity中缺少了新增的字段 | |
short minSecId = queryNoCached.Min(prc => (short?)prc.CacheHour) ?? 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FlightsPlanEqualityComparer : IEqualityComparer<FlightsPlan> | |
{ | |
public bool Equals(FlightsPlan x, FlightsPlan y) | |
{ | |
if (x.Flights.Count != y.Flights.Count) | |
{ | |
return false; | |
} | |
for (int i = 0; i < x.Flights.Count; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Xml; | |
using System.Xml.Linq; | |
namespace CheckUnusedErrorCode | |
{ | |
class MainClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//lib.sinaapp.com/js/jquery/1.5.2/jquery.min.js"></script> | |
<script type="text/javascript"> window.jQuery || document.write('<script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")">\x3C/script>')</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var HhSelect = { | |
init: function ($selects) { | |
$selects.each(function () { | |
HhSelect._initSelect($(this)); | |
}); | |
// 点击页面任何地方,收起下拉框 | |
$(function () { | |
$('body').click(function () { | |
$('div.tag_select_open').attr('class', 'tag_select'); | |
$('ul.tag_options').hide(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 生成_ListBar 的各项url | |
/// </summary> | |
/// <param name="name"></param> | |
/// <param name="value"></param> | |
/// <param name="baseUrl"></param> | |
/// <returns></returns> | |
private string PrepareUrl4ListBar(string name, string value, string baseUrl) | |
{ | |
string newUrl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
string [] phones = { "18616386880", "18621168732" }; | |
Foo foo = new Foo(phones); | |
Console.WriteLine(foo.Phones[0]); | |
phones[0] = "xxx"; | |
Console.WriteLine(foo.Phones[0]); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal override IQueryable<Entity.ProductWrapper> AllWrapperedProducts() | |
{ | |
DateTime today = DateTime.Now.Date; | |
var query = (from p in ProductDbContext.Product | |
where p.ResourceType == (int)ProductResourceType.产品 | |
&& p.PkgId.HasValue && p.PkgId.Value != 0 | |
&& p.ExpireDate.HasValue | |
&& p.EffectDate.HasValue | |
&& p.IsValid.HasValue && p.IsValid.Value |