TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mounika ymr
NA
90
33.9k
How to add multiple values for each namevalue pair
Jan 5 2018 4:52 AM
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.
Reply
Answers (
0
)
Foxpro database Conversion to SQL Server database
Auto increment request number