src/Datory/Utils/Utilities.cs
(开头部分) 16KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
[assembly: InternalsVisibleTo("Datory.Tests")]
namespace Datory.Utils
{
public static class Utilities
{
public static List<int> GetIntList(string collection, char separator = ',')
{
var list = new List<int>();
if (!string.IsNullOrEmpty(collection))
{
var array = collection.Split(separator);
foreach (var s in array)
{
int.TryParse(s.Trim(), out var i);
list.Add(i);
}
}
return list;
}
public static List<int> GetIntList(IEnumerable<int> collection)
{
return collection == null ? new List<int>() : new List<int>(collection);
}
public static List<int> GetIntList(JArray jArray)
{
try
{
return jArray == null ? new List<int>() : jArray.ToObject<List<int>>();
}
catch
{
return new List<int>();
}
}
public static string ToString(List<string> objects, string separator = ",")
{
return objects != null && objects.Count > 0 ? string.Join(separator, objects) : string.Empty;
}
public static string ToString(List<int> objects, string separator = ",")
{
return objects != null && objects.Count > 0 ? string.Join(separator, objects) : string.Empty;
}
public static string ToString(List<object> objects, string separator = ",")
后面还有 432 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
