删除无用项目

This commit is contained in:
sanchime 2023-04-05 10:55:52 +08:00
parent 118cb35ebd
commit 05d4c6ff06
4 changed files with 0 additions and 111 deletions

View File

@ -1,70 +0,0 @@
using Sanchime.Functional.Products;
using Sanchime.Functional.Extensions;
using Sanchime.Toolkits;
// try
// {
// void foo(Option<int> option)
// {
// var res = option.Map(x => x + 2);
// res.WriteLine();
// }
//
// "预计打印Some(12)".WriteLine();
// foo(10);
// "预计打印None".WriteLine();
// foo(Optional.None);
//
// "预计打印None".WriteLine();
// Optional.Some(Optional.None).WriteLine();
//
// "预计打印Some(String)".WriteLine();
// Optional.Some(1)
// .Map(x => x + 1.2)
// .Map(x => x.ToString())
// .Map(x => x.GetType().Name)
// .WriteLine();
//
// // 测试Option的Bind
// var parse = (string s) => Int32.TryParse(s, out int i) ? Optional.Some(i) : Optional.None;
// var foo1 = (string s) => s.Pipe(parse).Bind(Age.Of);
// "预计打印Some(111)".WriteLine();
// foo1("111").WriteLine();
// "预计打印None".WriteLine();
// foo1("aaa").WriteLine();
// "预计打印Some(123)".WriteLine();
// foo1("123").WriteLine();
// // 管道
// "预计打印None".WriteLine();
// foo1("1ab").Pipe(x => x.WriteLine());
// }
// catch (Exception ex)
// {
// ex.Message.WriteLine();
// ex.StackTrace.WriteLine();
// }
//
// public struct Age
// {
// private int _value;
//
// public static Option<Age> Of(int age)
// => IsValid(age) ? Optional.Some(new Age(age)) : Optional.None;
//
// private Age(int age)
// {
// if (!IsValid(age))
// {
// throw new ArgumentException("输入的年龄是无效的");
// }
// _value = age;
// }
//
// private static bool IsValid(int age)
// => age is (>= 0 and <= 150);
//
// public override string ToString()
// => _value.ToString();
// }

View File

@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Sanchime.Functional\Sanchime.Functional.csproj" />
<ProjectReference Include="..\Sanchime.Toolkits\Sanchime.Toolkits.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -1,17 +0,0 @@
using System.Diagnostics;
namespace Sanchime.Toolkits;
public static class Basic
{
public static void WriteLine<T>(this T @this)
{
Console.WriteLine(@this);
}
public static void WriteLine<T>(this T @this, Func<T, T> func)
=> func(@this).WriteLine();
public static bool IsNullOrEmpty<T>(this string @this)
=> string.IsNullOrEmpty(@this);
}

View File

@ -1,9 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>