1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
| using System;
| using System.Collections.Generic;
| using System.Linq;
| using System.Reflection;
| using System.Text;
| using System.Threading.Tasks;
|
| namespace IStation
| {
| public class DataDockingSocketFactory
| {
|
| /// <summary>
| /// 创建Socket
| /// </summary>
| public static I CreateSocket<I>(string dllName)
| {
| var type = typeof(I);
| var className = string.Format("{0}.{1}", "IStation.DataDockingSocket", type.Name.Remove(0, 1));
| var obj = Assembly.Load(dllName).CreateInstance(className);
| return (I)obj;
| }
|
| }
| }
|
|