Ray's playground

 
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 56 下一页

2011年2月19日

Item 29: Support Generic Covariance and Contravariance(Effective C#)

摘要: It certainly can get complicated describing exactly how covariance andcontravariance work. Thankfully, now the language supports decoratinggeneric interfaces and delegates with in (contravariant) and out (covariant)modifiers. You should decorate any interfaces and delegates you definewith the in or 阅读全文

posted @ 2011-02-19 11:12 Ray Z 阅读(147) 评论(0) 推荐(0)

2011年2月17日

Item 28: Create Large-Grain Internet Service APIs(Effective C#)

摘要: Nothing special. 阅读全文

posted @ 2011-02-17 21:28 Ray Z 阅读(130) 评论(0) 推荐(0)

Item 27: Prefer Making Your Types Serializable(Effective C#)

摘要: The .NET Framework provides a simple, standard algorithm for serializingyour objects. If your type should be persisted, you should follow thestandard implementation. If you don’t support serialization in your types,other classes that use your type can’t support serialization, either. Mak 阅读全文

posted @ 2011-02-17 21:13 Ray Z 阅读(240) 评论(0) 推荐(0)

2011年2月16日

Item 26: Avoid Returning References to Internal Class Objects(Effective C#)

摘要: You built the interfaceto your class, and you want users to follow it. You don’t want users to accessor modify the internal state of your objects without your knowledge.You’ve got four different strategies for protecting your internal data structuresfrom unintended modifications: value t 阅读全文

posted @ 2011-02-16 20:56 Ray Z 阅读(206) 评论(0) 推荐(0)

Item 25: Implement the Event Pattern for Notifications(Effective C#)

摘要: Events provide a standard syntax for notifying listeners. The .NET EventPattern follows the event syntax to implement the Observer Pattern. Anynumber of clients can attach handlers to the events and process them.Those clients need not be known at compile time. Events don’t need subscribersfor 阅读全文

posted @ 2011-02-16 20:40 Ray Z 阅读(223) 评论(0) 推荐(0)

Basic Core Data(Chapter 11 of Cocoa Programming for Mac OS X)

摘要: Apple decided to make this type of application extremely easy to write: NSArrayControllerwill hold on to an array of objects. Bindings will eliminate much of the glue code that would be necessary to keep the model objects in sync with the views. NSManagedObjectContextwill observe the instance v 阅读全文

posted @ 2011-02-16 16:25 Ray Z 阅读(176) 评论(0) 推荐(0)

2011年2月15日

Creating Links and Cross-References(Chapter 6 of XSLT 2nd Edition)

摘要: The key() function returns a node-set from the document, using the index specified by an <xsl:key> element.cdcatalog.xmlCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1<?xmlversion="1.0"encoding="ISO-8859-1"?>2<!--EditedbyXMLSpy® 阅读全文

posted @ 2011-02-15 18:37 Ray Z 阅读(193) 评论(0) 推荐(0)

Archiving(Chapter 10 of Cocoa Programming for Mac OS X)

摘要: One protocol is NSCoding. If your class implements NSCoding, it promises to implement the following methods: An NSCoderis an abstraction of a stream of bytes. You can write your data to a coder or read your data from a coder. TheinitWithCoder:method in your object will read data from the coder a 阅读全文

posted @ 2011-02-15 18:01 Ray Z 阅读(242) 评论(0) 推荐(0)

NSUndoManager(Chapter 9 of Cocoa Programming for Mac OS X)

摘要: DocumentCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--1//2//MyDocument.m3//RaiseMan4//5//Createdbyb1mobileon2/14/11.6//Copyright2011__MyCompanyName__.Allrightsreserved.7//89#import"MyDocument.h"10#import"Person.h"1112@implementationMyDocument1314-( 阅读全文

posted @ 2011-02-15 11:15 Ray Z 阅读(370) 评论(0) 推荐(0)

2011年2月14日

Item 24: Express Callbacks with Delegates(Effective C#)

摘要: Delegates provide the best way to utilize callbacks at runtime, with simplerrequirements on client classes. You can configure delegate targets at runtime.You can support multiple client targets. Client callbacks should beimplemented using delegates in .NET. 阅读全文

posted @ 2011-02-14 21:10 Ray Z 阅读(154) 评论(0) 推荐(0)

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 56 下一页

导航