Annulleret

Recreate extension or make other methods for create TreeStructure C#

Welcome,

I have a problem with creating a tree structure on the basis of a split string, now it returns to me a class object e.g. Node<string> with filled in Name and Children properties, I would like it to fill in all properties and preferably instead of an extension it should concern a ready class e.g. Player. Below is how it looks like now:

I have a Player class on the basis of which I would like to create a tree system with all fields filled in:

public class Player

{

public string Name { get; set; }

public int Age { get; set; }

public string Description { get; set; }

public string MainName { get; set; } // e.g. "Player_1_here_is" and this thong will be divided into pieces and a tree structure will be created based on it.

public IEnumerable<Player> Players { get; set; }

public Player Parent { get; set; }

}

// an example collection, the problem is to divide 'MainName' names by the '_' character and create a tree structure:

List<Player> Players = new List<Player>()

{

new Player(){ Name = "Name", Age = 20, Description = "Description", MainName = "Player" },

new Player(){ Name = "Name 2", Age = 20, Description = "Description 2", MainName = "Player_2" },

new Player(){ Name = "Name 3", Age = 30, Description = "Description 3", MainName = "Player_spoko" },

new Player(){ Name = "Name 4", Age = 40, Description = "Description 4", MainName = "Player_2_dobre" },

new Player(){ Name = "Name 5", Age = 25, Description = "Description 5", MainName = "Player_spoko2" },

new Player(){ Name = "Name 6", Age = 30, Description = "Description 6", MainName = "Player_spoko2_dobre" }

}

// where we create structures on the basis of 'MainName' divided into pieces.

var test = [login to view URL](x => [login to view URL]('_').AsEnumerable()).GroupToTree();

// The result looks like this:

//- Player

//--- 2

//------ good

//--- calm

//--- calm2

//------ good

//where there is a good structure, only to it I would like to assign the remaining fields e.g. for 'Value = good (Name = Name 6)':

//- Name = First name 6

//- Age = 30

//- Description = Description 6

//- MainName - Player_spoko2_dobre

//- Parent = calm2 // where Parent would be set when creating a tree, currently null

// something in this pattern:). Below is an extension to create a tree (GroupToTree)

public class Node<T>

{

public Node(T value, IEnumerable<Node<T>>> children)

{

Value = value;

Children = children;

}

public Node(T value, IEnumerable<Node<T>>> children, Player player)

{

Value = value;

Children = children;

[login to view URL] = player;

}

public T Value { get; set; }

public [login to view URL] Player { get; set; }

public string Test { get; set; }

public IEnumerable<Node<T>>> Children { get; set; }

}

public static IList<Node<T>>> GroupToTree<T>(this IEnumerable<IEnumerable<T>>> source)

{

return GroupToTree([login to view URL](sequence => [login to view URL]()));

}

private static IList<Node<T>>> GroupToTree<T>(IEnumerable<IEnumerator<T>>> source)

{

return [login to view URL]()

.GroupBy(iterator => [login to view URL])

Select(group => new Node<T>([login to view URL], GroupToTree(group)))

ToList();

}

Further part of the description in the link (in polish) because it didn't fit and in general the whole thing is here. I can give 25 EUR for the task. Payment after completing the order, if someone manages to do it, let's record a short video showing how this tree structure looks like for him, whether it's during debugging or the example of DevExpress TreeList. I need this structure just to attach it under TreeList WPF in DevExpress.

OPTIONALY:

- Add method for update tree structure when I will change MainName from collection or when I remove some element from collection then will be nice updated treelist

[login to view URL]

Evner: C# Programmering, Software Arkitektur

Se mere: methods create interactive projects, anonymous js methods create input field converts user typed uppercase focus, make money create modeling characters, how to create tree structure in c#, how to create tree node in c#, tree data structure implementation in c#, family tree data structure c#, c# custom tree structure, c# non-binary tree, c# tree algorithms, tree c# tutorial, php make function create recordset, create facebook custom welcome page, create new c#, create new c, make or create my website, c# design pattern tutorial, c# provider pattern, create logo c online, c# singleton pattern

Om arbejdsgiveren:
( 0 bedømmelser ) Wrocław, Poland

Projekt ID: #19049380

9 freelancere byder i gennemsnit €28 på dette job

harshdaga

Hi, I've got quite some experience with Collections in C# and I'm sure I can help you out here. May I get some more details over the chat?

€25 EUR på 1 dag
(45 bedømmelser)
5.1
carlosperezit

Hi there My name is Carlos and I'm an expert in .Net and sql server. I have been working in software developement for the last 20 years. I have many experience in desktop and web development. Regards

€24 EUR på 1 dag
(33 bedømmelser)
5.2
vinodseta1991

Hello!! Greetings of the day! With 6+ years of full-stack web development & web designing experience with Global Clients, I offer the technical expertise solution related web Designing, graphic designing & Developmen Flere

€29 EUR in 2 dage
(3 bedømmelser)
3.8
waqaramjad1993

Dear sir, madam I am interesting your project. I can satisfy you perfectly. I have read your description and I would like to work for you having perfect expertise in required task. I am software engineer having 5 year Flere

€50 EUR in 10 dage
(3 bedømmelser)
2.5
ranpariyachetan

Hi Sir/Madam, I would like to be considered for this project work. I am a software professional working in the industry for more than 12 years. I have rich experience on Microsoft Technology stack such as C#, ASP Flere

€24 EUR in 3 dage
(1 bedømmelse)
1.0
yoyo09

Hello,I am ready to start right away,i am an expert in web development with experience of 5 years,so i assure you that I can help you in your venture and do a good job. Please feel free to discuss with me. best rega Flere

€20 EUR in 4 dage
(0 bedømmelser)
0.0
omarkamoon

I have a experience in c# and tree and I will do my best to finish it as faster as I can ... maybe less than 2 days

€24 EUR in 2 dage
(0 bedømmelser)
0.0
juampavilla

Hello, I'm a Software Engineer from Argentina, Sr. C# Developer, I could help you with your project, but I need more info. Do you code this? There are syntax mistakes Is it an exercice college project? bes Flere

€19 EUR in 5 dage
(0 bedømmelser)
0.0
vlkadiya

Hi, I go through the job description and i am very confident to make this requirement complete. I have 7+ years of professional experience in Microsoft technology. You may come on chat and let's discuss in details. He Flere

€39 EUR in 3 dage
(0 bedømmelser)
0.0