随笔分类 - .NET基础
摘要:MSDN:It is an error to use both new and override on the same member because the two modifiers have mutually exclusive meanings.The new modifiers creates a new member with the same name and causes the original menber to become hidden.The override modifier extends the implementation for an inherited m
阅读全文
摘要:function DisplayIcons(page_index) { var page_size; page_size = 250; $.ajax({ type: 'POST', url: "/Normal/Service.aspx?Module=IconsReader&Action=GetResult", data: { "pageIndex": page_index, "pageSize": page_size }, dataType: "json", success: functio
阅读全文
摘要:1,从System.String[]转到List<System.String>System.String[] str={"str","string","abc"};List<System.String> listS=new List<System.String>(str);2, 从List<System.String>转到System.String[]List<System.String> listS=new List<System.String>();listS
阅读全文
摘要:在C#中可以对整型运算对象按位进行逻辑运算。按位进行逻辑运算的意义是:依次取被运算对象的每个位,进行逻辑运算,每个位的逻辑运算结果是结果值的每个位。C#支持的位逻辑运算如表:运算符号 意义 运算对象类型 运算结果类型 对象数 实例 ~ 位逻辑非运算 1 ~a & 位逻辑与运算 2 a&b I 位逻辑或运算 2 a|b ^ 位逻辑异或运算 整型,字符型 整型 2 a^b << 位左移运算 2 a<<4 >> ...
阅读全文
摘要:一,运行项目。这里以website为例。这个时候任务栏会出现asp.net development server的小图标。二,调试-》附加进程,找到WebDev的进程选中WebDev后,点附加三,刷新一下正在测试的网页。准备测试了!四,点击之前设有断点的页面,VS就进入调试阶段了!看到了这个中间有一个黄色箭头的红色圆点(代表调试了,呵呵)五,按一下F10(逐语句)(F11逐过程)这个时候,用鼠标选种黄色背景的语句上任何一个变量再把鼠标的焦点移到fieldValue的中间。提示就出来了。就可以看到每个变量的当前值了.六,查看方式:(1)鼠标焦点查看(2)快速监视:选中变量,右键鼠标,就可以看到(
阅读全文
摘要:类的访问修饰符(非内部类)private:不可用protected:不可用protected internal:不可用internal:限定与本Assembly内public:无限制默认:=internal类成员的访问修饰符private:限定于本类protected:限定于派生类protected internal:限定与派生类及本集合内。如果派生类在另一集合内,也可以访问;internal:限定于本Assembly。即使在某段程序内,实类被拓展外public,在集合外,类实体内的该变量也是不可访问的。public:无限制默认:=private接口的访问修饰符private:不可用prote
阅读全文
摘要:前言 .NET 2.0中泛型的出现是一个令人激动的特征。但是,什么是泛型?你需要他们吗?你会在自己的应用软件中使用他们?在本文中,我们将回答这些问题并细致的分析泛型的使用,能力及其局限性。类型安全 .NET中的许多语言如c#,c++和VB.NET(选项strict为on)都是强类型语言。作为一个程序员,当你使用这些语言时,总会期望编译器进行类型安全的检查。例如,如果你把对一个Book类型的引用转换成一个Vehicle型的引用,编译器将告诉你这样的cast是无效的。转自:http://dev.yesky.com/msdn/352/2071852.shtml
阅读全文
摘要:首先堆栈和堆(托管堆)都在进程的虚拟内存中。(在32位处理器上每个进程的虚拟内存为4GB)堆栈stack堆栈中存储值类型;堆栈实际上是向下填充,即由高内存地址指向低内存地址填充。堆栈的工作方式是先分配的内存变量后释放(先进后出原则)。堆栈中的变量是从下向上释放,这样就保证了堆栈中先进后出的规则不与变量的生命周期起冲突。堆栈的性能非常高,但是对于所有的变量来说还不是太灵活,而且变量的生命周期必须嵌套。通常我们希望使用一种方法分配内存来存储数据,并且方法退出后很长一段时间内数据仍然可以使用。此时就要用到堆(托管堆)!堆(托管堆)heap堆(托管堆)存储引用类型。此堆非彼堆,.NET中的堆由垃圾收集
阅读全文
摘要:当然了,string本质上肯定是引用类型,但是这个特殊的类却表现出值类型的特点:判断相等性时,是按照内容来判断的,而不是地址。它肯定是一个引用类型没错。两个方面来看:1,class string继承自object,而不是System.ValueType(Int32这样的则继承于System.ValueType)2,string本质上是个char[],而Array是引用类型,并且初始化时也是在托管堆分配内存的。微软设计这个类的时候估计是为了方便操作,所以重写了操作符和Equals方法,不然的话我们判断string相等得这样:foreach(char c in s.ToCharArray()){.
阅读全文
摘要:C#可以直接对内存进行操作。但是默认情况下,为了保持类型安全,C#不支持指针运算。不过,通过使用 unsafe 关键字,可以定义可使用指针的不安全上下文。在不安全的上下文中,类型可以是指针类型以及值类型或引用类型。指针类型声明具有下列形式之一:unmanaged type* identifier;void* identifier;参数说明:unmanaged type:sbyte、byte、short、ushort、int、uint、long、ulong、char、float、double、decimal 或 bool。任何枚举类型。任何指针类型。仅包含非托管类型的字段的任何用户定义的结构类型
阅读全文
摘要:1.web.config里加<authentication mode="Forms"> <forms name=".ASPXAUTH" loginUrl="Login.aspx" defaultUrl="default.aspx" protection="All" timeout="30" path="/"> </forms></authentication><authorization> <
阅读全文
摘要:先把Winista.HtmlParser.dll放到bin文件夹下面。using System;using System.Collections.Generic;using System.Text;using Winista.Text.HtmlParser.Visitors;using Winista.Text.HtmlParser;using Winista.Text.HtmlParser.Util;//包含ParserExceptionusing Winista.Text.HtmlParser.Filters;using System.Net;using Winista.Text.Html
阅读全文
摘要:Response.Write("<script language=\"javascript\">alert('请检查您的输入!')</script>");
阅读全文
摘要:#region "根据文件扩展名获取当前目录下的文件列表" /// <summary> /// 根据文件扩展名获取当前目录下的文件列表 /// </summary> /// <param name="FileExt">文件扩展名</param> /// <returns>返回文件列表</returns> public static List<string> GetDirFileList(string FileExt) { List<string> FilesL
阅读全文
摘要:<%-- Name:Author: Description: --%><%@ CodeTemplate Language="C#" TargetLanguage="C#" ResponseEncoding="UTF-8" Src="" Inherits="" Debug="False" Description="Template description here." %><%@ Property Name="Tabl
阅读全文
摘要:<%-- Name:Author: Description: --%><%@ CodeTemplate Language="C#" TargetLanguage="C#" ResponseEncoding="UTF-8" Src="" Inherits="" Debug="False" Description="Template description here." %><%@ Property Name="Tabl
阅读全文
摘要:test.cst<%@ CodeTemplate Language="C#" TargetLanguage="Text" Src="" Inherits="" Debug="False" CompilerVersion="v3.5"Description="Template description here." %><%@ Assembly Name="SchemaExplorer" %><%@ Impor
阅读全文
摘要:以下是全部代码:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;using System.Threading;using System.Runtime.InteropServices;namespace ConsoleApplication1{ public static class CodeTimer { public static void Initialize() { Process.GetCurrentProcess().
阅读全文
摘要:依赖注入(Dependency Injection)当我们把依赖对象交给外部容器负责创建时,那么PersonServiceBean类可以改成如下:public class PersonServiceBean{ private PersonDao personDao; //通过构造器参数,让容器把创造好的依赖对象注入进PersonServiceBean,当然也可以用setter方法进行注入。 public PersonSericeBean(PersonDao personDao){ this.personDao=personDao; } public void save(Pers...
阅读全文
摘要:在asp.net中,有的时候要动态变换CSS,比如有的时候做个性化页面,可以这样做<head> <link id="MyStyleSheet" rel="stylesheet" type="text/css" runat="server" /></head>之后,在要更换CSS的页面中,使用如下代码Sub Page_Load(Sender As Object, E As EventArgs) If Not (IsPostBack) MyStyleSheet.Attributes.
阅读全文
浙公网安备 33010602011771号