2014年3月20日

【转载】#470 Define Your Own Custom Attribute

摘要: You can use predefined attributes to attach metadata to type members.You can also define a custom attribute by creating a new class inheriting from System.Attribute. The class name must end in "Attribute". You typically define a conostructor that takes arguments that consist of the metadat 阅读全文

posted @ 2014-03-20 21:31 yuthreestone 阅读(253) 评论(0) 推荐(0) 编辑

【转载】#458 Errors While Converting Between enum and Underlying Type

摘要: You can convert to an enum value from its underlying type by casting the underlying type (e.g. int) to the enum type.However, when you cast a value that doesn't have a corresponding enumerator in the type, you don't get any sort of error.In the example below,the Mood type has enumerators tha 阅读全文

posted @ 2014-03-20 20:36 yuthreestone 阅读(209) 评论(0) 推荐(0) 编辑

【转载】#457 Converting Between enums and their Underlying Type

摘要: When you declare an enum, by default each enumerated value is represented internally with an int. (System.Int32 - 4 bytes). You can convert between values of the underlying type and enum values using an explicit cast. Because an enum is represented by an int by default, you can convert between integ 阅读全文

posted @ 2014-03-20 20:20 yuthreestone 阅读(196) 评论(0) 推荐(0) 编辑

2014年3月17日

Microsoft Visual C++ 2005 Redistributable 无法卸载问题解决办法

摘要: 今日遇到一个问题,Microsoft Visual C++ 2005 Redistributable 无法卸载,弹出的对话框如下所示:试了一些网上的方法,比如下载vcredist_x86.exe,解压得到VCREDI~3.EXE,继续解压VCREDI~3.EXE,得到vcredist.msi,用这个文件作为使用源。但是应该是版本不一致的问题,弹出下面的对话框:继续寻找解决办法,最终在Microsoft官网上找到了答案:Manual Uninstall of Visual C++ 2005 Redistributable,用Windows Installer Cleanup Utility手动删 阅读全文

posted @ 2014-03-17 14:09 yuthreestone 阅读(4656) 评论(0) 推荐(0) 编辑

2014年3月14日

纠结的一天 —— 由base64编解码与加号、空格引起

摘要: 2014年3月14日,星期五, 23点22分忙碌、焦头烂额、充实而又幸福的一天!写在篇头的话:许多时候,别人分享的经验(成功或失败),个中滋味,听者很难真正体会,直到自己遇到的那一瞬间,才会泪如雨下,幡然醒悟......今天将之前写的MATLAB版本的程序,用C#重新实现。原因嘛,不得不发句牢骚,MATLAB打包成exe后,启动时间都要几十秒甚至一两分钟,真是急死人的节奏啊!(每次给别人演示的时候,双击图标后到要和别人先聊会儿天,无语吧!)言归正传,遇到的问题是,利用post方法将一些数据提交给服务器的网页中,数据采用base64编码。悲剧发生了:c#版本提交的数据,服务器居然无法进行正确的b 阅读全文

posted @ 2014-03-14 23:23 yuthreestone 阅读(12878) 评论(2) 推荐(0) 编辑

2014年3月12日

【转载】#446 - Deciding Between an Abstract Class and an Interface

摘要: An abstract class is a base class that may have some members not implemented in the base class, but only in the derived classes. An interface is just a contract that a class can choose to fulfill - a list fo member that it must implement if it implements the interface.You'll often use an abstrac 阅读全文

posted @ 2014-03-12 17:20 yuthreestone 阅读(213) 评论(0) 推荐(0) 编辑

【转载】#445 - Differences Between an Interface and an Abstract Class

摘要: An interface provides a list of members, without an implementation, that a class can choose to implement. This is similar to an abstract class, which may include abstract methods that have no implementation in the abstract class, but might also include an implementation for some of its members.One d 阅读全文

posted @ 2014-03-12 17:10 yuthreestone 阅读(155) 评论(0) 推荐(0) 编辑

【转载】#443 - An Interface Cannot Contain Fields

摘要: An interface can contain methods, properties, events or indexers. It cannot contain fields.1 interface IMoo2 {3 // Methods4 void Moo();5 6 // Field not allow - compile-time error7 string Name;8 }Instead of a field, you can use a property.1 interface IMoo2 {3 // Methods4 voi... 阅读全文

posted @ 2014-03-12 16:59 yuthreestone 阅读(294) 评论(0) 推荐(0) 编辑

【转载】#440 - A Class Can Implement More than One Interface

摘要: It's possible for a class to implement more than one interface.For example, a Cow class might implement both the IMoo and the IMakeMilk interfaces. Multiple interfaces are listed after the class declaration, separated by commas. 1 public class Cow: IMoo, IMakeMilk 2 { 3 public void Moo() 4 {... 阅读全文

posted @ 2014-03-12 16:41 yuthreestone 阅读(270) 评论(0) 推荐(0) 编辑

【转载】#438 - Benefits of Using Interfaces

摘要: You might wonder why you'd define an interface, have a class implement that interface and then access the class through the interface instead of just using the class directly.One benefit of interface is that it allows you to treat different types of objects in the same way, provided that they im 阅读全文

posted @ 2014-03-12 16:25 yuthreestone 阅读(222) 评论(0) 推荐(0) 编辑

导航