Witam. Mam pewien problem w kodzie, nie moge uzyskać PropertyInfo z mojego object listy. Problem jest przy drugim "foreach"(omija go całkiem). Proszę o pomoc
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Forms;
using System.Net;
using Utilities;
namespace Utilities
{
public static class Settings
{
static Dictionary<string, Object> SettingObjectList = new Dictionary<string, Object>();
//#####################################################################################################################
public static bool Init()
{
try
{
for (int i = 0; i < FilesPath.Length; i++)
{
string Namespace = "Utilities.";
string ClassName = FilesPath[i][0].Split('.')[0];
var SettingObject = Activator.CreateInstance(null,Namespace + ClassName);
SettingObjectList.Add(ClassName, SettingObject);
}
return true;
}
catch
{
return false;
}
}
//#####################################################################################################################
private static readonly string[][] FilesPath = new string[][]
{
new string[]{"MainSettings.ini", @".\Settings\"}
};
private static readonly string[] FolderPath = new string[]
{
@".\Settings\ServersSettings"
};
//#####################################################################################################################
public static bool LoadSettings()
{
try
{
foreach (KeyValuePair<string, Object> Item in SettingObjectList)
{
foreach (PropertyInfo ItemProperty in Item.Value.GetType().GetProperties())
{
string Test = ItemProperty.Name;
}
}
return true;
}
catch (Exception Ex)
{
return false;
}
}
//#####################################################################################################################
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Threading.Tasks;
namespace Utilities
{
public class MainSettings
{
public IPAddress IPAddress;
public int Port;
public int MaxConnections;
public string SqlIpAddress;
public int SqlPort;
public string SqlLogin;
public string SqlPassword;
}
}