I am converting Linq queries from C # to VB.Net below. Can you see my error? The query contains 3 XML datasets, thanks in advance!
C # - It does a great job.
list & lt; Curriculum & gt; Course = Course course (in the CourseXML.Descendants (from the "Line") (string) course.Attribute courseCategoryXML.Descendants ("table") coursecategory ("code") is equal to (string) coursecategory Element (string) coursecategory.Element ("GRP") is equivalent to joining the CategoryXML.Descendants ("Table") category (string) category.Element ("GRP") where (string) coursecategory .Element ("RECTYPE") == Select "C" New Course (Category Code = Category Element ("GRP"). Value, Code = Curriculum Rum. Attribute ("code"). Value}) ToList & lt; curriculum & gt; ();
VB - I can not find any results from this, so I doubt that I am cutting incorrectly or incorrectly connected.
Blank result = (Course from CourseXML.Descendants (ns + "line") _ coursecategory Join CourseCategoryXML.Descendants ("Table CTYPE is equal to CTYPE (course.Attribute ("code"), string in CTYPE (coursecategory.Element ("data"), string) _ Category CategoryXML.Descendants ("table") CTYPE (coursecategory.Element () "Gia P "on the string) is equal to CTYPE (category.Element (" GRP "), string) _ Where CTYPE (coursecategory.Element (" RECTYPE ", string) =" C "_ _ {_. Select a new course with CategoryCode = category.Element ("GRP"). Value, _Code = course.Attribute ("code") Value_}). ToList ()
I used the following site to convert:
Course in the form of a short course list (course of course) = (Course in the course from XML.Descendants (NS & amp; "Line") _ Join the course category in the category. XML.Descendants (" Table ") DirectCast (course.Attribute (" code "), string) = DirectCast (coursecategory.Element (" data "), string) join category_x class.xml.Descendants (" table ") DirectCast (coursecategory.Element ( "GRP"), st Ing) = DirectCast (CategorykElement ( "GRP"), String) _ Where DirectCast (CoursecategorykElement ( "RECTYPE"), string) = "C" select _ new (of course)). ToList (course) ()The main difference is the final selection.
No comments:
Post a Comment