随笔分类 - .NET
1
摘要:1. Contrasting Interfaces to Abstract Base ClassesAbstract base classes do far more than define a group of abstract methods. They are free to define public, private, and protected state data, as well as any number of concrete methods that can be accessed by the subclasses.Interfaces, on the other ha
阅读全文
摘要:1. Calling Garbage CollectionIf you determine it may be beneficial to have the garbage collector check for unreachable objects, you could explicitly trigger a garbage collection, as follows: 1: static void Main(string[] args) 2: { 3: ... 4: // Force a garbage collection and wait for 5: // each objec
阅读全文
摘要:1. System.Environment and System.Console 1: public class Program 2: { 3: private static void Main() 4: { 5: Console.ForegroundColor = ConsoleColor.DarkGreen; 6: 7: string[] aArgs = Environment.GetCommandLineArgs(); 8: foreach (string aArg in aArgs) 9: { 10: Console.WriteLine("Command Line Args
阅读全文
摘要:了解历史,才能预知未来! 下图列出了c#的发展史
阅读全文
摘要:看了这本《C# in Depth》的第一部分,觉得作者Jon Skeet对c#中的一些概念打的比方非常有意思,而且让人一下子就明白。关于其中个人认为比较出彩的地方,记录如下:1. delegate 通常大家提到delegate,往往就会提到C中的函数指针。诚然,两者确实有相似的地方,都是通过某种方式来间接调用方法。但是毕竟C#中的delegate不同于C中函数指针,而且单单提到函数指针也很难确切表达delegate的用处所在。还是来看看Jon是怎么来讲述delegate是个什么东东吧。 Jon说我们可以把这个delegate看做是一个人的遗嘱,里面列出了这个财产该怎么分配,是给情人还是老婆等等
阅读全文
摘要:Different from GridView, ListView can’t have the paging function automatically if you set the attribute “AutoPaging=true”, and this is where the DataPager comes into play. We can get the paging function for ListView easily with the help of the DataPager. We only need to put the control DataPager in
阅读全文
摘要:DATABASE ACCESS WITHOUT ADO.NETYour options for database access without ADO.NET include the following:• The SqlDataSource control: The SqlDataSource control allows you to define queries declaratively. You canconnect the SqlDataSource to rich controls such as the GridView, and give your pages the abi
阅读全文
摘要:To run an ASP.NET web form, the ASP.NET engine reads the entire .aspx file, generates the corresponding objects, and fires a series of events. You react to these events using thoroughly object-oriented code. Page Processing Web applications execute on the server: Web applications are stateless: In o
阅读全文
摘要:Usually, to hide a control or a block in HTML, we can use the following JavaScript to set the style of the control or the block, document.getElementById(“”).style.display=”none”; or apply the following css, .some-css-name { display:none } But it will remove the space occupied by the control as well.
阅读全文
摘要:Websites and Web ProjectsSomewhat confusingly, Visual Studio offers two ways to create an ASP.NET-powered web application:• Project-based development: When you create a web project, Visual Studio generates a .csproj project file (assuming you’re coding in C#) that records the files in your project a
阅读全文
摘要:Differences between ASP.NET and earlier web development platforms: • ASP.NET features a completely object-oriented programming model, which includes an eventdriven, control-based architecture that encourages code encapsulation and code reuse.• ASP.NET gives you the ability to code in any supported .
阅读全文
摘要:如果Server端处理Client端的响应需要的时间太长,这时候给用户显示另一个界面来告知用户示服务器正在处理,请用户稍等,这样显然更友好一些!解决这个需求貌似有个现成的解决方案, ASP.NET AJAX有个控件叫UpdateProgress, 用法可以参见这里。但是这个UpdateProgress有个缺点,就是它会自动对它所关联的UpdatePanel里面的所有控件(Button),也是就是它的粒度是UpdatePanel级别的,而不是具体某个控件级别的。当然,可以把要关联的控件单独放在一个UpdatePanel里面,但是这显然很不灵活。而且,UpdateProgress不会把当前的界面隐
阅读全文
摘要:Abstract: 通过一个简单的 web application, 学习以下内容: (1) ListView control (2) User control (3) Handle ViewState in User control (4) FindControl() usage, especially when there is a Master page. 本文主要讲述第3部分,如何在User Control 里面处理ViewState 上一篇中提到用User Control PassRateProgressBar 来显示每个学生的及格率。表面上看,一切都好。但是当页面Postback的
阅读全文
摘要:Source: http://msdn.microsoft.com/en-us/library/ms972976.aspxViewState本质: The view state of a page is, by default, placed in a hidden form field named __VIEWSTATE. This hidden form field can easily get very large, on the order of tens of kilobytes. Not only does the __VIEWSTATE form field cause slow
阅读全文
摘要:HTTP是无状态的协议,在Web Server 响应页面请求之后,客户端和Web Server会断开,Web Server为该请求创建的页面对象会被销毁掉。这样可以保证Server可以最大化同时响应客户请求能力,同时也减少了对Server端内存开销的压力。但是这样缺点也是显而易见的,需要用另外方法来记住页面当前的相关状态,以便Server端作相应的处理。ASP.NET提供了以下几种方式来进行状态管理:(1) ViewState(2) QueryString(3) Customer Cookies(4) Session State(5) Application State(6) Profile.
阅读全文
摘要:Abstract: 通过一个简单的 web application, 学习以下内容: (1) ListView control (2) User control (3) Handle ViewState in User control (4) FindControl() usage, especially when there is a Master page. 本文主要讲述第二部分,即User Control的用法 需求背景: 如果想把列Pass Rate由现在的单纯的数字表示转换成进度条显示,该怎么办? ====> 这个进度条可以通过创建一个Web User Control来实现。
阅读全文
摘要:Abstract: IL directives: ld<xxx>: load xxx onto stack st<xxx>: pop off stack into xxx (1) ldarg.<length> - load argument onto the stack Format Assembly Format Description FE 09 ...
阅读全文
摘要:Abstract: 通过查看IL来了解下声明在using语句中的对象是在try语句外面实例化还是在try里面实例化。 举例来说,下面的c# code 1: using(FileStream aFs = new FileStream(@"c:\test.txt", FileMode.Open)) 2: { 3: // Do noting... 4: }是对应下面的那种情况呢?(1) 1: File...
阅读全文
摘要:Abstract: 通过一个简单的 web application, 学习以下内容:(1) ListView control(2) User control(3) Handle ViewState in User control(4) FindControl() usage, especially when there is a Master page. 本文主要讲述第一部分,即如何使用ListView控件。虽然GridView功能非常强大,但是有时候用GridView却不是非常方便。比如说要实现下面这个页面, 、数据结构是分层次,第一层次是student的基本信息,第二层是该student的
阅读全文
摘要:最近工作中需要把XML文件按照一定的格式转成PDF文件,需要写一些XSL文件把对应的XML文件中的数据按照相应的格式成PDF文件,因此了解了下XSL的基本用法。 把XML转换成PDF用到的是FOP工具包,主要用法如下: 1: private const string COMMAND_LINE = "Tools\\jre\\bin\\java"; 2: private const string COMMAND_LINE_ARGUMENTS = "-cp Tools\\fop\\lib\\fop.jar;Tools\\fop\\lib\\xml-apis-1.3.02
阅读全文
1

浙公网安备 33010602011771号