【问题标题】:c# - underscore in fields namec# - 字段名称中的下划线
【发布时间】:2020-05-06 07:53:40
【问题描述】:

我有一个包含一些输入字段的脚本任务,例如“field_of_example”。脚本是这样的:

public override void Input0_ProcessInputRow(Input0Buffer Row)
{ 
Dictionary<string, string> body = new Dictionary<string, string>();
foreach (PropertyInfo inputColumn in Row.GetType().GetProperties())
            {
                if (!inputColumn.Name.EndsWith("IsNull") 
                {

                        body.Add(inputColumn.Name, inputColumn.GetValue(Row).ToString());

                }

问题是在 inputColumn.Name 中我有 'fieldofexample' 而不是 'field_of_example',有没有办法使用下划线获取输入名称?

【问题讨论】:

    标签: c# ssis propertyinfo


    【解决方案1】:

    您正在阅读 Input0Buffer 类的属性。尝试改用GetFields() 方法。

    【讨论】:

    • 您对此有什么建议吗?我试过: var temp= Row.GetType().GetFields();但它是空的
    猜你喜欢
    • 2023-04-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-06
    相关资源
    最近更新 更多