10 2016 档案

摘要:所谓浅拷贝就是将对象中的所有字段复制到新的副本对象中;浅拷贝对于值类型与引用类型的方式有区别,值类型字段的值被复制到副本中后,在副本中的修改不会影响源对象对应的值;然而对于引用类型的字段被复制到副本中的却是引用类型的引用,而不是引用的对象,在副本中对引用类型的字段值被修改后,源对象的值也将被修改。 阅读全文
posted @ 2016-10-27 10:09 FredGrit 阅读(163) 评论(0) 推荐(0) 编辑
摘要:通俗的讲,就是高层模块定义接口,低层模块负责实现。 Bob Martins对DIP的定义: 高层模块不应依赖于低层模块,两者应该依赖于抽象。 抽象不不应该依赖于实现,实现应该依赖于抽象。 总结出使用DIP的优点: 系统更柔韧:可以修改一部分代码而不影响其他模块。 系统更健壮:可以修改一部分代码而不会 阅读全文
posted @ 2016-10-26 10:30 FredGrit 阅读(457) 评论(0) 推荐(0) 编辑
摘要:// // Summary: // Register a type mapping with the container. // // Parameters: // container: // Container to configure. // // injectionMembers: // In 阅读全文
posted @ 2016-10-26 09:43 FredGrit 阅读(227) 评论(0) 推荐(0) 编辑
摘要:<?xml version="1.0" encoding="utf-8" ?><PersonList> <Person Id="1"> <Name>Fred</Name> </Person> <Person Id="2"> <Name>Sophie</Name> </Person> <Person 阅读全文
posted @ 2016-10-22 14:46 FredGrit 阅读(241) 评论(0) 推荐(0) 编辑
摘要:public class StudentList:ObservableCollection<Student> { public List<Student> studentList = new List<Student>(); public StudentList() { using (mydbEnt 阅读全文
posted @ 2016-10-20 16:06 FredGrit 阅读(354) 评论(0) 推荐(0) 编辑
摘要:重载overload 派生类和基类的方法同名,其中访问修饰符(public,private,protected,internal,protected internal),返回类型,参数类型,个数,顺序中的一个或若干可以不同,实现可以不同; 重写override 必须对抽象类中声明的abstract方 阅读全文
posted @ 2016-10-20 15:00 FredGrit 阅读(195) 评论(0) 推荐(0) 编辑
摘要:接口实现: interface IMath { void Add(int x, int y); } public class MathClass : IMath { public void Add(int x, int y) { Console.WriteLine("This is the inte 阅读全文
posted @ 2016-10-20 14:17 FredGrit 阅读(297) 评论(0) 推荐(0) 编辑
摘要:1. 绑定到其它元素 <Grid> <StackPanel > <TextBox x:Name="textBox1" Height="150" BorderBrush="Black" BorderThickness="10"/> <Label Content="{Binding ElementNam 阅读全文
posted @ 2016-10-19 17:30 FredGrit 阅读(170) 评论(0) 推荐(0) 编辑
摘要:xmlns:sys="clr-namespace:System;assembly=mscorlib" <Window.Resources> <Style TargetType="TextBlock"> <Setter Property="Margin" Value="10"/> <Setter Pr 阅读全文
posted @ 2016-10-19 16:15 FredGrit 阅读(517) 评论(0) 推荐(0) 编辑
摘要:Mode,它的类型为BindingMode的枚举类型,可以取TwoWay、OneWay、OnTime、OneWayToSource、Default。 oneWay:使用 OneWay 绑定时,每当源发生变化,数据就会从源流向目标。 OneTime: 绑定也会将数据从源发送到目标;但是,仅当启动了应用 阅读全文
posted @ 2016-10-19 15:56 FredGrit 阅读(2411) 评论(0) 推荐(0) 编辑
摘要:C# 方法默认访问级别 : private C# 类默认访问级别 : internalpublic:访问不受限制。protected:访问仅限于包含类或从包含类派生的类型。Internal:访问仅限于当前程序集。protected internal:访问限制到当前程序集或从包含派生的类型的类别。pr 阅读全文
posted @ 2016-10-18 13:33 FredGrit 阅读(1343) 评论(1) 推荐(0) 编辑
摘要:static void Main(string[] args) { int[] arr = { 1, 3, 3, 3, 3, 4, 5, 4, 5, 8, 9, 3 }; //不重复 var unique = arr.GroupBy(o => o).Where(g => g.Count() == 1 阅读全文
posted @ 2016-10-18 00:28 FredGrit 阅读(656) 评论(0) 推荐(0) 编辑
摘要:static List<int> Given50RandomNumbers() { List<int> intList = new List<int>(); for(int i=1;i<=50;i++) { intList.Add(i); } if(intList.Count>0) { return 阅读全文
posted @ 2016-10-18 00:18 FredGrit 阅读(683) 评论(0) 推荐(0) 编辑
摘要:索引是与表或视图关联的磁盘上结构,可以加快从表或视图中检索行的速度。 索引包含由表或视图中的一列或多列生成的键。 这些键存储在一个结构(B 树)中,使 SQL Server 可以快速有效地查找与键值关联的行。 表或视图可以包含以下类型的索引: 群集 聚集索引根据数据行的键值在表或视图中排序和存储这些 阅读全文
posted @ 2016-10-08 20:00 FredGrit 阅读(475) 评论(0) 推荐(0) 编辑
摘要:The Control Template defines the visual appearance of a control. All of the UI elements have some kind of appearance as well as behavior, e.g., Button 阅读全文
posted @ 2016-10-08 19:50 FredGrit 阅读(168) 评论(0) 推荐(0) 编辑
摘要:public static void SortByOddAndEven(int []arr) { for (int i = 0; i < arr.Length; i++) { for (int j = arr.Length - 1; j >= i; j--) { if (arr[i] % 2 == 阅读全文
posted @ 2016-10-08 18:59 FredGrit 阅读(831) 评论(0) 推荐(0) 编辑
摘要:using System.Data.Linq;using System.Data.Linq.Mapping; namespace ConsoleApplication1388{ class Program { static void Main(string[] args) { string sour 阅读全文
posted @ 2016-10-06 14:50 FredGrit 阅读(468) 评论(0) 推荐(0) 编辑
摘要:using System.Data.Linq;using System.Data.Linq.Mapping; namespace ConsoleApplication1388{ class Program { static void Main(string[] args) { string sour 阅读全文
posted @ 2016-10-06 14:34 FredGrit 阅读(326) 评论(0) 推荐(0) 编辑
摘要:LINQ to SQL will translate .NET methods in this manner: text.StartsWith(...) = LIKE ...% text.Contains(...) = LIKE %...% text.EndsWith(...) = LIKE %.. 阅读全文
posted @ 2016-10-06 11:56 FredGrit 阅读(381) 评论(0) 推荐(0) 编辑
摘要:using (AdventureWorks2012Entities db = new AdventureWorks2012Entities()) { int num = (from stu in db.Customer orderby stu.CustomerID select stu).ToLis 阅读全文
posted @ 2016-10-06 11:19 FredGrit 阅读(673) 评论(0) 推荐(0) 编辑
摘要:object[] vals = { 1, "Hello", true, "World", 9.1 }; IEnumerable<double> justStrings = vals.OfType<double>( ); foreach(var str in justStrings) { Consol 阅读全文
posted @ 2016-10-05 16:38 FredGrit 阅读(274) 评论(0) 推荐(0) 编辑
摘要:转自, http://www.cnblogs.com/kingcat/archive/2012/07/11/2585943.html yield return 表示在迭代中下一个迭代时返回的数据,除此之外还有yield break, 其表示跳出迭代,为了理解二者的区别我们看下面的例子 class A 阅读全文
posted @ 2016-10-05 13:54 FredGrit 阅读(246) 评论(0) 推荐(0) 编辑
摘要:1.abstract 可以修饰类和方法,修饰方法时只声明不实现; 2.继承实现abstract类必须通过override实现abstract声明的方法,而virtual方法可选择override(重写)实现; 3. 阅读全文
posted @ 2016-10-05 12:36 FredGrit 阅读(130) 评论(0) 推荐(0) 编辑
摘要:1.abstract 可以修饰类和方法,修饰方法时只声明不实现; 2.继承实现abstract类必须通过override实现abstract声明的方法,而virtual方法可选择override(重写)实现; 3. 阅读全文
posted @ 2016-10-05 12:35 FredGrit 阅读(158) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示