Skip to content

Instantly share code, notes, and snippets.

@sevenTiny
Last active January 16, 2019 05:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sevenTiny/98b8b484dd9d0fbf8bd1bac0425db914 to your computer and use it in GitHub Desktop.
Save sevenTiny/98b8b484dd9d0fbf8bd1bac0425db914 to your computer and use it in GitHub Desktop.
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