c# - Display all strings in a List -


i trying create 2 sets , put both in list , display items in list. getting error code. error: system.collections.generic.list1[system.collections.generic.sortedset1[system.string]] attaching code below. appreciated.

    namespace prog 5     {         class program         {             static void main(string[] args)     {         list<sortedset<string>> items = new list<sortedset<string>>();         sortedset<string> set = new sortedset<string>();         sortedset<string> set2 = new sortedset<string>();          set.add("a");         set.add("b");         set.add("d");         set.add("c");         set2.add("e");         set2.add("d");         set2.add("c");         foreach (string item in set)         {             items.add(set);         }         foreach (string item in set2)         {             items.add(set2);         }         displayitem(items);      }      public static void displayset(sortedset<string> set)     {          string set1 = string.join(",", set);         console.writeline(set1);         console.readline();     }      public static void displayitem(list<sortedset<string>> items)     {         foreach (sortedset<string> item in items)         {             console.writeline(items);             console.readline();         }     }         } 

in displayitem(...) have console.writeline(items)... type list>. tostring() automatically gets called on produce string console.writeline output: that's why current message. i'm guessing want write each item console.

public static void displayitem(list<sortedset<string>> items) {     foreach (sortedset<string> item in items)     {         displayset(item);     } } 

Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -