帮助使用枚举 [英] help working with enum
问题描述
大家好!
我有一张桌子A(姓名,IsDisplayed)
我有一个网格B,它从表格A中获取带有文本框和复选框的数据。用户可以更新复选框并保存到表A.
现在我的要求是想使用枚举来管理表A.
i计划创建枚举包含2个值(名称,isdisplay)。
但是我知道我无法在运行时显示更新值。
我该怎么办???
我想我会创建枚举包含id,name和xml文件包含id,isdiplayed。
当我更新isdiplayed复选框时,我将更新xml中的值。
是吗ok ???
Hi all !!!
I have a table A (Name,IsDisplayed)
I have a grid B, it gets data from table A with textbox and checkbox. User can update checkbox and save to table A.
Now my requirement wants to use enum to manage table A.
i plans create enum contains 2 values (name,isdisplayed).
But i know i can not update values isdisplayed at runtime.
How can i do ???
I think i will create enum contain id,name and xml file contain id,isdiplayed.
when i update isdiplayed checkbox, i will update value in xml.
Is it ok ???
推荐答案
如果你想管理一个表,那么最好使用DataTable
。
您可以使用Class
和属性
。
但是Enum
不是一个好选择。枚举
用于常数值。
As you want to manage a Table, so better to use aDataTable
.
You can useClass
andProperties
.
ButEnum
is not a good choice.Enum
is used for Constant values.
我是否正确地回答了你的问题?
你有一个enum
Do I get your question correctly?
you have a enum
public enum ManageTable
{
name,
displayed
}
你想要能够调整它的元素吗?即将 name
更改为 TableName
。
害怕说你做不到。我想读一下这些
动态地在C#中更改枚举的值? [ ^ ]
枚举参考 [ ^ ]
you want to be able to adjust an element of it? i.e. change name
to TableName
.
Afraid to say you can't. I would have a read of these
Dynamically change the Value of enum in C#?[^]
Enum reference[^]
这篇关于帮助使用枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!