You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
9.7 KiB
JavaScript

1 year ago
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[6828],{5972:(n,e,s)=>{s.r(e),s.d(e,{assets:()=>c,contentTitle:()=>t,default:()=>u,frontMatter:()=>r,metadata:()=>a,toc:()=>d});var o=s(5893),i=s(1151),l=s(4996);const r={slug:"global-usings",title:"7. GlobalUsings \u7684\u4f7f\u7528",author:"dotNET China",author_title:"\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002",author_url:"https://gitee.com/dotnetchina",author_image_url:"https://i.loli.net/2021/01/19/M8q5a3OTZWUKicl.png",tags:["furion","furos",".net",".netcore",".net5",".net6"]},t=void 0,a={permalink:"/blog/global-usings",editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/blog/2022-05-31-global-usings.mdx",source:"@site/blog/2022-05-31-global-usings.mdx",title:"7. GlobalUsings \u7684\u4f7f\u7528",description:"\u7b80\u4ecb",date:"2022-05-31T00:00:00.000Z",formattedDate:"May 31, 2022",tags:[{label:"furion",permalink:"/blog/tags/furion"},{label:"furos",permalink:"/blog/tags/furos"},{label:".net",permalink:"/blog/tags/net"},{label:".netcore",permalink:"/blog/tags/netcore"},{label:".net5",permalink:"/blog/tags/net-5"},{label:".net6",permalink:"/blog/tags/net-6"}],readingTime:2.715,hasTruncateMarker:!1,authors:[{name:"dotNET China",title:"\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002",url:"https://gitee.com/dotnetchina",imageURL:"https://i.loli.net/2021/01/19/M8q5a3OTZWUKicl.png"}],frontMatter:{slug:"global-usings",title:"7. GlobalUsings \u7684\u4f7f\u7528",author:"dotNET China",author_title:"\u8ba9 .NET \u5f00\u53d1\u66f4\u7b80\u5355\uff0c\u66f4\u901a\u7528\uff0c\u66f4\u6d41\u884c\u3002",author_url:"https://gitee.com/dotnetchina",author_image_url:"https://i.loli.net/2021/01/19/M8q5a3OTZWUKicl.png",tags:["furion","furos",".net",".netcore",".net5",".net6"]},unlisted:!1,nextItem:{title:"6. .NET 6 Preview 7 \u5c1d\u9c9c",permalink:"/blog/net6-preview7"}},c={authorsImageUrls:[void 0]},d=[{value:"\u7b80\u4ecb",id:"\u7b80\u4ecb",level:3},{value:"\u5fc5\u8981\u914d\u7f6e",id:"\u5fc5\u8981\u914d\u7f6e",level:3},{value:"\u57fa\u672c\u4f7f\u7528",id:"\u57fa\u672c\u4f7f\u7528",level:3},{value:"\u9ed8\u8ba4\u5168\u5c40 <code>using</code>",id:"\u9ed8\u8ba4\u5168\u5c40-using",level:3}];function g(n){const e={admonition:"admonition",code:"code",h3:"h3",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",...(0,i.a)(),...n.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(e.h3,{id:"\u7b80\u4ecb",children:"\u7b80\u4ecb"}),"\n",(0,o.jsxs)(e.p,{children:["\u5728 ",(0,o.jsx)(e.code,{children:".NET6/C#10"})," \u4e4b\u540e\uff0c\u5fae\u8f6f\u65b0\u589e\u4e86 ",(0,o.jsx)(e.code,{children:"GlobalUsings"})," \u673a\u5236\uff0c\u53ef\u4ee5\u5728\u9879\u76ee\u7684\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a ",(0,o.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6587\u4ef6\uff0c\u628a\u5e38\u7528\u7684 ",(0,o.jsx)(e.code,{children:"using"})," \u653e\u7f6e\u5176\u4e2d\u3002"]}),"\n",(0,o.jsxs)(e.p,{children:["\u8fd9\u6837 ",(0,o.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6240\u5728\u7684\u9879\u76ee ",(0,o.jsx)(e.code,{children:".cs"})," \u6587\u4ef6\u5c31\u65e0\u9700\u91cd\u590d ",(0,o.jsx)(e.code,{children:"using"})," \u4e86\uff0c\u5927\u5927\u7684\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u4e5f\u8ba9\u4ee3\u7801\u53d8\u7684\u66f4\u52a0\u7b80\u6d01\u3002"]}),"\n",(0,o.jsx)(e.h3,{id:"\u5fc5\u8981\u914d\u7f6e",children:"\u5fc5\u8981\u914d\u7f6e"}),"\n",(0,o.jsx)(e.p,{children:(0,o.jsxs)(e.strong,{children:["\u542f\u7528 ",(0,o.jsx)(e.code,{children:"GlobalUsings"})," \u673a\u5236\u9700\u8981\u4ee5\u4e0b\u4e24\u4e2a\u6b65\u9aa4\uff1a"]})}),"\n",(0,o.jsxs)(e.ol,{children:["\n",(0,o.jsxs)(e.li,{children:["\u5728\u4f60\u9700\u8981\u5168\u5c40 ",(0,o.jsx)(e.code,{children:"using"})," \u7684\u9879\u76ee\u5c42\u6839\u76ee\u5f55\u521b\u5efa ",(0,o.jsx)(e.code,{children:"GlobalUsings.cs"})," \u6587\u4ef6\uff0c\u5982\u679c\u591a\u4e2a\u9879\u76ee\u5c42\u9700\u8981\uff0c\u5219\u6bcf\u4e2a\u5c42\u90fd\u5e94\u8be5\u6709\u4e00\u4e2a ",(0,o.jsx)(e.code,{children:"Global