@Aiti
2019-07-18T05:45:35.000000Z
字数 1576
阅读 240
学习笔记、持续更新
学习网址:https://docs.microsoft.com/zh-cn/dotnet/
using System.Linq;
using System.Text;
using System;
namespace CustomExtensions
{
public static class StringExtension
{
public static int WordCount(this String str)
{
return str.Split(new char[] {' ', '.','?'}, StringSplitOptions.RemoveEmptyEntries).Length;
}
}
}
----------
namespace Extension_Methods_Simple
{
// Import the extension method namespace.
using CustomExtensions;
class Program
{
static void Main(string[] args)
{
string s = "The quick brown fox jumped over the lazy dog.";
// Call the method as if it were an
// instance method on the type. Note that the first
// parameter is not specified by the calling code.
int i = s.WordCount();
System.Console.WriteLine("Word count of s is {0}", i);
}
}
}
在以下情况,对服务器应用程序使用 .NET Core:
.NET Core 是开放源代码通用开发平台,由 Microsoft 和 .NET 社区在 GitHub 上共同维护。 它跨平台(支持 Windows、macOS 和 Linux),并且可用于生成设备、云和 IoT 应用程序。
在以下情况,对服务器应用程序使用 .NET Framework :
.NET Framework 是用于为 Web、Windows、Windows Phone、Windows Server 和 Microsoft Azure 构建应用的开发平台。 它包含公共语言运行时 (CLR) 和 .NET Framework 类库,其中包括各种功能和对许多行业标准的支持。