Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
How to add multiple values for each namevalue pair
mounika ymr
Jan 5 2018 4:52 AM
211
Reply
I want to enhance the below xml code by adding two more values. I'm using this list to add name values "result.Add(new NameValue(val.ToString(), value)); "
<KeyValue>
<Key>OAuth2Application.GoogleDrive</Key>
<Value>Google Drive</Value>
</KeyValue>
code I' ve used like:
public List<NameValue> GetEnumValues(string EnumName, bool Localize)
{
List<NameValue> result = null;
try
{
if (String.IsNullOrEmpty(EnumName))
{
throw new CoreException("Core.EnumNameCanNotBeEmpty");
}
//Get enum in current namespace
var enumType = (dynamic)null;
if (EnumName.ToLower() == "WFAccessRights".ToLower())
{
enumType = typeof(WFAccessRights); // we need to consider Access Rights enum as special case as it is getting called many times
}
if (enumType == null)
{
enumType = Type.GetType(EnumName);
//Get enum from all reference assemblies
if (enumType == null)
{
enumType = DeepSearchType(EnumName);
}
}
if (enumType != null)
{
result = new List<NameValue>();
//Get enum values
var enumValues = Enum.GetValues(enumType);
//Add to namevalue list
// foreach (var msgid in m_ResourceManager.GetMessage(messageID))
foreach (var val in enumValues)
{
//if localize = true, find the localized string else n
string localizevalue = string.Empty;
m_Locale = string.IsNullOrEmpty(m_Locale) ? GetLocale() : m_Locale;
string resource = string.Format("{0}.{1}", EnumName.ToLower() == "WFAccessRights".ToLower() ? "ACL" : EnumName, val.ToString());
string value = Localize ?
(string.Compare((localizevalue = m_ResourceManager.GetMessage(m_Locale, resource)), resource, true) != 0 ?
localizevalue : val.ToString()) :
val.ToString();
string val1 = "dg";
string value1 = "dfd";
result.Add(new NameValue[] (({ val1.ToString(), value}),({ })));
result.Add(new NameValue(val.ToString(), value));
}
}
and i've this expression "public static NameValue[] Array(string name1, object value1, string name2, object value2, string name3, object value3);" to add 3 values to list. Can anyone Help me out this scenario.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Foxpro database Conversion to SQL Server database
Auto increment request number