c# - JArray.Contains issue -
I have a JARR, read from a file:
Private Zero removal tool (Catalog list) {System.IO.StreamReader filereader = New System.io.StreamReader (@Ap Directory- "\\ List"); Jereca Marzare = Jerry. Purse (filearrereteteond ()); Filereader.Close (); String Jason = "{\" token \ ": \" "+ list. Token +" \ ", \" name \ ": \" "+ list. Name +" \ ", \" logo \ ": \" + List. Logo + "\", \ "subject \": \ "" + catalog.Theme + "\"} "; MyCatalogAsJObject = Jobbject.Parse (json); Myjarray.Remove (myCatalogAsJObject); }
I want to remove the function corresponding to the myCatalogAsJObject
variable, but it does not work because the answer to myjarray.Contains (myCatalogAseJObject) is < / Code> is false.
The problem is that myjarray
is actually included in it: this is just work in my jerk.
If I MyCatalogAsJObject.ToString () Equals (myjarray.First.ToString ())
, the answer is however true.
I'm stuck.
.
(and .remove
) by default reference . Since you are creating new jabax
, there is no example in the array.
You can remove the orange object from the array and delete that :
job match = mergara . FirstOver Default (J => J. Talk == Catalog.token & amp; j.name == catalog.name and j.logo == catalog.logo & j.theme == catalog.theme); Myjarray.Remove (match); Edit: This is your code, Simplified: Jotokan match = myjarray.FirstOrDefault (j = & gt; j.ToString (.) Equals (MyCatalogAseJObject .tar ())); Myjarray.Remove (match);
Comments
Post a Comment