当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: source:this article is from a bo
 

 

    摘要: 前些日子,在网上看到好多web网站即时消息的例子,大都是xml做的,无奈对于我这个跑的慢的人(xml看了一个月,还是没搞明白怎么用),只好望而兴叹了。没办法只能从c#的角落里把application再揪出来用用了.(尽管听他们说实现的效率比webservice差很多) 。呵呵,废话不说了,不过在高手面前班门弄斧还是有点脸红的,呵呵. (1) 存入用户列表把用户名存入application代码如下......
 ·vb.net中的line控件     »显示摘要«
    摘要:在vb.net中去掉了line控件,我们用.net转换包含有line控件的vb6的工程后,发现取而代之的是label。其实我们还可以有另一种画线的方法: public class line inherits system.windows.forms.usercontrol public toplc as system.drawing.color = system.drawing.color.whi......


C# Programming Guidelines

source:

thinking in c# 【程序编程相关:读写INI文件的四个函数

this article is from a book named<thinking in c#>,if you are interested in the book,youd better to have a real book made by paper :) 【推荐阅读:TreeView 控件树状控件的填充VB

  【扩展信息:CodProject.com上的一些好代

larry o’brien  and bruce eckel

 

prentice hallupper saddle river, new jersey 07458www.phptr.com

begin:

c[this appendix contains suggestions to help guide you in performing low-level program design, and in writing code.

naturally, these are guidelines and not rules. the idea is to use them as inspirations, and to remember that there are occasional situations where you need to bend or break a rule.

design

1.              elegance always pays off. in the short term it might seem like it takes much longer to come up with a truly graceful solution to a problem, but when it works the first time and easily adapts to new situations instead of requiring hours, days, or months of struggle, you’ll see the rewards (even if no one can measure them). not only does it give you a program that’s easier to build and debug, but it’s also easier to understand and maintain, and that’s where the financial value lies. this point can take some experience to understand, because it can appear that you’re not being productive while you’re making a piece of code elegant. resist the urge to hurry; it will only slow you down.

1.       first make it work, then make it fast. this is true even if you are certain that a piece of code is really important and that it will be a principal bottleneck in your system. don’t do it. get the system going first with as simple a design as possible. then if it isn’t going fast enough, profile it. you’ll almost always discover that “your” bottleneck isn’t the problem. save your time for the really important stuff.

2.      remember the “divide and conquer” principle. if the problem you’re looking at is too confusing, try to imagine what the basic operation of the program would be, given the existence of a magic “piece” that handles the hard parts. that “piece” is an object—write the code that uses the object, then look at the object and encapsulate its hard parts into other objects, etc.

3.      separate the class creator from the class user (client programmer). the class user is the “customer” and doesn’t need or want to know what’s going on behind the scenes of the class. the class creator must be the expert in class design and write the class so that it can be used by the most novice programmer possible, yet still work robustly in the application. library use will be easy only if it’s transparent.

4.      when you create a class, attempt to make your names so clear that comments are unnecessary. your goal should be to make the client programmer’s interface conceptually simple. to this end, use method overloading when appropriate to create an intuitive, easy-to-use interface.


...   下一页
    摘要:public class test{ private void testgetrec() { //------取数据----------- dataset ds = db.getrec("select * from customer"); this.datagrid1.datasource = ds.tables[0]; } private void testexestore(......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE