
## 1、类库的概念
- 类库:微软官方解释-类库是.NET的共享库概念。
- 作用:通过类库可将实用功能组件化为可供多个应用程序使用的模块。
## 2、类库实战
- 2.1 Visual Studio新建一个类库项目并封装一个方法
```C#
namespace ys
{
public static class HelloWorld
{
public static bool StartsWithUpper(this string? str)
{
if (string.IsNullOrWhiteSpace(str))
return false;
char ch = str[0];
return char.IsUpper(ch);
}
}
}
```
- 2.2 Visual Studio新建一个程序项目调用封装的类库
```C#
string? input="";
int row = 0;
do
{
if (row == 0 || row <= 25)
input = Console.ReadLine();
if (string.IsNul