欢迎光临极品网,更多、更新的资源信息尽在Jpinw.Com!本站所有信息资源每日更新新的内容,请大家继续关注www.Jpinw.com!如果觉得本站还不错,对您有帮助,别忘了向您的朋友推荐本站!请记好本站网址:http://www.Jpinw.com,网站发展靠大家多多的支持!!!

极品网 极品课件 极品论文 极品文学 极品游戏 极品美容 极品手机资源 极品股票

#
免费资源: 免费域名 | 免费空间 | 免费推广 | 免费邮箱 | 免费硬盘 | 免费论坛 | 免费留言 | 免费统计 | 在线投稿 | 更多...
电脑学院: 操作系统 | 安全相关 | 网页设计 | 编程开发 | 建站经验 | 服务器类 | 黑客攻防 | 菜鸟入门 | 教你网赚 | 更多...
文章导航: 网赚学堂 | 网赚秘笈 | 网赚三维 | 网赚先锋 | 网赚资讯 | 感悟网赚 | 众生百态 | 经典美文 | 范文中心 | 更多...
图酷天下: 时事图酷 | 娱乐图酷 | 搞笑图酷 | 时尚图酷 | 体育图酷 | 另类经典 | 论文资源 | 课件下载 | 文学知识 | 更多...

您现在的位置: 极品网 >> 电脑学院 >> 编程开发 >> 编程综合 >> 教程正文

asp.net优化(二)            【字体:
asp.net优化(二)
作者:佚名    教程来源:不详    点击数:    更新时间:2008-1-1    

 








asp.net优化(二)。

    1. Do not rely on exceptions in your code: Exceptions are very expensive and should rarely occur in your code. You should never use exceptions as a way to control normal program flow. If it is possible to detect in code a condition that would cause an exception, you should do that instead of waiting to catch the exception before handling that condition. Common scenarios include checking for null, assigning to a string that will be parsed into a numeric value, or checking for specific values before applying math operations. For example:

    1. // Consider changing this:try {   result = 100 / num;}catch (Exception e) {  result = 0;}// To this:if (num != 0)   result = 100 / num;else  result = 0;
    ' Consider changing this:Try   result = 100 / numCatch (e As Exception)  result = 0End Try// To this:If Not (num = 0)   result = 100 / numElse  result = 0End If
    // Consider changing this:try {   result = 100 / num;}catch (e:Exception) {  result = 0;}// To this:if (num != 0)   result = 100 / num;else  result = 0;
    C# VB JScript
    1. Use early binding in Visual Basic or JScript code: One of the advantages of Visual Basic, VBScript, and JScript is their typeless nature. Variables can be created simply by using them and need no explicit type declaration. When assigning from one type to another, conversions are performed automatically, as well. This can be both an advantage and a disadvantage, since late binding is a very expensive convenience in terms of performance.
    2. The Visual Basic language now supports type-safe programming through the use of a special Option Strict compiler directive. For backward compatibility, ASP.NET does not enable Option Strict by default. However, for optimal perfomance, you should enable Option Strict for your pages by using a Strict attribute on the page or Control directive:
    3. <%@ Page Language="VB" Strict="true" %><%Dim BDim C As String' This causes a compiler error:A = "Hello"' This causes a compiler error:B = "World"' This does not:C = "!!!!!!"' But this does:C = 0%>
    4. JScript also supports typeless programming, though it offers no compiler directive to force early binding. A variable is late-bound if:
    5. It is declared explicitly as an object.
    • It is a field of a class with no type declaration.
    • It is a private function/method member with no explicit type declaration and the type cannot be inferred from its use.
    1. The last distinction is complicated. The JScript compiler optimizes if it can figure out the type, based on how a variable is used. In the following example, the variable A is early-bound but the variable B is late-bound:
    2. var A;var B;A = "Hello";B = "World";B = 0;
    3. For the best performance, declare your JScript variables as having a type. For example, "var A : String".
    4. Port call-intensive COM components to managed code: The .NET Framework provides a remarkably easy way to interoperate with traditional COM components. The benefit is that you can take advantage of the new platform while preserving your existing code. However, there are some circumstances in which the performance cost of keeping your old components is greater than the cost to migrate your components to managed code. Every situation is unique, and the best way to decide what needs to be changed is to measure site performance. In general, however, the performance impact of COM interoperability is proportional to the number of function calls made or the amount of data marshaled from

      [1] [2] 下一篇

     

    教程录入:admin    责任编辑:admin 
  • 上一篇教程:

  • 下一篇教程:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关教程
    [我的ASP.net学习历程]有关于
    《Asp.Net Forums2.0深入分析
    ASP.NET 2.0页面性能的考虑
    ASP.NET 2.0打造购物车和支付
    关于ASP.Net中的时间处理
    基于asp.net的web页面动态控
    ASP.NET ViewState 初探 (3)
    ASP.NET/Perl.NET 数据库访问
    ASP.NET: Connection String
    ASP.NET: HtmlEncode/UrlEnc
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    极品网
    | 设为首页 | 加入收藏 | 友情链接 | 版权声明 |
    极品网

    Copyright 2006 Jpinw.com 极品网

    备案号:浙ICP备07010375号

    极品网