如何在Winform应用程序中使用模板 [英] How to Use Template in Winform Application

查看:227
本文介绍了如何在Winform应用程序中使用模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个用于从csv文件导入的Helper类.
import方法具有一个DataHolder模板,用于实现通用的导入方式...

Hi All,

I have a Helper class which is used to import from a csv file.
The import method has a DataHolder template used to implement generic way of importing...

public static CsvImportState ImportFromCsv<TDataHolder>(StreamReader streamReader, out ICsvFile<TDataHolder> csvFile) where TDataHolder : DataHolderBase
       {




我试图保留一个UI来使用此导入帮助器类

我的UI将由具有不同Dataholder类的不同客户端使用..

例如,在我的导入按钮中,单击我需要传递out参数




I was trying to keep a UI to use this import helper class

My UI will be used by different clients with different Dataholder classes..

For example in my Import button click i need to pass the out parameter

ICsvFile<TDataHolder> csvFile


但是在UI中如何创建类似于ImportFile helper类中的TDataHolder的模板.

请帮帮我.

在此先感谢.


But in UI how shall i create a template which is similar to TDataHolder in ImportFile helper class.

Please help me.

Thanks in Advance.

推荐答案

为什么要创建其他类型?我会尝试对发件人和使用者使用完全相同的TDataHolder类型.

在您的情况下可行吗?
Why create another type? I would try to use the exact same TDataHolder type for sender and consumer.

Would that be possible in your situation?


这篇关于如何在Winform应用程序中使用模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆