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

推荐订阅源

D
DataBreaches.Net
T
Threatpost
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
V2EX - 技术
V2EX - 技术
D
Docker
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
The GitHub Blog
The GitHub Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Y
Y Combinator Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
T
Troy Hunt's Blog
Webroot Blog
Webroot Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
量子位
Apple Machine Learning Research
Apple Machine Learning Research
H
Help Net Security
F
Full Disclosure
B
Blog
O
OpenAI News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园_首页
Google DeepMind News
Google DeepMind News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
Forbes - Security
Forbes - Security
Know Your Adversary
Know Your Adversary
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
Scott Helme
Scott Helme
T
The Exploit Database - CXSecurity.com
博客园 - 聂微东
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Last Watchdog
The Last Watchdog
Recorded Future
Recorded Future
IT之家
IT之家
Project Zero
Project Zero
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Attack and Defense Labs
Attack and Defense Labs
L
Lohrmann on Cybersecurity
SecWiki News
SecWiki News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com

博客园 - 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编码规范

注释规范

变量命名规范

常量命名规范

类命名规范

资源命名规范

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