чет подправила, у меня там очень много закомментированного кода было...
This commit is contained in:
parent
dd9e86a211
commit
da0b0b3c97
@ -68,55 +68,6 @@ namespace UserComponentsOption19
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод получения объекта из строки с заполнением свойств ентого объекта через рефлексию
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
|
||||
//public T? GetObjectFromSelectedRow<T>() where T : class, new()
|
||||
//{
|
||||
// if (listBox.SelectedIndex == -1 || listBox.SelectedItem == null)
|
||||
// return null;
|
||||
|
||||
// string? selectedString = listBox.SelectedItem.ToString();
|
||||
|
||||
// T obj = new T();
|
||||
// Type objectType = typeof(T);
|
||||
|
||||
// char[] punctMarks = { ',', '.', ';', ':' };
|
||||
|
||||
// string selString = selectedString;
|
||||
// string tempString = _templateString;
|
||||
|
||||
// string[] selList = selString.Split();
|
||||
// string[] tempList = tempString.Split();
|
||||
|
||||
// foreach (var property in objectType.GetProperties())
|
||||
// {
|
||||
// string placeholder = $"{_startPropertyChar}{property.Name}{_endPropertyChar}";
|
||||
// for (int i = 0; i < tempList.Length; i++)
|
||||
// {
|
||||
// if (placeholder == tempList[i].Trim(punctMarks))
|
||||
// {
|
||||
// Type propertyType = property.PropertyType;
|
||||
// Type? underlyingType = Nullable.GetUnderlyingType(propertyType);
|
||||
|
||||
// if (underlyingType != null)
|
||||
// {
|
||||
// object? converted = string.IsNullOrWhiteSpace(selList[i]) ? null : Convert.ChangeType(selList[i].Trim(punctMarks), underlyingType);
|
||||
// property.SetValue(obj, converted);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// property.SetValue(obj, Convert.ChangeType(selList[i].Trim(punctMarks), property.PropertyType));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return obj;
|
||||
//}
|
||||
|
||||
public T? GetObjectFromSelectedRow<T>() where T : class, new()
|
||||
{
|
||||
if (listBox.SelectedIndex == -1 || listBox.SelectedItem == null)
|
||||
@ -128,22 +79,7 @@ namespace UserComponentsOption19
|
||||
Type objectType = typeof(T);
|
||||
|
||||
string selString = selectedString;
|
||||
string tempString =
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_templateString;
|
||||
string tempString = _templateString;
|
||||
|
||||
List<string> arraySubstrings = new List<string>();
|
||||
List<string> arrayPropertyNames = new List<string>();
|
||||
|
@ -5,6 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user