惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V2EX - 技术
V2EX - 技术
L
LangChain Blog
IT之家
IT之家
S
SegmentFault 最新的问题
博客园 - 三生石上(FineUI控件)
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
The Blog of Author Tim Ferriss
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
U
Unit 42
B
Blog RSS Feed
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
T
Threatpost
C
CERT Recently Published Vulnerability Notes
Cisco Talos Blog
Cisco Talos Blog
The Register - Security
The Register - Security
Vercel News
Vercel News
S
Schneier on Security
Spread Privacy
Spread Privacy
C
Cyber Attacks, Cyber Crime and Cyber Security
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
博客园 - 叶小钗
雷峰网
雷峰网
博客园_首页
人人都是产品经理
人人都是产品经理
P
Palo Alto Networks Blog
The Hacker News
The Hacker News
T
Tor Project blog
L
Lohrmann on Cybersecurity
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
Cybersecurity and Infrastructure Security Agency CISA
P
Privacy International News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tenable Blog
V
Vulnerabilities – Threatpost
大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
V
V2EX
Security Latest
Security Latest
A
About on SuperTechFans
Cloudbric
Cloudbric
S
Security Affairs
MongoDB | Blog
MongoDB | Blog
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
TaoSecurity Blog
TaoSecurity Blog

博客园 - vito qi

安装VS2015出现的bug,各位安装请注意 苹果编程语言Swift简介 设计模式之三职责链模式 HTML页面做中间页跳转传递参数 第一个 ASP.NET Web API应用程序 ASP.NET MVC中 Jquery AJAX 获取数据利用MVC模型绑定实现输出 ASP.NET应用程序与页面生命周期 自定义服务器控件ImageButton 成功项目经理的三种领导力行为 设计模式之二抽象工厂设计模式 深入理解C#之 参数传递 ref out params ASP.NET 实现文件下载 C#实现根据IP 查找真实地址 IIS 7.0的集成模式和经典模式 ASP.NET 4.0: 请求验证模式变化导致ValidateRequest=false失效 设计模式之—简单工厂设计模式 ASP.NET MVC 学习笔记(一) 数据库分离附加工具 c# 新特性
c#总结(一)
vito qi · 2011-10-19 · via 博客园 - vito qi

学习内容:配置.net运行环境,c#中命名空间,c#.net 2005编码规范

学习总结:

1.       配置.net运行环境

第一歩:安装.net framework

第二歩:找到.net framework的安装目录下的csc.exe文件,这个文件为.net framework的编译器

第三步:将csc.exe的安装目录放到系统环境变量中

第四歩:在运行里打cmd命令,掉出dos窗口,在命令提示符下键入csc,系统显示.netframe work的相关信息

第五歩:.net运行环境配置完成

第六歩:编写**.cs文件,放在只定的目录下

7歩:在dos窗口下键入**.cs文件所在的目录,然后键入csc **.cs,系统显示编译完成提示,另一种方法是不用进入**.cs所在的目录,在命令提示符下直接键入 csc /out 生成的.exe文件输出位置   **.cs所在的目录

2.       c#中的命名空间

使用命名空间的好处:

避免命名冲突的问题(在不同命名空间下的类名等可以相同)

代码可存在多个文件中

命名空间具有扩展性,可在同一命名空间下定义多个类

可以堆砌出层次式的类组织结构

使用using 命名空间的作用:避免使用完全限定名

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            A.B.Hello test=new A.B.Hello();

            test.GetInfo();

        }

    }

}

//命名空间的层次组织

namespace A

{

    namespace B

    {

       public class Hello

       {

           public void GetInfo()

           {

                Console.WriteLine("c#欢迎您!");

           }

       }

    }

}

using System;

using System.Collections.Generic;

using System.Text;

using A.B;//使用using语句避免了在调用时使用完全限定名

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            Hello test=new Hello();

            test.GetInfo();

        }

    }

}

//命名空间的层次组织

namespace A

{

    namespace B

    {

       public class Hello

       {

           public void GetInfo()

           {

                Console.WriteLine("c#欢迎您!");

           }

      }

    }

}

using System;

using System.Collections.Generic;

using System.Text;

using a=A.B;//使用别名

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            a.Hello test=new a.Hello();

            test.GetInfo();

        }

    }

}

//命名空间的层次组织

namespace A

{

    namespace B

    {

       public class Hello

       {

           public void GetInfo()

           {

                Console.WriteLine("c#欢迎您!");

           }

       }

    }

}

将代码分布在不同的文件中:

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1

{

    //定义程序的入口点,并调用Class1.cs文件

    class Program

    {

        static void Main(string[] args)

        {

            Class1 test = new Class1();

            test.GetInfo();

        }

    }

}

using System;

using System.Collections.Generic;

using System.Text;

namespace ConsoleApplication1

{

    //定义Class1,并在类中定义了一个GetInfo方法,Program.cs调用

    class Class1

    {

        public void GetInfo()

        {

            Console.WriteLine("c#欢迎您!");

        }

    }

}

.net framwork中同时编译两个文件的命令:csc Class1.cs Program.cs

另一种方法:将Class1.cs编译成.dll文件,供Program.cs调用

命令是:csc / target library Class1.cs Class1.cs编译成.dll文件,然后编译Program.cs的命令是:csc /reference:Class1.dll Program.cs

运行命令是:/reference:Class1.dll Program.exe

3.       c#.net 2005编码规范

注释规范

变量命名规范

常量命名规范

类命名规范

资源命名规范

接口,方法,名字空间命名规范