我放弃了,这个帖子编辑吃了我帖子的各个部分! ! !当属性是泛型类型时,如何设置使用反射创建的对象的属性。 [英] I give up, this post editor eats various parts of my post! ! ! How to set the property of an object created with reflection when the property is a generic type.

查看:63
本文介绍了我放弃了,这个帖子编辑吃了我帖子的各个部分! ! !当属性是泛型类型时,如何设置使用反射创建的对象的属性。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从xml文件中读取Office OpenXml样式并将它们添加到文档中。样式是标签,每个属性代表样式的属性。从标签的Name(字符串)创建样式很简单,但是当我尝试将样式的Type属性设置为StyleValues.Table(从xml的Type属性读取为字符串)时,我收到错误。 Type属性的类型是DocumentFormat.OpenXml.EnumValue

I am reading Office OpenXml styles from an xml file and adding them to a document. The styles are the tags and each attribute represents a property of the style. Creating the style from the Name (string) of the tag is easy, but when I try to set the "Type" property of the style to StyleValues.Table (read as a string from the Type attribute of the xml), I get errors. The Type of the "Type" property is DocumentFormat.OpenXml.EnumValue

推荐答案

最简单的方法是将代码粘贴到:当你这样做时弹出一个弹出窗口出现给你如何粘贴它的选项。通常,这些包含:

The simplest way is to just paste your code in: when you do that a pop-up appears giving you options for how to paste it. Generally, these contain:
Paste as-is
Encode HTML
Code Block
Quoted Text
Best Guess



当你将鼠标悬停在选项上时,它会插入什么内容的小预览。

如果我粘贴一些C#


And a small preview of what it will insert as you hover the mouse over the options.
If I paste in some C#

List<string> myList = new List<string>();
if (a == b)
   c();



编码HTML和代码块可能是开头的:

编码HTML:


"Encode HTML" and "Code Block" are probably the ones to start with:
Encode HTML:

List&lt;string&gt; myList = new List&lt;string&gt;();
if (a == b)
   c();

显示为:

List< string> myList = new List< string>();

if(a == b)

c();

代码块:

Which displays as:
List<string> myList = new List<string>();
if (a == b)
c();
Code Block:

List<string> myList = new List<string>();
if (a == b)
   c();



您还可以粘贴代码并使用文本框上方的代码小部件添加所需的格式。


You can also paste code and use the code widget above the text box to add the formatting you want.


这篇关于我放弃了,这个帖子编辑吃了我帖子的各个部分! ! !当属性是泛型类型时,如何设置使用反射创建的对象的属性。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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