Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Demo.CSharpScript 脚本帮助片段
using System.Collections.Generic;
namespace Demo.CSharpScript.Models
{
/// <summary>
/// 测试实体
/// </summary>
public class DemoModel
{
public int ID { get; set; }
public int Age { get; set; }
public string Name { get; set; }
public string Desc { get; set; }
/// <summary>
/// 测试数据
/// </summary>
/// <returns></returns>
public static List<DemoModel> GetDemoDatas()
{
var list = new List<DemoModel>();
for (int i = 0; i < 100; i++)
{
list.Add(new DemoModel { ID = i, Age = i, Name = $"7tiny_{i}", Desc = $"第{i}条测试数据" });
}
return list;
}
}
}
using System;
using System.Linq;
using System.Collections.Generic;
using Demo.CSharpScript.Models;
namespace Demo.CSharpScript
{
public class Program
{
public static void Main()
{
// CODE CHANGES
var before = Before("");
var after = After(DemoModel.GetDemoDatas());
Console.WriteLine($"after count = {after.Count}");
}
//Before脚本
public static string Before(string name)
{
//这里写脚本内容
return name;
}
//After脚本
public static List<DemoModel> After(List<DemoModel> models)
{
//这里写脚本内容
return models;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.