c# - Pushing Items into stack with LINQ -
How can I push the cracketic string into the generic stack? Stack Setup What changes do I need to make here? LINQ is a query language / framework, rather than a query (selection) you want to display here Amendment for the collection object - it is definitely designed for not LINQ (or also capable). What you would like to do, however, is to define an extension method that can be found in the You can then allow the following to be done: And if you are not already convinced, then another philosophical reason: LINQ functional criteria was created to bring C # / .net, and the main part of functional programming Has a side effect free code. The combination of LINQ with state-modulated code would be quite incompatible in this way.
Public square stack & lt; T & gt; {Private Ent Indexing; & Lt; T & gt; List; Public stack () {List = New list & lt; T & gt; (); Index = -1; } Public Zero Push (T-OBJ) {list.Add (obj); Index ++; } ...........}
pile & lt; String & gt; Slist = new stack & lt; String & gt; (); Var v = Vals in array selection (P = & gt; slist.Push (p)); Error Report:
The type of expression in the selected section is incorrect.
stack & lt; T & gt;
for the class, however note that this is done in BCL stack & lt; T & gt; To understand the type,
also here is the list & lt; T & gt; Instead of modifying the wheel again by using
, what do you want Pushrange in the public stage & lt; T & gt; (This stack & lt; T & gt; source, IEnumerable & lt; T & gt; collection) {foreach (various items in the collection) source. Push (item); }
myStack.PushRange (myCollection);
Comments
Post a Comment