diff --git a/.openpublishing.redirection.json b/.openpublishing.redirection.json index 021820d750474..d13ecdfaddef0 100644 --- a/.openpublishing.redirection.json +++ b/.openpublishing.redirection.json @@ -1332,9733 +1332,11304 @@ "source_path": "docs/csharp/programming-guide/concepts/caller-information.md", "redirect_url": "/dotnet/csharp/language-reference/attributes/caller-information" }, + { + "source_path": "docs/csharp/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/add-elements-attributes-nodes-xml-tree", + "redirect_document_id": true + }, { "source_path": "docs/csharp/programming-guide/concepts/linq/advanced-query-techniques-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml" + "redirect_url": "/dotnet/standard/linq/join-two-collections", + "redirect_document_id": false }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/cloning-vs-attaching.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2#attaching-vs-cloning" + "source_path": "docs/csharp/programming-guide/concepts/linq/applicability-of-functional-transformation.md", + "redirect_url": "/dotnet/standard/linq/applicability-functional-transformation", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/creating-xml-trees.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2" + "source_path": "docs/csharp/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/atomized-xname-xnamespace-objects", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/getting-started-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/chaining-queries-example.md", + "redirect_url": "/dotnet/standard/linq/chain-queries-example", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/getting-started-with-linq.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/" + "source_path": "docs/csharp/programming-guide/concepts/linq/chaining-standard-query-operators-together.md", + "redirect_url": "/dotnet/standard/linq/chain-standard-query-operators-together", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/introduction-to-linq.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq" + "source_path": "docs/csharp/programming-guide/concepts/linq/cloning-vs-attaching.md", + "redirect_url": "/dotnet/standard/linq/create-xml-trees#example-attach-vs-clone", + "redirect_document_id": false }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/linq-and-reflection.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-query-an-assembly-s-metadata-with-reflection-linq" + "source_path": "docs/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/comparison-xpath-linq-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-axes-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md", + "redirect_url": "/dotnet/standard/linq/concepts-terminology-functional-transformation", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml" + "source_path": "docs/csharp/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/create-source-office-open-xml-document", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-programming-overview.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2.md", + "redirect_url": "/dotnet/standard/linq/create-xml-trees", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/creating-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/create-xml-trees", + "redirect_document_id": false }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml" + "source_path": "docs/csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/deferred-execution-lazy-evaluation", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/parsing-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-parse-a-string" + "source_path": "docs/csharp/programming-guide/concepts/linq/deferred-execution-example.md", + "redirect_url": "/dotnet/standard/linq/deferred-execution-example", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/programming-guide-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md", + "redirect_url": "/dotnet/standard/linq/example-outputs-office-open-xml-document-parts", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml" + "source_path": "docs/csharp/programming-guide/concepts/linq/finding-text-in-word-documents.md", + "redirect_url": "/dotnet/standard/linq/find-text-word-documents", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/introduction-to-pure-functional-transformations" + "source_path": "docs/csharp/programming-guide/concepts/linq/finding-the-default-paragraph-style.md", + "redirect_url": "/dotnet/standard/linq/find-default-paragraph-style", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/querying-xml-trees.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute" + "source_path": "docs/csharp/programming-guide/concepts/linq/functional-construction-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-construction", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1" + "source_path": "docs/csharp/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-imperative-programming", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/serializing-xml-trees.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters" + "source_path": "docs/csharp/programming-guide/concepts/linq/functional-transformation-of-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-transformation-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/tutorial-chaining-queries-together.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml" + "source_path": "docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/shape-of-wordprocessingml-documents" + "source_path": "docs/csharp/programming-guide/concepts/linq/getting-started-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/csharp/programming-guide/concepts/linq/working-with-xml-namespaces.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/namespaces-overview-linq-to-xml" + "source_path": "docs/csharp/programming-guide/concepts/linq/getting-started-with-linq.md", + "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/" }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/how-to-use-a-thread-pool.md", - "redirect_url": "/dotnet/api/system.threading.threadpool.queueuserworkitem" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md", + "redirect_url": "/dotnet/standard/linq/build-linq-xml-examples", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/index.md", - "redirect_url": "/dotnet/standard/threading/" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md", + "redirect_url": "/dotnet/standard/linq/calculate-intermediate-values", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/multithreaded-applications.md", - "redirect_url": "/dotnet/standard/threading/using-threads-and-threading" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-catch-parsing-errors.md", + "redirect_url": "/dotnet/standard/linq/catch-parsing-errors", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/parameters-and-return-values-for-multithreaded-procedures.md", - "redirect_url": "/dotnet/standard/threading/creating-threads-and-passing-data-at-start-time" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/chain-axis-method-calls", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/thread-pooling.md", - "redirect_url": "/dotnet/standard/threading/the-managed-thread-pool" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/change-namespace-entire-xml-tree", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/thread-synchronization.md", - "redirect_url": "/dotnet/standard/threading/overview-of-synchronization-primitives" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/control-namespace-prefixes", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/thread-timers.md", - "redirect_url": "/dotnet/standard/threading/timers" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md", + "redirect_url": "/dotnet/standard/linq/control-type-projection", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/concepts/threading/walkthrough-multithreading-with-the-backgroundworker-component.md", - "redirect_url": "/dotnet/api/system.componentmodel.backgroundworker" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/create-document-namespaces-csharp", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/enumeration-types.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/enum" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md", + "redirect_url": "/dotnet/standard/linq/create-tree-xmlreader", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/events/how-to-use-a-dictionary-to-store-event-instances.md", - "redirect_url": "/dotnet/standard/events/how-to-handle-multiple-events-using-event-properties" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md", + "redirect_url": "/dotnet/standard/linq/create-hierarchy-grouping", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/exceptions/exceptions-and-exception-handling.md", - "redirect_url": "/dotnet/csharp/programming-guide/exceptions/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md", + "redirect_url": "/dotnet/standard/linq/debug-empty-query-results-sets", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/generics/benefits-of-generics.md", - "redirect_url": "/dotnet/csharp/programming-guide/generics" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/filter-attribute", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/generics/default-keyword-in-generics.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/default", + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md", + "redirect_url": "/dotnet/standard/linq/filter-optional-element", "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/generics/generics-in-the-net-framework-class-library.md", - "redirect_url": "/dotnet/standard/generics/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/filter-element-names", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/generics/introduction-to-generics.md", - "redirect_url": "/dotnet/standard/generics/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-child-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/interop/interoperability.md", - "redirect_url": "/dotnet/csharp/programming-guide/interop/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-list-child-elements", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-create-a-nested-group.md", - "redirect_url": "/dotnet/csharp/linq/create-a-nested-group" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md", + "redirect_url": "/dotnet/standard/linq/find-single-descendant-descendants-method", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-dynamically-specify-predicate-filters-at-runtime.md", - "redirect_url": "/dotnet/csharp/linq/dynamically-specify-predicate-filters-at-runtime" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-union-two-location-paths", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-group-query-results.md", - "redirect_url": "/dotnet/csharp/linq/group-query-results" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/find-all-nodes-namespace", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-group-results-by-contiguous-keys.md", - "redirect_url": "/dotnet/csharp/linq/group-results-by-contiguous-keys" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-attribute-parent", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-handle-exceptions-in-query-expressions.md", - "redirect_url": "/dotnet/csharp/linq/handle-exceptions-in-query-expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md", + "redirect_url": "/dotnet/standard/linq/find-element-specific-attribute", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-handle-null-values-in-query-expressions.md", - "redirect_url": "/dotnet/csharp/linq/handle-null-values-in-query-expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md", + "redirect_url": "/dotnet/standard/linq/find-element-specific-child-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-join-by-using-composite-keys.md", - "redirect_url": "/dotnet/csharp/linq/join-by-using-composite-keys" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-attributes-siblings-specific-name", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-order-the-results-of-a-join-clause.md", - "redirect_url": "/dotnet/csharp/linq/order-the-results-of-a-join-clause" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-child-elements-based-position", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-a-subquery-on-a-grouping-operation.md", - "redirect_url": "/dotnet/csharp/linq/perform-a-subquery-on-a-grouping-operation" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-descendant-elements", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-custom-join-operations.md", - "redirect_url": "/dotnet/csharp/linq/perform-custom-join-operations" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-descendants-child-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-grouped-joins.md", - "redirect_url": "/dotnet/csharp/linq/perform-grouped-joins" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md", + "redirect_url": "/dotnet/standard/linq/find-descendants-specific-element-name", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-inner-joins.md", - "redirect_url": "/dotnet/csharp/linq/perform-inner-joins" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-elements-namespace", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-left-outer-joins.md", - "redirect_url": "/dotnet/csharp/linq/perform-left-outer-joins" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-elements-specific-attribute", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-query-a-collection-of-objects.md", - "redirect_url": "/dotnet/csharp/linq/query-a-collection-of-objects" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-preceding-siblings", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-return-a-query-from-a-method.md", - "redirect_url": "/dotnet/csharp/linq/return-a-query-from-a-method" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-related-elements", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-store-the-results-of-a-query-in-memory.md", - "redirect_url": "/dotnet/csharp/linq/store-the-results-of-a-query-in-memory" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-sibling-nodes", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-write-linq-queries.md", - "redirect_url": "/dotnet/csharp/linq/write-linq-queries" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-immediate-preceding-sibling", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/index.md", - "redirect_url": "/dotnet/csharp/linq/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-root-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/linq-query-expressions/query-expression-basics.md", - "redirect_url": "/dotnet/csharp/linq/query-expression-basics" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md", + "redirect_url": "/dotnet/standard/linq/generate-text-files-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/main-and-command-args/how-to-access-command-line-arguments-using-foreach.md", - "redirect_url": "/dotnet/csharp/programming-guide/arrays/using-foreach-with-arrays" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md", + "redirect_url": "/dotnet/standard/linq/generate-xml-csv-files", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/main-and-command-args/main-and-command-line-arguments.md", - "redirect_url": "/dotnet/csharp/programming-guide/main-and-command-args/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/join-two-collections", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/namespaces/how-to-use-the-global-namespace-alias.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/namespace-alias-qualifier" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md", + "redirect_url": "/dotnet/standard/linq/list-all-nodes-tree", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/nullable-types/boxing-nullable-types.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md", + "redirect_url": "/dotnet/standard/linq/load-xml-file", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/nullable-types/how-to-identify-a-nullable-type.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types#how-to-identify-a-nullable-value-type" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/modify-office-open-xml-document", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/nullable-types/how-to-safely-cast-from-bool-to-bool.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-parse-a-string.md", + "redirect_url": "/dotnet/standard/linq/parse-string", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/nullable-types/index.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md", + "redirect_url": "/dotnet/standard/linq/perform-streaming-transform-large-xml-documents", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/nullable-types/using-nullable-types.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transformations-of-text-to-xml.md", + "redirect_url": "/dotnet/standard/linq/perform-streaming-transformations-text-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/anonymous-methods.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/delegate-operator" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md", + "redirect_url": "/dotnet/standard/linq/populate-xml-tree-file-system", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/conversion-operators.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/populate-xml-tree-xmlwriter", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/default-value-expressions.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/default" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/project-new-type", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/expressions.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md", + "redirect_url": "/dotnet/standard/linq/project-anonymous-type", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-implement-user-defined-conversions-between-structs.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-project-an-object-graph.md", + "redirect_url": "/dotnet/standard/linq/project-object-graph", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-use-lambda-expressions-outside-linq.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md", + "redirect_url": "/dotnet/standard/linq/query-linq-xml-xpath", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-use-operator-overloading-to-create-a-complex-number-class.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/operator-overloading" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md", + "redirect_url": "/dotnet/standard/linq/read-write-encoded-document", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/lambda-expressions.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-collection-attributes", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/operators.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-collection-elements", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/overloadable-operators.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/operator-overloading#overloadable-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-single-attribute", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/statements-expressions-operators/using-conversion-operators.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-single-child-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-compare-strings.md", - "redirect_url": "/dotnet/csharp/how-to/compare-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/retrieve-paragraphs-office-open-xml-document", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-concatenate-multiple-strings.md", - "redirect_url": "/dotnet/csharp/how-to/concatenate-multiple-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md", + "redirect_url": "/dotnet/standard/linq/retrieve-shallow-value-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-convert-a-string-to-a-datetime.md", - "redirect_url": "/dotnet/standard/base-types/parsing-datetime" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-value-attribute", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-convert-between-legacy-encondings-and-unicode.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc165448(v=vs.120)" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-value-element", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-convert-rtf-to-plain-text.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488002(v=vs.120)" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md", + "redirect_url": "/dotnet/standard/linq/serialize-datacontractserializer", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-modify-string-contents.md", - "redirect_url": "/dotnet/csharp/how-to/modify-string-contents" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md", + "redirect_url": "/dotnet/standard/linq/serialize-xmlserializer", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-parse-strings-using-string-split.md", - "redirect_url": "/dotnet/csharp/how-to/parse-strings-using-split" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md", + "redirect_url": "/dotnet/standard/linq/sort-elements-multiple-keys", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-search-strings-using-regular-expressions.md", - "redirect_url": "/dotnet/csharp/how-to/search-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-sort-elements.md", + "redirect_url": "/dotnet/standard/linq/sort-elements", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/strings/how-to-search-strings-using-string-methods.md", - "redirect_url": "/dotnet/csharp/how-to/search-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md", + "redirect_url": "/dotnet/standard/linq/stream-xml-fragments-xmlreader", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/types/how-to-safely-cast-using-as-and-is-operators.md", - "redirect_url": "/dotnet/csharp/how-to/safely-cast-using-pattern-matching-is-and-as-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md", + "redirect_url": "/dotnet/standard/linq/stream-xml-fragments-access-header-information", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-arithmetic-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/transform-shape-xml-tree", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-member-access-operator--" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md", + "redirect_url": "/dotnet/standard/linq/use-annotations-transform-linq-xml-trees-xslt-style", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-an-array-element-with-a-pointer.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-element-access-operator-" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/validate-xsd", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-increment-and-decrement" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/work-dictionaries-linq-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-obtain-the-address-of-a-variable.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#address-of-operator-" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md", + "redirect_url": "/dotnet/standard/linq/write-linq-xml-axis-method", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-obtain-the-value-of-a-pointer-variable.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-indirection-operator-" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md", + "redirect_url": "/dotnet/standard/linq/write-query-finds-elements-based-context", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/manipulating-pointers.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md", + "redirect_url": "/dotnet/standard/linq/write-queries-xml-namespaces", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/pointer-comparison.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-comparison-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md", + "redirect_url": "/dotnet/standard/linq/write-queries-complex-filtering", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/pointer-expressions.md", - "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators" + "source_path": "docs/csharp/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/in-memory-xml-tree-modification-vs-functional-construction", + "redirect_document_id": true }, { - "source_path": "docs/csharp/programming-guide/xmldoc/xml-documentation-comments.md", - "redirect_url": "/dotnet/csharp/programming-guide/xmldoc" + "source_path": "docs/csharp/programming-guide/concepts/linq/intermediate-materialization.md", + "redirect_url": "/dotnet/standard/linq/intermediate-materialization", + "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/arrays-and-collections.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/arrays-and-collections", + "source_path": "docs/csharp/programming-guide/concepts/linq/introduction-to-linq.md", + "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq" + }, + { + "source_path": "docs/csharp/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md", + "redirect_url": "/dotnet/standard/linq/introduction-pure-functional-transformations", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/branches-and-loops-local.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/branches-and-loops-local", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-and-reflection.md", + "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/how-to-query-an-assembly-s-metadata-with-reflection-linq" + }, + { + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-annotations.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-annotations", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/branches-and-loops.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/branches-and-loops" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-axes-overview", + "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/hello-world.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/hello-world" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-axes-overview", + "redirect_document_id": false }, { - "source_path": "docs/csharp/quick-starts/index.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-classes-overview", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/interpolated-strings-local.md", - "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings-local", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-events.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-events", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/interpolated-strings.md", - "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md", + "redirect_url": "/dotnet/standard/linq/comparison-xpath-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/csharp/quick-starts/introduction-to-classes.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/introduction-to-classes", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/list-collection.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/list-collection" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-programming-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/csharp/quick-starts/local-environment.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/local-environment", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-security.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-security", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/numbers-in-csharp-local.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/numbers-in-csharp-local", + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-dom.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-vs-dom", "redirect_document_id": true }, { - "source_path": "docs/csharp/quick-starts/numbers-in-csharp.md", - "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/numbers-in-csharp" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-vs-xml-technologies", + "redirect_document_id": true }, { - "source_path": "docs/csharp/reference-semantics-with-value-types.md", - "redirect_url": "/dotnet/csharp/write-safe-efficient-code" + "source_path": "docs/csharp/programming-guide/concepts/linq/linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/csharp/reflection.md", - "redirect_url": "/dotnet/framework/reflection-and-codedom" + "source_path": "docs/csharp/programming-guide/concepts/linq/maintaining-name-value-pairs.md", + "redirect_url": "/dotnet/standard/linq/maintain-name-value-pairs", + "redirect_document_id": true }, { - "source_path": "docs/csharp/roslyn/index.md", - "redirect_url": "/dotnet/csharp/roslyn-sdk/" + "source_path": "docs/csharp/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/mixed-declarative-imperative-code-bugs", + "redirect_document_id": true }, { - "source_path": "docs/csharp/structs.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/struct" + "source_path": "docs/csharp/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/modify-elements-attributes-nodes-xml-tree", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/arrays.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/features#arrays-collections-and-LINQ" + "source_path": "docs/csharp/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/in-memory-xml-tree-modification-vs-functional-construction", + "redirect_document_id": false }, { - "source_path": "docs/csharp/tour-of-csharp/attributes.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/features#attributes" + "source_path": "docs/csharp/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/namespaces-overview", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/delegates.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/features#delegates-and-lambda-expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/parsing-xml.md", + "redirect_url": "/dotnet/standard/linq/parse-string", + "redirect_document_id": false }, { - "source_path": "docs/csharp/tour-of-csharp/enums.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/enum" + "source_path": "docs/csharp/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/performance-chained-queries", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/expressions.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/program-building-blocks#expressions" + "source_path": "docs/csharp/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/pre-atomization-xname-objects", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/interfaces.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/types#interfaces" + "source_path": "docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml1.md", + "redirect_url": "/dotnet/standard/linq/preserve-white-space-loading-parsing-xml", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/program-structure.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/#program-structure" + "source_path": "docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-serializing.md", + "redirect_url": "/dotnet/standard/linq/preserve-white-space-serializing", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/statements.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/program-building-blocks#statements" + "source_path": "docs/csharp/programming-guide/concepts/linq/programming-guide-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/csharp/tour-of-csharp/structs.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/struct" + "source_path": "docs/csharp/programming-guide/concepts/linq/programming-with-nodes.md", + "redirect_url": "/dotnet/standard/linq/program-nodes", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tour-of-csharp/types-and-variables.md", - "redirect_url": "/dotnet/csharp/tour-of-csharp/types" + "source_path": "docs/csharp/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md", + "redirect_url": "/dotnet/standard/linq/project-xml-different-shape", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tuples.md", - "redirect_url": "/dotnet/csharp/language-reference/builtin-types/value-tuples" + "source_path": "docs/csharp/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/work-dictionaries-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/csharp/tutorials/default-interface-members-versions.md", - "redirect_url": "/dotnet/csharp/tutorials/default-interface-methods-versions" + "source_path": "docs/csharp/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md", + "redirect_url": "/dotnet/standard/linq/introduction-pure-functional-transformations", + "redirect_document_id": false }, { - "source_path": "docs/csharp/tutorials/exploration/csharp-7.yml", - "redirect_url": "/dotnet/csharp/whats-new/csharp-7" + "source_path": "docs/csharp/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md", + "redirect_url": "/dotnet/standard/linq/query-xdocument-vs-query-xelement", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tutorials/intro-to-csharp/interpolated-strings-local.md", - "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings-local" + "source_path": "docs/csharp/programming-guide/concepts/linq/querying-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/query-xml-trees-overview", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tutorials/intro-to-csharp/interpolated-strings.yml", - "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings" + "source_path": "docs/csharp/programming-guide/concepts/linq/refactoring-into-pure-functions.md", + "redirect_url": "/dotnet/standard/linq/refactor-pure-functions", + "redirect_document_id": true }, { - "source_path": "docs/csharp/tutorials/microservices.md", - "redirect_url": "/dotnet/core/docker/" + "source_path": "docs/csharp/programming-guide/concepts/linq/refactoring-using-a-pure-function.md", + "redirect_url": "/dotnet/standard/linq/refactor-pure-function", + "redirect_document_id": true }, { - "source_path": "docs/csharp/type-system.md", - "redirect_url": "/dotnet/csharp/programming-guide/types/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/refactoring-using-an-extension-method.md", + "redirect_url": "/dotnet/standard/linq/refactor-extension-method", + "redirect_document_id": true }, { - "source_path": "docs/csharp/whats-new.md", - "redirect_url": "/dotnet/csharp/whats-new/csharp-9", + "source_path": "docs/csharp/programming-guide/concepts/linq/reference-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/reference", "redirect_document_id": true }, { - "source_path": "docs/csharp/whats-new/index.md", - "redirect_url": "/dotnet/csharp/whats-new/csharp-9", - "ms.custom": "updateeachrelease" + "source_path": "docs/csharp/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/remove-elements-attributes-nodes-xml-tree", + "redirect_document_id": true }, { - "source_path": "docs/desktop-wpf/data/index.md", - "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" + "source_path": "docs/csharp/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md", + "redirect_url": "/dotnet/standard/linq/retrieve-paragraphs-styles", + "redirect_document_id": true }, { - "source_path": "docs/desktop-wpf/fundamentals/index.md", - "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml" + "source_path": "docs/csharp/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md", + "redirect_url": "/dotnet/standard/linq/retrieve-text-paragraphs", + "redirect_document_id": true }, { - "source_path": "docs/desktop-wpf/getting-started/index.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/get-started/csharp/tutorial-wpf?toc=/dotnet/desktop-wpf/toc.json&bc=/dotnet/breadcrumb/toc.json" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order", + "redirect_document_id": false }, { - "source_path": "docs/desktop-wpf/migration/index.md", - "redirect_url": "/dotnet/desktop-wpf/migration/differences-from-net-framework" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-books", + "redirect_document_id": true }, { - "source_path": "docs/desktop-wpf/migration/types-migrated-from-wpf-to-system-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-consolidated-purchase-orders", + "redirect_document_id": true }, { - "source_path": "docs/framework/add-ins/index.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb384200(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-customers-orders-namespace", + "redirect_document_id": true }, { - "source_path": "docs/framework/add-ins/pipeline-development.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb384201(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml-2.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-customers-orders", + "redirect_document_id": true }, { - "source_path": "docs/framework/add-ins/walkthrough-create-extensible-app.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb788290(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-multiple-purchase-orders-namespace", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assemblies-and-side-by-side-execution.md", - "redirect_url": "/dotnet/standard/assembly/side-by-side-execution" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-multiple-purchase-orders", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assemblies-in-the-common-language-runtime.md", - "redirect_url": "/dotnet/standard/assembly/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-numerical-data-namespace", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-contents.md", - "redirect_url": "/dotnet/standard/assembly/contents" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-numerical-data", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-location.md", - "redirect_url": "/dotnet/standard/assembly/location" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace1.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-test-configuration-namespace", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-manifest.md", - "redirect_url": "/dotnet/standard/assembly/manifest" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-test-configuration", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-names.md", - "redirect_url": "/dotnet/standard/assembly/names" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order-namespace", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-security-considerations.md", - "redirect_url": "/dotnet/standard/assembly/security-considerations" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/assembly-versioning.md", - "redirect_url": "/dotnet/standard/assembly/versioning" + "source_path": "docs/csharp/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders1.md", + "redirect_url": "/dotnet/standard/linq/sample-xsd-file-customers-orders", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/create-and-use-strong-named-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/create-use-strong-named" + "source_path": "docs/csharp/programming-guide/concepts/linq/scope-of-default-namespaces.md", + "redirect_url": "/dotnet/standard/linq/scope-default-namespaces", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/create-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/create" + "source_path": "docs/csharp/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md", + "redirect_url": "/dotnet/standard/linq/serialize-xmlreader-invoke-xslt", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/delay-sign-assembly.md", - "redirect_url": "/dotnet/standard/assembly/delay-sign" + "source_path": "docs/csharp/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md", + "redirect_url": "/dotnet/standard/linq/serialize-files-textwriters-xmlwriters", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/enhanced-strong-naming.md", - "redirect_url": "/dotnet/standard/assembly/enhanced-strong-naming" + "source_path": "docs/csharp/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md", + "redirect_url": "/dotnet/standard/linq/serialize-xml-declaration", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-build-a-multifile-assembly.md", - "redirect_url": "/framework/app-domains/build-multifile-assembly" + "source_path": "docs/csharp/programming-guide/concepts/linq/serializing-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/serialize-files-textwriters-xmlwriters", + "redirect_document_id": false }, { - "source_path": "docs/framework/app-domains/how-to-build-a-single-file-assembly.md", - "redirect_url": "/framework/app-domains/build-single-file-assembly" + "source_path": "docs/csharp/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md", + "redirect_url": "/dotnet/standard/linq/xml-shape-wordprocessingml-documents", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-create-a-public-private-key-pair.md", - "redirect_url": "/dotnet/standard/assembly/create-public-private-key-pair" + "source_path": "docs/csharp/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/statically-compiled-queries", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-determine-assembly-fully-qualified-name.md", - "redirect_url": "/dotnet/standard/assembly/find-fully-qualified-name" + "source_path": "docs/csharp/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md", + "redirect_url": "/dotnet/standard/linq/style-part-wordprocessingml-document", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-disable-the-strong-name-bypass-feature.md", - "redirect_url": "/dotnet/standard/assembly/disable-strong-name-bypass-feature" + "source_path": "docs/csharp/programming-guide/concepts/linq/tutorial-chaining-queries-together.md", + "redirect_url": "/dotnet/standard/linq/chain-queries-example", + "redirect_document_id": false }, { - "source_path": "docs/framework/app-domains/how-to-install-an-assembly-into-the-gac.md", - "redirect_url": "/dotnet/framework/app-domains/install-assembly-into-gac" + "source_path": "docs/csharp/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md", + "redirect_url": "/dotnet/standard/linq/xml-shape-wordprocessingml-documents", + "redirect_document_id": false }, { - "source_path": "docs/framework/app-domains/how-to-obtain-type-and-member-information-from-an-assembly.md", - "redirect_url": "/dotnet/framework/reflection-and-codedom/get-type-member-information" + "source_path": "docs/csharp/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/use-xslt-transform-xml-tree", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-reference-a-strong-named-assembly.md", - "redirect_url": "/dotnet/standard/assembly/reference-strong-named" + "source_path": "docs/csharp/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects3.md", + "redirect_url": "/dotnet/standard/linq/valid-content-xelement-xdocument-objects", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-sign-an-assembly-with-a-strong-name.md", - "redirect_url": "/dotnet/standard/assembly/sign-strong-name" + "source_path": "docs/csharp/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md", + "redirect_url": "/dotnet/standard/linq/wordprocessingml-document-styles", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/how-to-view-assembly-contents.md", - "redirect_url": "/dotnet/standard/assembly/view-contents" + "source_path": "docs/csharp/programming-guide/concepts/linq/working-with-xml-namespaces.md", + "redirect_url": "/dotnet/standard/linq/namespaces-overview", + "redirect_document_id": false }, { - "source_path": "docs/framework/app-domains/programming-with-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/index" + "source_path": "docs/csharp/programming-guide/concepts/linq/xattribute-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xattribute-class-overview", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/resolve-assembly-loads.md", - "redirect_url": "/dotnet/standard/assembly/resolve-loads" + "source_path": "docs/csharp/programming-guide/concepts/linq/xdocument-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xdocument-class-overview", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/set-assembly-attributes.md", - "redirect_url": "/dotnet/standard/assembly/set-attributes" + "source_path": "docs/csharp/programming-guide/concepts/linq/xelement-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xelement-class-overview", + "redirect_document_id": true }, { - "source_path": "docs/framework/app-domains/strong-named-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/strong-named" + "source_path": "docs/csharp/programming-guide/concepts/threading/how-to-use-a-thread-pool.md", + "redirect_url": "/dotnet/api/system.threading.threadpool.queueuserworkitem" }, { - "source_path": "docs/framework/app-domains/type-forwarding-in-the-common-language-runtime.md", - "redirect_url": "/dotnet/standard/assembly/type-forwarding" + "source_path": "docs/csharp/programming-guide/concepts/threading/index.md", + "redirect_url": "/dotnet/standard/threading/" }, { - "source_path": "docs/framework/common-client-technologies/client-application-services-overview.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384339(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/multithreaded-applications.md", + "redirect_url": "/dotnet/standard/threading/using-threads-and-threading" }, { - "source_path": "docs/framework/common-client-technologies/client-application-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/parameters-and-return-values-for-multithreaded-procedures.md", + "redirect_url": "/dotnet/standard/threading/creating-threads-and-passing-data-at-start-time" }, { - "source_path": "docs/framework/common-client-technologies/creating-the-game1-class.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248547(v=vs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/thread-pooling.md", + "redirect_url": "/dotnet/standard/threading/the-managed-thread-pool" }, { - "source_path": "docs/framework/common-client-technologies/creating-the-gamepiece-class.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248546(v=vs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/thread-synchronization.md", + "redirect_url": "/dotnet/standard/threading/overview-of-synchronization-primitives" }, { - "source_path": "docs/framework/common-client-technologies/creating-the-gamepiececollection-class.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248550(v=vs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/thread-timers.md", + "redirect_url": "/dotnet/standard/threading/timers" }, { - "source_path": "docs/framework/common-client-technologies/full-code-listings.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248551(v=vs.100)" + "source_path": "docs/csharp/programming-guide/concepts/threading/walkthrough-multithreading-with-the-backgroundworker-component.md", + "redirect_url": "/dotnet/api/system.componentmodel.backgroundworker" }, { - "source_path": "docs/framework/common-client-technologies/how-to-configure-client-application-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384312(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/enumeration-types.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/enum" }, { - "source_path": "docs/framework/common-client-technologies/how-to-implement-user-login-with-client-application-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384313(v%3dvs.100)" + "source_path": "docs/csharp/programming-guide/events/how-to-use-a-dictionary-to-store-event-instances.md", + "redirect_url": "/dotnet/standard/events/how-to-handle-multiple-events-using-event-properties" }, { - "source_path": "docs/framework/common-client-technologies/index.md", - "redirect_url": "/dotnet/framework/develop-client-apps" + "source_path": "docs/csharp/programming-guide/exceptions/exceptions-and-exception-handling.md", + "redirect_url": "/dotnet/csharp/programming-guide/exceptions/index" }, { - "source_path": "docs/framework/common-client-technologies/manipulations-and-inertia-overview.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248549(v=vs.100)" + "source_path": "docs/csharp/programming-guide/generics/benefits-of-generics.md", + "redirect_url": "/dotnet/csharp/programming-guide/generics" }, { - "source_path": "docs/framework/common-client-technologies/manipulations-and-inertia.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248545(v=vs.100)" + "source_path": "docs/csharp/programming-guide/generics/default-keyword-in-generics.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/default", + "redirect_document_id": true }, { - "source_path": "docs/framework/common-client-technologies/use-manipulations-and-inertia-in-an-xna-application.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248548(v=vs.100)" + "source_path": "docs/csharp/programming-guide/generics/generics-in-the-net-framework-class-library.md", + "redirect_url": "/dotnet/standard/generics/index" }, { - "source_path": "docs/framework/common-client-technologies/walkthrough-using-client-application-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb546195(v=vs.100)" + "source_path": "docs/csharp/programming-guide/generics/introduction-to-generics.md", + "redirect_url": "/dotnet/standard/generics/index" }, { - "source_path": "docs/framework/configure-apps/file-schema/clear-element-for-configsections.md", - "redirect_url": "/dotnet/framework/configure-apps/file-schema/configuration-sections-schema#dep" + "source_path": "docs/csharp/programming-guide/interop/interoperability.md", + "redirect_url": "/dotnet/csharp/programming-guide/interop/index" }, { - "source_path": "docs/framework/configure-apps/file-schema/remove-element-for-configsections.md", - "redirect_url": "/dotnet/framework/configure-apps/file-schema/configuration-sections-schema#dep" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-create-a-nested-group.md", + "redirect_url": "/dotnet/csharp/linq/create-a-nested-group" }, { - "source_path": "docs/framework/configure-apps/file-schema/wcf/udpannoucementendpoint.md", - "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/udpannouncementendpoint", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-dynamically-specify-predicate-filters-at-runtime.md", + "redirect_url": "/dotnet/csharp/linq/dynamically-specify-predicate-filters-at-runtime" }, { - "source_path": "docs/framework/data/adonet/ef/architecture-and-design.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794151(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-group-query-results.md", + "redirect_url": "/dotnet/csharp/linq/group-query-results" }, { - "source_path": "docs/framework/data/adonet/ef/generating-sql-from-command-trees-best-practices.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794149(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-group-results-by-contiguous-keys.md", + "redirect_url": "/dotnet/csharp/linq/group-results-by-contiguous-keys" }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-handle-exceptions-in-query-expressions.md", + "redirect_url": "/dotnet/csharp/linq/handle-exceptions-in-query-expressions" }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-ssdl-and-msl-specifications.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-handle-null-values-in-query-expressions.md", + "redirect_url": "/dotnet/csharp/linq/handle-null-values-in-query-expressions" }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/msl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/msl-spec" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-join-by-using-composite-keys.md", + "redirect_url": "/dotnet/csharp/linq/join-by-using-composite-keys" }, { - "source_path": "docs/framework/data/adonet/ef/language-reference/ssdl-specification.md", - "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/ssdl-spec" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-order-the-results-of-a-join-clause.md", + "redirect_url": "/dotnet/csharp/linq/order-the-results-of-a-join-clause" }, { - "source_path": "docs/framework/data/adonet/ef/modification-sql-generation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee828422(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-a-subquery-on-a-grouping-operation.md", + "redirect_url": "/dotnet/csharp/linq/perform-a-subquery-on-a-grouping-operation" }, { - "source_path": "docs/framework/data/adonet/ef/provider-manifest-specification.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee828423(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-custom-join-operations.md", + "redirect_url": "/dotnet/csharp/linq/perform-custom-join-operations" }, { - "source_path": "docs/framework/data/adonet/ef/sql-generation-in-the-sample-provider.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794152(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-grouped-joins.md", + "redirect_url": "/dotnet/csharp/linq/perform-grouped-joins" }, { - "source_path": "docs/framework/data/adonet/ef/sql-generation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789836(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-inner-joins.md", + "redirect_url": "/dotnet/csharp/linq/perform-inner-joins" }, { - "source_path": "docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789837(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-perform-left-outer-joins.md", + "redirect_url": "/dotnet/csharp/linq/perform-left-outer-joins" }, { - "source_path": "docs/framework/data/adonet/ef/walkthrough-sql-generation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794148(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-query-a-collection-of-objects.md", + "redirect_url": "/dotnet/csharp/linq/query-a-collection-of-objects" }, { - "source_path": "docs/framework/data/adonet/ef/writing-an-ef-data-provider.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789835(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-return-a-query-from-a-method.md", + "redirect_url": "/dotnet/csharp/linq/return-a-query-from-a-method" }, { - "source_path": "docs/framework/data/adonet/sql/linq/linq-to-sql-with-tightly-coupled-client-server-applications.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb882676(v=vs.100)" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-store-the-results-of-a-query-in-memory.md", + "redirect_url": "/dotnet/csharp/linq/store-the-results-of-a-query-in-memory" }, { - "source_path": "docs/framework/data/wcf/writing-a-windows-store-app-that-consumes-an-odata-service.md", - "redirect_url": "/dotnet/framework/data/wcf/" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/how-to-write-linq-queries.md", + "redirect_url": "/dotnet/csharp/linq/write-linq-queries" }, { - "source_path": "docs/framework/deployment/repair.md", - "redirect_url": "/dotnet/framework/install/repair" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/index.md", + "redirect_url": "/dotnet/csharp/linq/index" }, { - "source_path": "docs/framework/deployment/windows/7.md", - "redirect_url": "/dotnet/framework/install/on-windows-7" + "source_path": "docs/csharp/programming-guide/linq-query-expressions/query-expression-basics.md", + "redirect_url": "/dotnet/csharp/linq/query-expression-basics" }, { - "source_path": "docs/framework/deployment/windows/8.md", - "redirect_url": "/dotnet/framework/install/on-windows-8" + "source_path": "docs/csharp/programming-guide/main-and-command-args/how-to-access-command-line-arguments-using-foreach.md", + "redirect_url": "/dotnet/csharp/programming-guide/arrays/using-foreach-with-arrays" }, { - "source_path": "docs/framework/deployment/windows/10.md", - "redirect_url": "/dotnet/framework/install/on-windows-10" + "source_path": "docs/csharp/programming-guide/main-and-command-args/main-and-command-line-arguments.md", + "redirect_url": "/dotnet/csharp/programming-guide/main-and-command-args/index" }, { - "source_path": "docs/framework/deployment/windows/index.md", - "redirect_url": "/dotnet/framework/install/" + "source_path": "docs/csharp/programming-guide/namespaces/how-to-use-the-global-namespace-alias.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/namespace-alias-qualifier" }, { - "source_path": "docs/framework/deployment/windows/installing-dotnet-35-windows-10.md", - "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + "source_path": "docs/csharp/programming-guide/nullable-types/boxing-nullable-types.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" }, { - "source_path": "docs/framework/deployment/windows/vista.md", - "redirect_url": "/dotnet/framework/install/on-windows-vista" + "source_path": "docs/csharp/programming-guide/nullable-types/how-to-identify-a-nullable-type.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types#how-to-identify-a-nullable-value-type" }, { - "source_path": "docs/framework/deployment/windows/xp.md", - "redirect_url": "/dotnet/framework/install/on-windows-xp" + "source_path": "docs/csharp/programming-guide/nullable-types/how-to-safely-cast-from-bool-to-bool.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" }, { - "source_path": "docs/framework/docker/aspnetmvc.md", - "redirect_url": "https://docs.microsoft.com/aspnet/mvc/overview/deployment/docker-aspnetmvc" + "source_path": "docs/csharp/programming-guide/nullable-types/index.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" }, { - "source_path": "docs/framework/docker/console.md", - "redirect_url": "/dotnet/framework" + "source_path": "docs/csharp/programming-guide/nullable-types/using-nullable-types.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/nullable-value-types" }, { - "source_path": "docs/framework/docker/index.md", - "redirect_url": "/dotnet/framework" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/anonymous-methods.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/delegate-operator" }, { - "source_path": "docs/framework/install/net-framework-3-5-on-windows-8-plus.md", - "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/conversion-operators.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" }, { - "source_path": "docs/framework/interop/applying-interop-attributes.md", - "redirect_url": "/dotnet/standard/native-interop/apply-interop-attributes", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/default-value-expressions.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/default" }, { - "source_path": "docs/framework/interop/com-callable-wrapper.md", - "redirect_url": "/dotnet/standard/native-interop/com-callable-wrapper", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/expressions.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/index" }, { - "source_path": "docs/framework/interop/com-wrappers.md", - "redirect_url": "/dotnet/standard/native-interop/com-wrappers", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-implement-user-defined-conversions-between-structs.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" }, { - "source_path": "docs/framework/interop/qualifying-net-types-for-interoperation.md", - "redirect_url": "/dotnet/standard/native-interop/qualify-net-types-for-interoperation", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-use-lambda-expressions-outside-linq.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" }, { - "source_path": "docs/framework/interop/runtime-callable-wrapper.md", - "redirect_url": "/dotnet/standard/native-interop/runtime-callable-wrapper", - "redirect_document_id": true + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/how-to-use-operator-overloading-to-create-a-complex-number-class.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/operator-overloading" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/lambda-expressions.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/lambda-expressions" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/operators.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/index" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/overloadable-operators.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/operator-overloading#overloadable-operators" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/statements-expressions-operators/using-conversion-operators.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/user-defined-conversion-operators" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/strings/how-to-compare-strings.md", + "redirect_url": "/dotnet/csharp/how-to/compare-strings" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/strings/how-to-concatenate-multiple-strings.md", + "redirect_url": "/dotnet/csharp/how-to/concatenate-multiple-strings" }, { - "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/strings/how-to-convert-a-string-to-a-datetime.md", + "redirect_url": "/dotnet/standard/base-types/parsing-datetime" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-asynchronous-operations.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/csharp/programming-guide/strings/how-to-convert-between-legacy-encondings-and-unicode.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc165448(v=vs.120)" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-dispatcher-operations-in-wpf-apps.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/csharp/programming-guide/strings/how-to-convert-rtf-to-plain-text.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488002(v=vs.120)" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-default-authorizationcontext.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" + "source_path": "docs/csharp/programming-guide/strings/how-to-modify-string-contents.md", + "redirect_url": "/dotnet/csharp/how-to/modify-string-contents" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-eventsource-writeevent-method-calls.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + "source_path": "docs/csharp/programming-guide/strings/how-to-parse-strings-using-string-split.md", + "redirect_url": "/dotnet/csharp/how-to/parse-strings-using-split" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-grid-control.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + "source_path": "docs/csharp/programming-guide/strings/how-to-search-strings-using-regular-expressions.md", + "redirect_url": "/dotnet/csharp/how-to/search-strings" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-horizontal-scrolling-and-virtualization.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.6.1-4.6.2" + "source_path": "docs/csharp/programming-guide/strings/how-to-search-strings-using-string-methods.md", + "redirect_url": "/dotnet/csharp/how-to/search-strings" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-long-path-support.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/csharp/programming-guide/types/how-to-safely-cast-using-as-and-is-operators.md", + "redirect_url": "/dotnet/csharp/how-to/safely-cast-using-pattern-matching-is-and-as-operators" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-memberdescriptor-equals.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-arithmetic-operators" }, { - "source_path": "docs/framework/migration-guide/migration-guide/mitigation-minfreememorypercentagetoactiveservice-configuration-setting.md", - "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-a-member-with-a-pointer.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-member-access-operator--" }, { - "source_path": "docs/framework/migration-guide/minimum-release-dword.md", - "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-access-an-array-element-with-a-pointer.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-element-access-operator-" }, { - "source_path": "docs/framework/migration-guide/mitigation-claimsidentity-constructor.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-increment-and-decrement-pointers.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-increment-and-decrement" }, { - "source_path": "docs/framework/migration-guide/mitigation-cspparameters-parentwindowhandle-expects-an-hwnd.md", - "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-obtain-the-address-of-a-variable.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#address-of-operator-" }, { - "source_path": "docs/framework/migration-guide/net-compatibility-diagnostics.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/how-to-obtain-the-value-of-a-pointer-variable.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-indirection-operator-" }, { - "source_path": "docs/framework/migration-guide/release-keys-and-os-versions.md", - "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/manipulating-pointers.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators" }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/pointer-comparison.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators#pointer-comparison-operators" }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/unsafe-code-pointers/pointer-expressions.md", + "redirect_url": "/dotnet/csharp/language-reference/operators/pointer-related-operators" }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/programming-guide/xmldoc/xml-documentation-comments.md", + "redirect_url": "/dotnet/csharp/programming-guide/xmldoc" }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/arrays-and-collections.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/arrays-and-collections", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/branches-and-loops-local.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/branches-and-loops-local", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/branches-and-loops.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/branches-and-loops" }, { - "source_path": "docs/framework/migration-guide/retargeting/index.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/hello-world.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/hello-world" }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/index.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/interpolated-strings-local.md", + "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings-local", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-1.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/interpolated-strings.md", + "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings" }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-2.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/introduction-to-classes.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/introduction-to-classes", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/list-collection.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/list-collection" }, { - "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-7.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/local-environment.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/local-environment", + "redirect_document_id": true }, { - "source_path": "docs/framework/migration-guide/runtime/index.md", - "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + "source_path": "docs/csharp/quick-starts/numbers-in-csharp-local.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/numbers-in-csharp-local", + "redirect_document_id": true }, { - "source_path": "docs/framework/misc/binding.md", - "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/bindings" + "source_path": "docs/csharp/quick-starts/numbers-in-csharp.md", + "redirect_url": "/dotnet/csharp/tutorials/intro-to-csharp/numbers-in-csharp" }, { - "source_path": "docs/framework/network-programming/httplistener.md", - "redirect_url": "/dotnet/api/system.net.httplistener" + "source_path": "docs/csharp/reference-semantics-with-value-types.md", + "redirect_url": "/dotnet/csharp/write-safe-efficient-code" }, { - "source_path": "docs/framework/security/building-my-first-claims-aware-aspnet-web-app.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/building-my-first-claims-aware-aspnet-web-app" + "source_path": "docs/csharp/reflection.md", + "redirect_url": "/dotnet/framework/reflection-and-codedom" }, { - "source_path": "docs/framework/security/building-my-first-claims-aware-wcf-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/building-my-first-claims-aware-wcf-service" + "source_path": "docs/csharp/roslyn/index.md", + "redirect_url": "/dotnet/csharp/roslyn-sdk/" }, { - "source_path": "docs/framework/security/claims-aware-aspnet-app-forms-authentication.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-aware-aspnet-app-forms-authentication" + "source_path": "docs/csharp/structs.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/struct" }, { - "source_path": "docs/framework/security/claims-based-authorization-using-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-based-authorization-using-wif" + "source_path": "docs/csharp/tour-of-csharp/arrays.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/features#arrays-collections-and-LINQ" }, { - "source_path": "docs/framework/security/claims-based-identity-model.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-based-identity-model" + "source_path": "docs/csharp/tour-of-csharp/attributes.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/features#attributes" }, { - "source_path": "docs/framework/security/custom-token-handlers.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/custom-token-handlers" + "source_path": "docs/csharp/tour-of-csharp/delegates.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/features#delegates-and-lambda-expressions" }, { - "source_path": "docs/framework/security/downloading-the-json-web-token-handler-package.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/downloading-the-json-web-token-handler-package" + "source_path": "docs/csharp/tour-of-csharp/enums.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/enum" }, { - "source_path": "docs/framework/security/downloading-the-validating-issuer-name-registry-package.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/downloading-the-validating-issuer-name-registry-package" + "source_path": "docs/csharp/tour-of-csharp/expressions.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/program-building-blocks#expressions" }, { - "source_path": "docs/framework/security/getting-started-with-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/getting-started-with-wif" + "source_path": "docs/csharp/tour-of-csharp/interfaces.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/types#interfaces" }, { - "source_path": "docs/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5" + "source_path": "docs/csharp/tour-of-csharp/program-structure.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/#program-structure" }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication" + "source_path": "docs/csharp/tour-of-csharp/statements.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/program-building-blocks#statements" }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif" + "source_path": "docs/csharp/tour-of-csharp/structs.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/struct" }, { - "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif" + "source_path": "docs/csharp/tour-of-csharp/types-and-variables.md", + "redirect_url": "/dotnet/csharp/tour-of-csharp/types" }, { - "source_path": "docs/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing" + "source_path": "docs/csharp/tuples.md", + "redirect_url": "/dotnet/csharp/language-reference/builtin-types/value-tuples" }, { - "source_path": "docs/framework/security/how-to-display-signed-in-status-using-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-display-signed-in-status-using-wif" + "source_path": "docs/csharp/tutorials/default-interface-members-versions.md", + "redirect_url": "/dotnet/csharp/tutorials/default-interface-methods-versions" }, { - "source_path": "docs/framework/security/how-to-enable-token-replay-detection.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-token-replay-detection" + "source_path": "docs/csharp/tutorials/exploration/csharp-7.yml", + "redirect_url": "/dotnet/csharp/whats-new/csharp-7" }, { - "source_path": "docs/framework/security/how-to-enable-wif-for-a-wcf-web-service-application.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-wif-for-a-wcf-web-service-application" + "source_path": "docs/csharp/tutorials/intro-to-csharp/interpolated-strings-local.md", + "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings-local" }, { - "source_path": "docs/framework/security/how-to-enable-wif-tracing.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-wif-tracing" + "source_path": "docs/csharp/tutorials/intro-to-csharp/interpolated-strings.yml", + "redirect_url": "/dotnet/csharp/tutorials/exploration/interpolated-strings" }, { - "source_path": "docs/framework/security/how-to-transform-incoming-claims.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-transform-incoming-claims" + "source_path": "docs/csharp/tutorials/microservices.md", + "redirect_url": "/dotnet/core/docker/" }, { - "source_path": "docs/framework/security/identity-and-access-tool-for-vs.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/identity-and-access-tool-for-vs" + "source_path": "docs/csharp/type-system.md", + "redirect_url": "/dotnet/csharp/programming-guide/types/index" }, { - "source_path": "docs/framework/security/index.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/index" + "source_path": "docs/csharp/whats-new.md", + "redirect_url": "/dotnet/csharp/whats-new/csharp-9", + "redirect_document_id": true }, { - "source_path": "docs/framework/security/json-web-token-handler-api-reference.md", - "redirect_url": "https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki" + "source_path": "docs/csharp/whats-new/index.md", + "redirect_url": "/dotnet/csharp/whats-new/csharp-9", + "ms.custom": "updateeachrelease" }, { - "source_path": "docs/framework/security/json-web-token-handler.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/json-web-token-handler" + "source_path": "docs/desktop-wpf/data/index.md", + "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" }, { - "source_path": "docs/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5" + "source_path": "docs/desktop-wpf/fundamentals/index.md", + "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml" }, { - "source_path": "docs/framework/security/secure-coding-guidelines-for-unmanaged-code.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/secure-coding-guidelines-for-unmanaged-code" + "source_path": "docs/desktop-wpf/getting-started/index.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/get-started/csharp/tutorial-wpf?toc=/dotnet/desktop-wpf/toc.json&bc=/dotnet/breadcrumb/toc.json" }, { - "source_path": "docs/framework/security/security-changes.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes" + "source_path": "docs/desktop-wpf/migration/index.md", + "redirect_url": "/dotnet/desktop-wpf/migration/differences-from-net-framework" }, { - "source_path": "docs/framework/security/validating-issuer-name-registry-api-reference.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/validating-issuer-name-registry-api-reference" + "source_path": "docs/desktop-wpf/migration/types-migrated-from-wpf-to-system-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system" }, { - "source_path": "docs/framework/security/validating-issuer-name-registry.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/validating-issuer-name-registry" + "source_path": "docs/framework/add-ins/index.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb384200(v%3dvs.100)" }, { - "source_path": "docs/framework/security/whats-new-in-wif.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/whats-new-in-wif" + "source_path": "docs/framework/add-ins/pipeline-development.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb384201(v%3dvs.100)" }, { - "source_path": "docs/framework/security/wif-and-web-farms.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-and-web-farms" + "source_path": "docs/framework/add-ins/walkthrough-create-extensible-app.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb788290(v%3dvs.100)" }, { - "source_path": "docs/framework/security/wif-api-reference.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-api-reference" + "source_path": "docs/framework/app-domains/assemblies-and-side-by-side-execution.md", + "redirect_url": "/dotnet/standard/assembly/side-by-side-execution" }, { - "source_path": "docs/framework/security/wif-claims-programming-model.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-claims-programming-model" + "source_path": "docs/framework/app-domains/assemblies-in-the-common-language-runtime.md", + "redirect_url": "/dotnet/standard/assembly/index" }, { - "source_path": "docs/framework/security/wif-code-sample-index.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-code-sample-index" + "source_path": "docs/framework/app-domains/assembly-contents.md", + "redirect_url": "/dotnet/standard/assembly/contents" }, { - "source_path": "docs/framework/security/wif-configuration-reference.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-configuration-reference" + "source_path": "docs/framework/app-domains/assembly-location.md", + "redirect_url": "/dotnet/standard/assembly/location" }, { - "source_path": "docs/framework/security/wif-configuration-schema-conventions.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-configuration-schema-conventions" + "source_path": "docs/framework/app-domains/assembly-manifest.md", + "redirect_url": "/dotnet/standard/assembly/manifest" }, { - "source_path": "docs/framework/security/wif-extensions.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-extensions" + "source_path": "docs/framework/app-domains/assembly-names.md", + "redirect_url": "/dotnet/standard/assembly/names" }, { - "source_path": "docs/framework/security/wif-features.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-features" + "source_path": "docs/framework/app-domains/assembly-security-considerations.md", + "redirect_url": "/dotnet/standard/assembly/security-considerations" }, { - "source_path": "docs/framework/security/wif-guidelines.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-guidelines" + "source_path": "docs/framework/app-domains/assembly-versioning.md", + "redirect_url": "/dotnet/standard/assembly/versioning" }, { - "source_path": "docs/framework/security/wif-how-tos-index.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-how-tos-index" + "source_path": "docs/framework/app-domains/create-and-use-strong-named-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/create-use-strong-named" }, { - "source_path": "docs/framework/security/wif-overview.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-overview" + "source_path": "docs/framework/app-domains/create-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/create" }, { - "source_path": "docs/framework/security/wif-session-management.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-session-management" + "source_path": "docs/framework/app-domains/delay-sign-assembly.md", + "redirect_url": "/dotnet/standard/assembly/delay-sign" }, { - "source_path": "docs/framework/security/wsfederation-authentication-module-overview.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wsfederation-authentication-module-overview" + "source_path": "docs/framework/app-domains/enhanced-strong-naming.md", + "redirect_url": "/dotnet/standard/assembly/enhanced-strong-naming" }, { - "source_path": "docs/framework/security/wstrustchannelfactory-and-wstrustchannel.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wstrustchannelfactory-and-wstrustchannel" + "source_path": "docs/framework/app-domains/how-to-build-a-multifile-assembly.md", + "redirect_url": "/framework/app-domains/build-multifile-assembly" }, { - "source_path": "docs/framework/ui-automation/ui-automation-specification-and-community-promise.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb986605(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-build-a-single-file-assembly.md", + "redirect_url": "/framework/app-domains/build-single-file-assembly" }, { - "source_path": "docs/framework/unmanaged-api/cor-prf-allowable-after-attach-bitmask.md", - "redirect_url": "/dotnet/framework/unmanaged-api/profiling/cor-prf-monitor-enumeration" + "source_path": "docs/framework/app-domains/how-to-create-a-public-private-key-pair.md", + "redirect_url": "/dotnet/standard/assembly/create-public-private-key-pair" }, { - "source_path": "docs/framework/wcf/diagnostics/etw/monitoring-service-operation-failures.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff468239(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-determine-assembly-fully-qualified-name.md", + "redirect_url": "/dotnet/standard/assembly/find-fully-qualified-name" }, { - "source_path": "docs/framework/wcf/extending/extending-wcf.md", - "redirect_url": "/dotnet/framework/wcf/extending/index", - "redirect_document_id": true + "source_path": "docs/framework/app-domains/how-to-disable-the-strong-name-bypass-feature.md", + "redirect_url": "/dotnet/standard/assembly/disable-strong-name-bypass-feature" }, { - "source_path": "docs/framework/wcf/feature-details/accessing-identity-information-inside-a-workflow-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff452450(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-install-an-assembly-into-the-gac.md", + "redirect_url": "/dotnet/framework/app-domains/install-assembly-into-gac" }, { - "source_path": "docs/framework/wcf/feature-details/accessing-operationcontext-from-a-workflow-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff452697(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-obtain-type-and-member-information-from-an-assembly.md", + "redirect_url": "/dotnet/framework/reflection-and-codedom/get-type-member-information" }, { - "source_path": "docs/framework/wcf/feature-details/content-based-correlation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee358755(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-reference-a-strong-named-assembly.md", + "redirect_url": "/dotnet/standard/assembly/reference-strong-named" }, { - "source_path": "docs/framework/wcf/feature-details/context-exchange-correlation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee358724(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-sign-an-assembly-with-a-strong-name.md", + "redirect_url": "/dotnet/standard/assembly/sign-strong-name" }, { - "source_path": "docs/framework/wcf/feature-details/how-to-create-a-workflow-service-that-calls-another-workflow-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729672(v=vs.100)" + "source_path": "docs/framework/app-domains/how-to-view-assembly-contents.md", + "redirect_url": "/dotnet/standard/assembly/view-contents" }, { - "source_path": "docs/framework/wcf/feature-details/how-to-host-a-non-service-workflow-in-iis.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729688(v=vs.100)" + "source_path": "docs/framework/app-domains/programming-with-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/index" }, { - "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-client-to-wcf.md", - "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + "source_path": "docs/framework/app-domains/resolve-assembly-loads.md", + "redirect_url": "/dotnet/standard/assembly/resolve-loads" }, { - "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-to-wcf.md", - "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" + "source_path": "docs/framework/app-domains/set-assembly-attributes.md", + "redirect_url": "/dotnet/standard/assembly/set-attributes" }, { - "source_path": "docs/framework/wcf/samples/advanced-error-handling.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667251(v=vs.100)" + "source_path": "docs/framework/app-domains/strong-named-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/strong-named" }, { - "source_path": "docs/framework/wcf/samples/advanced-filters.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667249(v=vs.100)" + "source_path": "docs/framework/app-domains/type-forwarding-in-the-common-language-runtime.md", + "redirect_url": "/dotnet/standard/assembly/type-forwarding" }, { - "source_path": "docs/framework/wcf/samples/advanced-format-selection.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662965(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/client-application-services-overview.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384339(v%3dvs.100)" }, { - "source_path": "docs/framework/wcf/samples/aspnetrouteintegration.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662952(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/client-application-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384297(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/asynchronous-find-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483344(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/creating-the-game1-class.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248547(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/automatic-format-selection.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662964(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/creating-the-gamepiece-class.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248546(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/avoiding-problems-with-the-using-statement.md", - "redirect_url": "/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources", - "redirect_document_id": true + "source_path": "docs/framework/common-client-technologies/creating-the-gamepiececollection-class.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248550(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/basic-resource-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662954(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/full-code-listings.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248551(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/bridging-and-error-handling.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667246(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/how-to-configure-client-application-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384312(v%3dvs.100)" }, { - "source_path": "docs/framework/wcf/samples/bytestream-encoder.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960169(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/how-to-implement-user-login-with-client-application-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384313(v%3dvs.100)" }, { - "source_path": "docs/framework/wcf/samples/conditional-get-and-put.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818665(v=vs.100)" + "source_path": "docs/framework/common-client-technologies/index.md", + "redirect_url": "/dotnet/framework/develop-client-apps" }, { - "source_path": "docs/framework/wcf/samples/configuration-based-activation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807499(v%3dvs.100)" + "source_path": "docs/framework/common-client-technologies/manipulations-and-inertia-overview.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248549(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/custom-demux.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ms752265(v%3dvs.100)" + "source_path": "docs/framework/common-client-technologies/manipulations-and-inertia.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248545(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/customdiscoverymetadata.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764464(v%3dvs.100)" + "source_path": "docs/framework/common-client-technologies/use-manipulations-and-inertia-in-an-xna-application.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee248548(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/discover-a-service-with-unique-listen-uri-mode-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee530015(v%3dvs.100)" + "source_path": "docs/framework/common-client-technologies/walkthrough-using-client-application-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb546195(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/discovery-binding-element-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807387(v%3dvs.100)" + "source_path": "docs/framework/configure-apps/file-schema/clear-element-for-configsections.md", + "redirect_url": "/dotnet/framework/configure-apps/file-schema/configuration-sections-schema#dep" }, { - "source_path": "docs/framework/wcf/samples/discovery-extensibility.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807503(v%3dvs.100)" + "source_path": "docs/framework/configure-apps/file-schema/remove-element-for-configsections.md", + "redirect_url": "/dotnet/framework/configure-apps/file-schema/configuration-sections-schema#dep" }, { - "source_path": "docs/framework/wcf/samples/discovery-proxy-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807497(v%3dvs.100)" + "source_path": "docs/framework/configure-apps/file-schema/wcf/udpannoucementendpoint.md", + "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/udpannouncementendpoint", + "redirect_document_id": true }, { - "source_path": "docs/framework/wcf/samples/dynamic-reconfiguration.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667250(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/architecture-and-design.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794151(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/form-post.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818241(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/generating-sql-from-command-trees-best-practices.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794149(v=vs.100)" }, { - "source_path": "docs/framework/wcf/samples/hierarchical-configuration-model.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663221(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" }, { - "source_path": "docs/framework/wcf/samples/http-acknowledgement-channel.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960152(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/language-reference/csdl-ssdl-and-msl-specifications.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/csdl-spec" }, { - "source_path": "docs/framework/wcf/samples/receivecontext-enabled-wcf-channels.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee534020(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/language-reference/msl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/msl-spec" }, { - "source_path": "docs/framework/wcf/samples/transacted-batching.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/aa395219(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/language-reference/ssdl-specification.md", + "redirect_url": "/ef/ef6/modeling/designer/advanced/edmx/ssdl-spec" }, { - "source_path": "docs/framework/wcf/samples/web-extensibility.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818234(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/modification-sql-generation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee828422(v=vs.100)" }, { - "source_path": "docs/framework/wcf/wcf-system-requirements.md", - "redirect_url": "/dotnet/framework/get-started/system-requirements" + "source_path": "docs/framework/data/adonet/ef/provider-manifest-specification.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee828423(v=vs.100)" }, { - "source_path": "docs/framework/wcf/windows-communication-foundation.md", - "redirect_url": "/dotnet/framework/wcf/index" + "source_path": "docs/framework/data/adonet/ef/sql-generation-in-the-sample-provider.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794152(v=vs.100)" }, { - "source_path": "docs/framework/whats-new/whats-new.md", - "redirect_url": "/dotnet/framework/whats-new/index", - "redirect_document_id": true + "source_path": "docs/framework/data/adonet/ef/sql-generation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789836(v=vs.100)" }, { - "source_path": "docs/framework/windows-workflow-foundation/activity-localization.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee829486(v=vs.100)" + "source_path": "docs/framework/data/adonet/ef/the-shape-of-the-command-trees.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789837(v=vs.100)" }, { - "source_path": "docs/framework/windows-workflow-foundation/determining-workflow-execution-duration-using-tracing.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff462013(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/walkthrough-sql-generation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee794148(v=vs.100)" }, { - "source_path": "docs/framework/windows-workflow-foundation/projects-targeting-dotnet-in-vs.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729671(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/ef/writing-an-ef-data-provider.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee789835(v=vs.100)" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/absolute-delay.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff522352(v%3dvs.100)" + "source_path": "docs/framework/data/adonet/sql/linq/linq-to-sql-with-tightly-coupled-client-server-applications.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb882676(v=vs.100)" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/activity-relationships-validation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622980(v%3dvs.100)" + "source_path": "docs/framework/data/wcf/writing-a-windows-store-app-that-consumes-an-odata-service.md", + "redirect_url": "/dotnet/framework/data/wcf/" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/advanced-policy.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960219(v%3dvs.100)" + "source_path": "docs/framework/deployment/repair.md", + "redirect_url": "/dotnet/framework/install/repair" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/auto-confirm-pattern.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744849(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/7.md", + "redirect_url": "/dotnet/framework/install/on-windows-7" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/basic-activity-composition.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759028(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/8.md", + "redirect_url": "/dotnet/framework/install/on-windows-8" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/basic-transactionscope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807498(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/10.md", + "redirect_url": "/dotnet/framework/install/on-windows-10" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/basic-usage-of-sendparameters-and-receiveparameters-activities.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807376(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/index.md", + "redirect_url": "/dotnet/framework/install/" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/basic-validation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759026(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/installing-dotnet-35-windows-10.md", + "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/basic-xaml-only-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807390(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/vista.md", + "redirect_url": "/dotnet/framework/install/on-windows-vista" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/bookmarks.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744843(v%3dvs.100)" + "source_path": "docs/framework/deployment/windows/xp.md", + "redirect_url": "/dotnet/framework/install/on-windows-xp" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/buffered-receive.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834509(v%3dvs.100)" + "source_path": "docs/framework/docker/aspnetmvc.md", + "redirect_url": "https://docs.microsoft.com/aspnet/mvc/overview/deployment/docker-aspnetmvc" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/built-in-configuration.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622978(v%3dvs.100)" + "source_path": "docs/framework/docker/console.md", + "redirect_url": "/dotnet/framework" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/cancellation-handler-on-compensable-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807518(v%3dvs.100)" + "source_path": "docs/framework/docker/index.md", + "redirect_url": "/dotnet/framework" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/channel-caching-with-send.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834525(v%3dvs.100)" + "source_path": "docs/framework/install/net-framework-3-5-on-windows-8-plus.md", + "redirect_url": "/dotnet/framework/install/dotnet-35-windows-10" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/commentout-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee661651(v%3dvs.100)" + "source_path": "docs/framework/interop/applying-interop-attributes.md", + "redirect_url": "/dotnet/standard/native-interop/apply-interop-attributes", + "redirect_document_id": true }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/compensable-activity-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483327(v%3dvs.100)" + "source_path": "docs/framework/interop/com-callable-wrapper.md", + "redirect_url": "/dotnet/standard/native-interop/com-callable-wrapper", + "redirect_document_id": true }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/compensation-samples.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483320(v%3dvs.100)" + "source_path": "docs/framework/interop/com-wrappers.md", + "redirect_url": "/dotnet/standard/native-interop/com-wrappers", + "redirect_document_id": true }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/composite.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759022(v%3dvs.100)" + "source_path": "docs/framework/interop/qualifying-net-types-for-interoperation.md", + "redirect_url": "/dotnet/standard/native-interop/qualify-net-types-for-interoperation", + "redirect_document_id": true }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/conditioned-activity-group.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960226(v%3dvs.100)" + "source_path": "docs/framework/interop/runtime-callable-wrapper.md", + "redirect_url": "/dotnet/standard/native-interop/runtime-callable-wrapper", + "redirect_document_id": true }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/confirmation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807507(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/constraint-types.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759025(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/content-based-correlation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807508(v%3dvs.100)" - }, + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-5.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" + }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/correlated-calculator.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807391(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/custom-activity-to-switch-on-a-range-of-values.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797581(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/custom-compensation-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483319(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/durable-delay-in-xamlx.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834527(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/application-compatibility-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/durable-delay.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807379(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-asynchronous-operations.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/durable-duplex.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662960(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-culture-and-dispatcher-operations-in-wpf-apps.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/dynamic-arguments.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663219(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-default-authorizationcontext.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.5.2-4.6" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/dynamicactivity-creation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807392(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-eventsource-writeevent-method-calls.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/emulating-breaking-in-a-while-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807393(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-grid-control.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/entity-activities.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622984(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-horizontal-scrolling-and-virtualization.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.6.1-4.6.2" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/execute-a-workflow-in-an-imperative-transactionscope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759027(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-long-path-support.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/execution-properties.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744845(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-memberdescriptor-equals.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/exposing-and-invoking-activityactions.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759023(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/migration-guide/mitigation-minfreememorypercentagetoactiveservice-configuration-setting.md", + "redirect_url": "/dotnet/framework/migration-guide/runtime/4.5-4.5.1" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/expressions.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699761(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/minimum-release-dword.md", + "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/external-activity-validation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663223(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/mitigation-claimsidentity-constructor.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.1-4.6.2" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/extract-wf-data-using-tracking.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662966(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/mitigation-cspparameters-parentwindowhandle-expects-an-hwnd.md", + "redirect_url": "/dotnet/framework/migration-guide/retargeting/4.6.2-4.7" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/for-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd758796(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/net-compatibility-diagnostics.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/formatting-messages-in-workflow-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807506(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/release-keys-and-os-versions.md", + "redirect_url": "/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/getting-started-writing-a-custom-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744847(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/hello-world-custom-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee624142(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/ifelse-with-rules.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960224(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/interop-with-3-5-rule-set.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee829487(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/invokemethod.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622976(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/linq-to-objects-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797580(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting-changes-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/linq-to-sql-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797582(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/retargeting/index.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/metadata-store-programmability.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807501(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/migration.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699764(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-5-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/nesting-of-transactionscope-within-a-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834526(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-1.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/nopersistscope-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807512(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6-2.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/operationscope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662961(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-6.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/order-processing-with-policy.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960217(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime-changes-in-the-net-framework-4-7.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/overloadgroups.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759029(v%3dvs.100)" + "source_path": "docs/framework/migration-guide/runtime/index.md", + "redirect_url": "/dotnet/framework/migration-guide/application-compatibility" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/persistence.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699769(v%3dvs.100)" + "source_path": "docs/framework/misc/binding.md", + "redirect_url": "/dotnet/framework/configure-apps/file-schema/wcf/bindings" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/persisting-a-workflow-application.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807516(v%3dvs.100)" + "source_path": "docs/framework/network-programming/httplistener.md", + "redirect_url": "/dotnet/api/system.net.httplistener" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/policy-activity-in-net-framework-4-5.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797584(v%3dvs.100)" + "source_path": "docs/framework/security/building-my-first-claims-aware-aspnet-web-app.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/building-my-first-claims-aware-aspnet-web-app" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/property-grid-extensibliity.md", - "redirect_url": "/dotnet/framework/windows-workflow-foundation/samples/property-grid-extensibility", - "redirect_document_id": true + "source_path": "docs/framework/security/building-my-first-claims-aware-wcf-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/building-my-first-claims-aware-wcf-service" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/property-promotion-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff642473(v%3dvs.100)" + "source_path": "docs/framework/security/claims-aware-aspnet-app-forms-authentication.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-aware-aspnet-app-forms-authentication" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/rangeenumeration-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797588(v%3dvs.100)" + "source_path": "docs/framework/security/claims-based-authorization-using-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-based-authorization-using-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/regular-expression-activities.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797587(v%3dvs.100)" + "source_path": "docs/framework/security/claims-based-identity-model.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/claims-based-identity-model" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/rules-samples.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960227(v%3dvs.100)" + "source_path": "docs/framework/security/custom-token-handlers.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/custom-token-handlers" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/securing-workflow-services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee943756(v%3dvs.100)" + "source_path": "docs/framework/security/downloading-the-json-web-token-handler-package.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/downloading-the-json-web-token-handler-package" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/sending-and-handling-faults.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807385(v%3dvs.100)" + "source_path": "docs/framework/security/downloading-the-validating-issuer-name-registry-package.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/downloading-the-validating-issuer-name-registry-package" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/services.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699765(v%3dvs.100)" + "source_path": "docs/framework/security/getting-started-with-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/getting-started-with-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/simple-policy.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960218(v%3dvs.100)" + "source_path": "docs/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/guidelines-for-migrating-an-application-built-using-wif-3-5-to-wif-4-5" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/sqlstoreextensibility.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622979(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-app-using-windows-authentication" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/statemachine-scenario-using-a-combination-of-flowchart-and-pick.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807384(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-mvc-web-app-using-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/suppress-transaction-scope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee656552(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-build-claims-aware-aspnet-web-forms-app-using-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/toolbox-service.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834520(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-debug-claims-aware-applications-and-services-using-wif-tracing" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/tracking-using-a-text-file.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667247(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-display-signed-in-status-using-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-display-signed-in-status-using-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/transacted-queues.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee835855(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-enable-token-replay-detection.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-token-replay-detection" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/transaction-convoy-scope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744846(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-enable-wif-for-a-wcf-web-service-application.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-wif-for-a-wcf-web-service-application" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/transaction-rollback.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee656553(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-enable-wif-tracing.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-enable-wif-tracing" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/transactions.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699763(v%3dvs.100)" + "source_path": "docs/framework/security/how-to-transform-incoming-claims.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/how-to-transform-incoming-claims" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/usage-of-the-switch-activity-with-custom-types.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee624141(v%3dvs.100)" + "source_path": "docs/framework/security/identity-and-access-tool-for-vs.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/identity-and-access-tool-for-vs" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/use-of-transactedreceivescope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764465(v%3dvs.100)" + "source_path": "docs/framework/security/index.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/index" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-a-net-3-0-or-net-3-5-activity-in-a-net-4-5-workflow.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807505(v%3dvs.100)" + "source_path": "docs/framework/security/json-web-token-handler-api-reference.md", + "redirect_url": "https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/wiki" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-asyncoperationcontext-in-an-activity-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483304(v%3dvs.100)" + "source_path": "docs/framework/security/json-web-token-handler.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/json-web-token-handler" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-cancellationscope.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807382(v%3dvs.100)" + "source_path": "docs/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/namespace-mapping-between-wif-3-5-and-wif-4-5" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-collection-activities.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807394(v%3dvs.100)" + "source_path": "docs/framework/security/secure-coding-guidelines-for-unmanaged-code.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/secure-coding-guidelines-for-unmanaged-code" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-interop-with-external-data-exchange.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960220(v%3dvs.100)" + "source_path": "docs/framework/security/security-changes.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/security-changes" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-procedural-activities.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807377(v%3dvs.100)" + "source_path": "docs/framework/security/validating-issuer-name-registry-api-reference.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/validating-issuer-name-registry-api-reference" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-invokemethod-activity.md", - "redirect_url": "/dotnet/framework/windows-workflow-foundation/samples/built-in-activities" + "source_path": "docs/framework/security/validating-issuer-name-registry.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/validating-issuer-name-registry" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-invokepowershell-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797586(v%3dvs.100)" + "source_path": "docs/framework/security/whats-new-in-wif.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/whats-new-in-wif" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-workflowinvoker-class.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807496(v%3dvs.100)" + "source_path": "docs/framework/security/wif-and-web-farms.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-and-web-farms" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/using-variables-with-dotnet-ruleset.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807380(v%3dvs.100)" + "source_path": "docs/framework/security/wif-api-reference.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-api-reference" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/validation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622981(v%3dvs.100)" + "source_path": "docs/framework/security/wif-claims-programming-model.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-claims-programming-model" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/wait-for-input-activity.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee620806(v%3dvs.100)" + "source_path": "docs/framework/security/wif-code-sample-index.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-code-sample-index" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/workflow-management-endpoint-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807500(v%3dvs.100)" + "source_path": "docs/framework/security/wif-configuration-reference.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-configuration-reference" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/workflowapplication-readline-host.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764467(v%3dvs.100)" + "source_path": "docs/framework/security/wif-configuration-schema-conventions.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-configuration-schema-conventions" }, { - "source_path": "docs/framework/windows-workflow-foundation/samples/xaml-activation.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960215(v%3dvs.100)" + "source_path": "docs/framework/security/wif-extensions.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-extensions" }, { - "source_path": "docs/framework/windows-workflow-foundation/using-the-interop-activity-in-a-net-framework-4-workflow.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee264174(v%3dvs.100)" + "source_path": "docs/framework/security/wif-features.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-features" }, { - "source_path": "docs/framework/winforms/additional-security-considerations-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/additional-security-considerations-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wif-guidelines.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-guidelines" }, { - "source_path": "docs/framework/winforms/adjusting-the-size-and-scale-of-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/adjusting-the-size-and-scale-of-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wif-how-tos-index.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-how-tos-index" }, { - "source_path": "docs/framework/winforms/advanced/about-gdi-managed-code.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/about-gdi-managed-code?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wif-overview.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-overview" }, { - "source_path": "docs/framework/winforms/advanced/alpha-blending-lines-and-fills.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/alpha-blending-lines-and-fills?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wif-session-management.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wif-session-management" }, { - "source_path": "docs/framework/winforms/advanced/antialiasing-with-lines-and-curves.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/antialiasing-with-lines-and-curves?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wsfederation-authentication-module-overview.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wsfederation-authentication-module-overview" }, { - "source_path": "docs/framework/winforms/advanced/application-settings-architecture.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-architecture?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/security/wstrustchannelfactory-and-wstrustchannel.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/framework/security/wstrustchannelfactory-and-wstrustchannel" }, { - "source_path": "docs/framework/winforms/advanced/application-settings-attributes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-attributes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/ui-automation/ui-automation-specification-and-community-promise.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb986605(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/application-settings-for-custom-controls.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-for-custom-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/unmanaged-api/cor-prf-allowable-after-attach-bitmask.md", + "redirect_url": "/dotnet/framework/unmanaged-api/profiling/cor-prf-monitor-enumeration" }, { - "source_path": "docs/framework/winforms/advanced/application-settings-for-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-for-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/diagnostics/etw/monitoring-service-operation-failures.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff468239(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/application-settings-overview.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/extending/extending-wcf.md", + "redirect_url": "/dotnet/framework/wcf/extending/index", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/advanced/bezier-splines-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/bezier-splines-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/accessing-identity-information-inside-a-workflow-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff452450(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/bi-directional-support-for-windows-forms-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/accessing-operationcontext-from-a-workflow-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff452697(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/brushes-and-filled-shapes-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/brushes-and-filled-shapes-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/content-based-correlation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee358755(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/cardinal-splines-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/cardinal-splines-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/context-exchange-correlation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee358724(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/how-to-create-a-workflow-service-that-calls-another-workflow-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729672(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/constructing-and-drawing-curves.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/constructing-and-drawing-curves?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/how-to-host-a-non-service-workflow-in-iis.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729688(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/constructing-and-drawing-paths.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/constructing-and-drawing-paths?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-client-to-wcf.md", + "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" }, { - "source_path": "docs/framework/winforms/advanced/control-help-using-tooltips.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/control-help-using-tooltips?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/feature-details/migrate-asp-net-web-service-to-wcf.md", + "redirect_url": "/dotnet/framework/wcf/feature-details/adopting-wcf" }, { - "source_path": "docs/framework/winforms/advanced/coordinate-systems-and-transformations.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/coordinate-systems-and-transformations?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/advanced-error-handling.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667251(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/copy--paste-an-elementhost-control-into-forms.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384315(v=vs.100)" + "source_path": "docs/framework/wcf/samples/advanced-filters.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667249(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/cropping-and-scaling-images-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/cropping-and-scaling-images-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/advanced-format-selection.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662965(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/display-of-asian-characters-with-the-imemode-property?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/aspnetrouteintegration.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662952(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/double-buffered-graphics.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/double-buffered-graphics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/asynchronous-find-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483344(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/drag-and-drop-operations-and-clipboard-support.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/drag-and-drop-operations-and-clipboard-support?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/automatic-format-selection.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662964(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/drawing-positioning-and-cloning-images-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/drawing-positioning-and-cloning-images-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/avoiding-problems-with-the-using-statement.md", + "redirect_url": "/dotnet/framework/wcf/samples/use-close-abort-release-wcf-client-resources", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/effects-of-modifying-base-form-appearance?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/basic-resource-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662954(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/ellipses-and-arcs-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/ellipses-and-arcs-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/bridging-and-error-handling.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667246(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/401dkz3c(v=vs.100)" + "source_path": "docs/framework/wcf/samples/bytestream-encoder.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960169(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/getting-started-with-graphics-programming.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/getting-started-with-graphics-programming?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/conditional-get-and-put.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818665(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/global-and-local-transformations.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/global-and-local-transformations?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/configuration-based-activation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807499(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/globalizing-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/globalizing-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/custom-demux.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ms752265(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/graphics-and-drawing-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-and-drawing-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/customdiscoverymetadata.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764464(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/graphics-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/discover-a-service-with-unique-listen-uri-mode-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee530015(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/graphics-paths-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-paths-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/discovery-binding-element-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807387(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/help-systems-in-windows-forms-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/help-systems-in-windows-forms-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/discovery-extensibility.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807503(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-add-data-to-the-clipboard.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-add-data-to-the-clipboard?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/discovery-proxy-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807497(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-add-multiple-sets-of-settings-to-your-application-in-csharp.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-add-multiple-sets-of-settings-to-your-application-in-csharp?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/dynamic-reconfiguration.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667250(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-align-drawn-text.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-align-drawn-text?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/form-post.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818241(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-apply-gamma-correction-to-a-gradient.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-apply-gamma-correction-to-a-gradient?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/hierarchical-configuration-model.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663221(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-arrange-mdi-child-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-arrange-mdi-child-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/http-acknowledgement-channel.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960152(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-capture-user-input-from-a-printdialog-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-capture-user-input-from-a-printdialog-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/receivecontext-enabled-wcf-channels.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee534020(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-change-the-value-of-a-setting-between-application-sessions.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-change-the-value-of-a-setting-between-application-sessions?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/transacted-batching.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/aa395219(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-change-the-value-of-an-existing-setting-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-change-the-value-of-an-existing-setting-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/samples/web-extensibility.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee818234(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-choose-the-printers-attached-to-user-computer-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-choose-the-printers-attached-to-user-computer-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/wcf-system-requirements.md", + "redirect_url": "/dotnet/framework/get-started/system-requirements" }, { - "source_path": "docs/framework/winforms/advanced/how-to-complete-windows-forms-print-jobs.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-complete-windows-forms-print-jobs?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/wcf/windows-communication-foundation.md", + "redirect_url": "/dotnet/framework/wcf/index" }, { - "source_path": "docs/framework/winforms/advanced/how-to-construct-font-families-and-fonts.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-construct-font-families-and-fonts?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/whats-new/whats-new.md", + "redirect_url": "/dotnet/framework/whats-new/index", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/advanced/how-to-convert-a-bmp-image-to-a-png-image.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-convert-a-bmp-image-to-a-png-image?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/activity-localization.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee829486(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/determining-workflow-execution-duration-using-tracing.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff462013(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-copy-pixels-for-reducing-flicker-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-copy-pixels-for-reducing-flicker-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/projects-targeting-dotnet-in-vs.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff729671(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-bitmap-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-bitmap-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/absolute-delay.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff522352(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-linear-gradient.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-linear-gradient?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/activity-relationships-validation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622980(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-new-setting-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-new-setting-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/advanced-policy.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960219(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-path-gradient.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-path-gradient?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/auto-confirm-pattern.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744849(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-pen.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-pen?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/basic-activity-composition.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759028(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-private-font-collection.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-private-font-collection?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/basic-transactionscope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807498(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-shaped-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-shaped-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/basic-usage-of-sendparameters-and-receiveparameters-activities.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807376(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-a-solid-brush.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-solid-brush?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/basic-validation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759026(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-application-settings.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-application-settings?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/basic-xaml-only-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807390(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-figures-from-lines-curves-and-shapes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-figures-from-lines-curves-and-shapes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/bookmarks.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744843(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-graphics-objects-for-drawing.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-graphics-objects-for-drawing?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/buffered-receive.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834509(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-mdi-child-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-mdi-child-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/built-in-configuration.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622978(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-mdi-parent-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-mdi-parent-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/cancellation-handler-on-compensable-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807518(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-standard-windows-forms-print-jobs.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-standard-windows-forms-print-jobs?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/channel-caching-with-send.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834525(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-thumbnail-images.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-thumbnail-images?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/commentout-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee661651(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-create-vertical-text.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-vertical-text?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/compensable-activity-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483327(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-crop-and-scale-images.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-crop-and-scale-images?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/compensation-samples.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483320(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-determine-the-active-mdi-child.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-determine-the-active-mdi-child?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/composite.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759022(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-determine-the-parameters-supported-by-an-encoder.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-determine-the-parameters-supported-by-an-encoder?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/conditioned-activity-group.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960226(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-display-pop-up-help.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-display-pop-up-help?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/confirmation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807507(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-custom-dashed-line.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-custom-dashed-line?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/constraint-types.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759025(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-filled-ellipse-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-filled-ellipse-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/content-based-correlation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807508(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-filled-rectangle-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-filled-rectangle-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/correlated-calculator.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807391(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-filled-with-a-texture.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-filled-with-a-texture?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-activity-to-switch-on-a-range-of-values.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797581(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/custom-compensation-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483319(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-with-line-caps.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-with-line-caps?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/durable-delay-in-xamlx.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834527(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-sequence-of-bezier-splines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-sequence-of-bezier-splines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/durable-delay.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807379(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-a-single-bezier-spline.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-single-bezier-spline?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/durable-duplex.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662960(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-an-existing-bitmap-to-the-screen.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-an-existing-bitmap-to-the-screen?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/dynamic-arguments.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663219(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-an-outlined-shape.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-an-outlined-shape?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/dynamicactivity-creation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807392(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-cardinal-splines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-cardinal-splines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/emulating-breaking-in-a-while-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807393(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-opaque-and-semitransparent-lines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-opaque-and-semitransparent-lines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/entity-activities.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622984(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-text-at-a-specified-location.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-at-a-specified-location?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/execute-a-workflow-in-an-imperative-transactionscope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759027(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-text-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/execution-properties.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744845(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-text-with-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-with-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/exposing-and-invoking-activityactions.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759023(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-vertical-text-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-vertical-text-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/expressions.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699761(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-with-opaque-and-semitransparent-brushes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-with-opaque-and-semitransparent-brushes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/external-activity-validation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee663223(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-draw-wrapped-text-in-a-rectangle.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-wrapped-text-in-a-rectangle?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/extract-wf-data-using-tracking.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662966(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-enumerate-installed-fonts.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-enumerate-installed-fonts?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/for-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd758796(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-extract-the-icon-associated-with-a-file-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-extract-the-icon-associated-with-a-file-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/formatting-messages-in-workflow-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807506(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-a-hatch-pattern.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-a-hatch-pattern?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/getting-started-writing-a-custom-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744847(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-a-solid-color.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-a-solid-color?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/hello-world-custom-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee624142(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-an-image-texture.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-an-image-texture?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/ifelse-with-rules.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960224(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-fill-open-figures.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-open-figures?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/interop-with-3-5-rule-set.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee829487(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-flatten-a-curved-path-into-a-line.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-flatten-a-curved-path-into-a-line?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/invokemethod.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622976(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-improve-performance-by-avoiding-automatic-scaling.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-improve-performance-by-avoiding-automatic-scaling?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/linq-to-objects-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797580(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/linq-to-sql-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797582(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-inherit-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-inherit-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/metadata-store-programmability.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807501(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-join-lines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-join-lines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/migration.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699764(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-list-installed-decoders.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-list-installed-decoders?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/nesting-of-transactionscope-within-a-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834526(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-list-installed-encoders.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-list-installed-encoders?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/nopersistscope-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807512(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-load-and-display-metafiles.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-load-and-display-metafiles?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/operationscope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee662961(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-manually-manage-buffered-graphics.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-manually-manage-buffered-graphics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/order-processing-with-policy.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960217(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-manually-render-buffered-graphics.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-manually-render-buffered-graphics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/overloadgroups.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd759029(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-obtain-font-metrics.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-obtain-font-metrics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/persistence.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699769(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-perform-drag-and-drop-operations-between-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-perform-drag-and-drop-operations-between-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/persisting-a-workflow-application.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807516(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/policy-activity-in-net-framework-4-5.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797584(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-print-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/property-grid-extensibliity.md", + "redirect_url": "/dotnet/framework/windows-workflow-foundation/samples/property-grid-extensibility", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/advanced/how-to-print-graphics-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-graphics-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/property-promotion-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ff642473(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-print-in-windows-forms-using-print-preview.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-in-windows-forms-using-print-preview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/rangeenumeration-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797588(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-provide-help-in-a-windows-application.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-provide-help-in-a-windows-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/regular-expression-activities.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797587(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-read-image-metadata.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-read-image-metadata?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/rules-samples.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960227(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-read-settings-at-run-time-with-csharp.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-read-settings-at-run-time-with-csharp?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/securing-workflow-services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee943756(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-reduce-graphics-flicker-with-double-buffering-for-forms-and-controls.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-reduce-graphics-flicker-with-double-buffering-for-forms-and-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/sending-and-handling-faults.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807385(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-render-images-with-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-render-images-with-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/services.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699765(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-retrieve-data-from-the-clipboard.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-retrieve-data-from-the-clipboard?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/simple-policy.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960218(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-rotate-colors.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-rotate-colors?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/sqlstoreextensibility.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622979(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-rotate-reflect-and-skew-images.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-rotate-reflect-and-skew-images?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/statemachine-scenario-using-a-combination-of-flowchart-and-pick.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807384(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-send-data-to-the-active-mdi-child.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-send-data-to-the-active-mdi-child?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/suppress-transaction-scope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee656552(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-set-jpeg-compression-level.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-jpeg-compression-level?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/toolbox-service.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee834520(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-set-pen-width-and-alignment.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-pen-width-and-alignment?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/tracking-using-a-text-file.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee667247(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-set-tab-stops-in-drawn-text.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-tab-stops-in-drawn-text?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/transacted-queues.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee835855(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-set-the-color-of-a-pen.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-the-color-of-a-pen?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/transaction-convoy-scope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd744846(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-shear-colors.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-shear-colors?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/transaction-rollback.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee656553(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/transactions.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd699763(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-tile-a-shape-with-an-image.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-tile-a-shape-with-an-image?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/usage-of-the-switch-activity-with-custom-types.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee624141(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-translate-image-colors.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-translate-image-colors?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/use-of-transactedreceivescope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764465(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-matrix-to-set-alpha-values-in-images.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-matrix-to-set-alpha-values-in-images?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-a-net-3-0-or-net-3-5-activity-in-a-net-4-5-workflow.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807505(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-matrix-to-transform-a-single-color.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-matrix-to-transform-a-single-color?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-asyncoperationcontext-in-an-activity-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd483304(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-remap-table.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-remap-table?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-cancellationscope.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807382(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-a-pen-to-draw-lines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-pen-to-draw-lines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-collection-activities.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807394(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-a-pen-to-draw-rectangles.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-pen-to-draw-rectangles?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-interop-with-external-data-exchange.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960220(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-antialiasing-with-text.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-antialiasing-with-text?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-procedural-activities.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807377(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-clipping-with-a-region.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-clipping-with-a-region?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-invokemethod-activity.md", + "redirect_url": "/dotnet/framework/windows-workflow-foundation/samples/built-in-activities" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-compositing-mode-to-control-alpha-blending.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-compositing-mode-to-control-alpha-blending?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-invokepowershell-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd797586(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-hit-testing-with-a-region.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-hit-testing-with-a-region?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-the-workflowinvoker-class.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807496(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-interpolation-mode-to-control-image-quality-during-scaling.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-interpolation-mode-to-control-image-quality-during-scaling?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/using-variables-with-dotnet-ruleset.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807380(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-use-the-modifiers-and-generatemember-properties.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-the-modifiers-and-generatemember-properties?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/validation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee622981(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-validate-application-settings.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-validate-application-settings?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/wait-for-input-activity.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee620806(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/how-to-write-user-settings-at-run-time-with-csharp.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-write-user-settings-at-run-time-with-csharp?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/workflow-management-endpoint-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd807500(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/images-bitmaps-and-metafiles.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/images-bitmaps-and-metafiles?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/workflowapplication-readline-host.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/dd764467(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/index.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/index?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/samples/xaml-activation.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee960215(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/integrating-user-help-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/integrating-user-help-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/windows-workflow-foundation/using-the-interop-activity-in-a-net-framework-4-workflow.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/ee264174(v%3dvs.100)" }, { - "source_path": "docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/international-fonts-in-windows-forms-and-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/additional-security-considerations-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/additional-security-considerations-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/lines-curves-and-shapes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/lines-curves-and-shapes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/adjusting-the-size-and-scale-of-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/adjusting-the-size-and-scale-of-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/managing-the-state-of-a-graphics-object.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/managing-the-state-of-a-graphics-object?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/about-gdi-managed-code.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/about-gdi-managed-code?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/matrix-representation-of-transformations.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/matrix-representation-of-transformations?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/alpha-blending-lines-and-fills.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/alpha-blending-lines-and-fills?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/metafiles-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/metafiles-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/antialiasing-with-lines-and-curves.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/antialiasing-with-lines-and-curves?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/multiple-document-interface-mdi-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/multiple-document-interface-mdi-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/application-settings-architecture.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-architecture?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/networking-in-windows-forms-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/networking-in-windows-forms-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/application-settings-attributes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-attributes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/open-and-closed-curves-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/open-and-closed-curves-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/application-settings-for-custom-controls.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-for-custom-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/overview-of-graphics.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/overview-of-graphics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/application-settings-for-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-for-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/pens-lines-and-rectangles-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/pens-lines-and-rectangles-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/application-settings-overview.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/application-settings-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/polygons-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/polygons-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/bezier-splines-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/bezier-splines-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/power-management-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/power-management-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/bi-directional-support-for-windows-forms-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/bi-directional-support-for-windows-forms-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/properties-on-windows-forms-controls-that-support-accessibility-guidelines.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/properties-on-windows-forms-controls-that-support-accessibility-guidelines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/brushes-and-filled-shapes-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/brushes-and-filled-shapes-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/recoloring-images.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/recoloring-images?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/cardinal-splines-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/cardinal-splines-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/regions-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/regions-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/com-interop-by-displaying-a-windows-form-shadow?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/restricting-the-drawing-surface-in-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/restricting-the-drawing-surface-in-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/constructing-and-drawing-curves.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/constructing-and-drawing-curves?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/structure-of-the-graphics-interface.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/structure-of-the-graphics-interface?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/constructing-and-drawing-paths.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/constructing-and-drawing-paths?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/system-information-and-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/system-information-and-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/control-help-using-tooltips.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/control-help-using-tooltips?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/three-categories-of-graphics-services.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/three-categories-of-graphics-services?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/coordinate-systems-and-transformations.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/coordinate-systems-and-transformations?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/types-of-bitmaps.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/types-of-bitmaps?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/copy--paste-an-elementhost-control-into-forms.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384315(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/types-of-coordinate-systems.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/types-of-coordinate-systems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/cropping-and-scaling-images-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/cropping-and-scaling-images-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-a-brush-to-fill-shapes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-brush-to-fill-shapes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/display-of-asian-characters-with-the-imemode-property.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/display-of-asian-characters-with-the-imemode-property?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-a-gradient-brush-to-fill-shapes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-gradient-brush-to-fill-shapes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/double-buffered-graphics.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/double-buffered-graphics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-a-pen-to-draw-lines-and-shapes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-pen-to-draw-lines-and-shapes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/drag-and-drop-operations-and-clipboard-support.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/drag-and-drop-operations-and-clipboard-support?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-application-settings-and-user-settings.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-application-settings-and-user-settings?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/drawing-positioning-and-cloning-images-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/drawing-positioning-and-cloning-images-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-double-buffering.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-double-buffering?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/effects-of-modifying-base-form-appearance.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/effects-of-modifying-base-form-appearance?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-fonts-and-text.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-fonts-and-text?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/ellipses-and-arcs-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/ellipses-and-arcs-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-graphics-containers.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-graphics-containers?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/encoding-and-windows-forms-globalization.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/401dkz3c(v=vs.100)" }, { - "source_path": "docs/framework/winforms/advanced/using-image-encoders-and-decoders-in-managed-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-image-encoders-and-decoders-in-managed-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/getting-started-with-graphics-programming.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/getting-started-with-graphics-programming?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-managed-graphics-classes.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-managed-graphics-classes?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/global-and-local-transformations.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/global-and-local-transformations?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-nested-graphics-containers.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-nested-graphics-containers?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/globalizing-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/globalizing-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-regions.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-regions?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/graphics-and-drawing-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-and-drawing-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-the-world-transformation.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-the-world-transformation?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/graphics-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-transformations-in-managed-gdi.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-transformations-in-managed-gdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/graphics-paths-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/graphics-paths-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-transformations-to-scale-colors.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-transformations-to-scale-colors?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/help-systems-in-windows-forms-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/help-systems-in-windows-forms-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/using-wpf-controls.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/using-wpf-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-add-data-to-the-clipboard.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-add-data-to-the-clipboard?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/vector-graphics-overview.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/vector-graphics-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-add-multiple-sets-of-settings-to-your-application-in-csharp.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-add-multiple-sets-of-settings-to-your-application-in-csharp?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-align-drawn-text.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-align-drawn-text?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-apply-gamma-correction-to-a-gradient.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-apply-gamma-correction-to-a-gradient?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-changing-properties-of-a-hosted-wpf-element-at-design-time.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384330(v=vs.100)" + "source_path": "docs/framework/winforms/advanced/how-to-arrange-mdi-child-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-arrange-mdi-child-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-capture-user-input-from-a-printdialog-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-capture-user-input-from-a-printdialog-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-change-the-value-of-a-setting-between-application-sessions.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-change-the-value-of-a-setting-between-application-sessions?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-demonstrating-visual-inheritance.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-demonstrating-visual-inheritance?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-change-the-value-of-an-existing-setting-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-change-the-value-of-an-existing-setting-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-performing-a-drag-and-drop-operation-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-performing-a-drag-and-drop-operation-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-choose-the-printers-attached-to-user-computer-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-choose-the-printers-attached-to-user-computer-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-styling-wpf-content?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-complete-windows-forms-print-jobs.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-complete-windows-forms-print-jobs?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/why-transformation-order-is-significant.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/why-transformation-order-is-significant?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-construct-font-families-and-fonts.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-construct-font-families-and-fonts?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/windows-forms-accessibility.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-accessibility?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-convert-a-bmp-image-to-a-png-image.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-convert-a-bmp-image-to-a-png-image?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-and-unmanaged-applications-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-copy-and-paste-an-elementhost-control-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-and-unmanaged-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-copy-pixels-for-reducing-flicker-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-copy-pixels-for-reducing-flicker-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/windows-forms-print-support.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-print-support?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-bitmap-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-bitmap-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/windows-forms-visual-inheritance.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-visual-inheritance?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-linear-gradient.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-linear-gradient?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/advanced/working-with-images-bitmaps-icons-and-metafiles.md", - "redirect_url": "/dotnet/desktop/winforms/advanced/working-with-images-bitmaps-icons-and-metafiles?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-new-setting-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-new-setting-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/automatic-scaling-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/automatic-scaling-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-path-gradient.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-path-gradient?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/change-notification-in-windows-forms-data-binding.md", - "redirect_url": "/dotnet/desktop/winforms/change-notification-in-windows-forms-data-binding?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-pen.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-pen?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/changing-the-appearance-of-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/changing-the-appearance-of-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-private-font-collection.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-private-font-collection?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/clickonce-deployment-for-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/clickonce-deployment-for-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-a-shaped-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-shaped-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/99f6e876-3f7f-4139-9063-e36587c95b02.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-a-master-detail-form-using-two-datagridviews", - "redirect_document_id": true + "source_path": "docs/framework/winforms/advanced/how-to-create-a-solid-brush.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-a-solid-brush?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/access-objects-in-a-wf-datagridviewcomboboxcell-drop-down-list.md", - "redirect_url": "/dotnet/desktop/winforms/controls/access-objects-in-a-wf-datagridviewcomboboxcell-drop-down-list?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-application-settings.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-application-settings?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/access-specific-items-in-a-wf-combobox-listbox-or-checkedlistbox.md", - "redirect_url": "/dotnet/desktop/winforms/controls/access-specific-items-in-a-wf-combobox-listbox-or-checkedlistbox?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-figures-from-lines-curves-and-shapes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-figures-from-lines-curves-and-shapes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/accessing-frames-in-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/accessing-frames-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-graphics-objects-for-drawing.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-graphics-objects-for-drawing?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/accessing-unexposed-members-on-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/accessing-unexposed-members-on-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-mdi-child-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-mdi-child-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-columns-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-mdi-parent-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-mdi-parent-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-items-from-a-wf-combobox.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-items-from-a-wf-combobox?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-standard-windows-forms-print-jobs.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-standard-windows-forms-print-jobs?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-items-with-wf-listview-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-items-with-wf-listview-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-thumbnail-images.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-thumbnail-images?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-menu-items-with-wf-contextmenu-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-menu-items-with-wf-contextmenu-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-create-vertical-text.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-create-vertical-text?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-nodes-with-wf-treeview-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-nodes-with-wf-treeview-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-crop-and-scale-images.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-crop-and-scale-images?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-and-remove-tabs-with-wf-tabcontrol-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-tabs-with-wf-tabcontrol-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-determine-the-active-mdi-child.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-determine-the-active-mdi-child?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-determine-the-parameters-supported-by-an-encoder.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-determine-the-parameters-supported-by-an-encoder?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-display-pop-up-help.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-display-pop-up-help?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/add-tooltips-to-individual-cells-in-a-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/add-tooltips-to-individual-cells-in-a-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-custom-dashed-line.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-custom-dashed-line?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/app-icons-to-the-taskbar-with-wf-notifyicon.md", - "redirect_url": "/dotnet/desktop/winforms/controls/app-icons-to-the-taskbar-with-wf-notifyicon?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-filled-ellipse-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-filled-ellipse-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/arranging-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-filled-rectangle-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-filled-rectangle-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/attributes-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/attributes-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-filled-with-a-texture.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-filled-with-a-texture?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/autogenerate-columns-in-a-data-bound-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/autogenerate-columns-in-a-data-bound-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/automatically-resize-cells-when-content-changes-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/automatically-resize-cells-when-content-changes-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-line-with-line-caps.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-line-with-line-caps?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/autosize-behavior-in-the-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/autosize-behavior-in-the-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-sequence-of-bezier-splines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-sequence-of-bezier-splines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/autosize-property-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/autosize-property-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-a-single-bezier-spline.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-a-single-bezier-spline?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/backgroundworker-component-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/backgroundworker-component-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-an-existing-bitmap-to-the-screen.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-an-existing-bitmap-to-the-screen?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/backgroundworker-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/backgroundworker-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-an-outlined-shape.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-an-outlined-shape?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/basic-column-row-and-cell-features-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/basic-column-row-and-cell-features-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-cardinal-splines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-cardinal-splines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/basic-formatting-and-styling-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/basic-formatting-and-styling-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-opaque-and-semitransparent-lines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-opaque-and-semitransparent-lines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-text-at-a-specified-location.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-at-a-specified-location?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/best-practices-for-the-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/best-practices-for-the-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-text-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bind-data-to-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-text-with-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-text-with-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bind-wf-controls-with-the-bindingsource?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-vertical-text-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-vertical-text-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-with-opaque-and-semitransparent-brushes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-with-opaque-and-semitransparent-brushes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bindingnavigator-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bindingnavigator-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-draw-wrapped-text-in-a-rectangle.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-draw-wrapped-text-in-a-rectangle?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bindingnavigator-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bindingnavigator-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-enumerate-installed-fonts.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-enumerate-installed-fonts?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bindingsource-component-architecture.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component-architecture?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-extract-the-icon-associated-with-a-file-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-extract-the-icon-associated-with-a-file-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bindingsource-component-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-a-hatch-pattern.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-a-hatch-pattern?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/bindingsource-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-a-solid-color.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-a-solid-color?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/button-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/button-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-fill-a-shape-with-an-image-texture.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-a-shape-with-an-image-texture?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/button-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/button-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-fill-open-figures.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-fill-open-figures?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/c5fa29e8-47f7-4691-829b-0e697a691f36.md", - "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-master-detail-form-using-two-datagridviews", - "redirect_document_id": true + "source_path": "docs/framework/winforms/advanced/how-to-flatten-a-curved-path-into-a-line.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-flatten-a-curved-path-into-a-line?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-improve-performance-by-avoiding-automatic-scaling.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-improve-performance-by-avoiding-automatic-scaling?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-inherit-forms-using-the-inheritance-picker-dialog-box?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/change-the-border-and-gridline-styles-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/change-the-border-and-gridline-styles-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-inherit-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-inherit-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/change-the-order-of-columns-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/change-the-order-of-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-join-lines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-join-lines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/change-the-type-of-a-wf-datagridview-column-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/change-the-type-of-a-wf-datagridview-column-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-list-installed-decoders.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-list-installed-decoders?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/checkbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/checkbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-list-installed-encoders.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-list-installed-encoders?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/checkbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/checkbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-load-and-display-metafiles.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-load-and-display-metafiles?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/checkedlistbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/checkedlistbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-manually-manage-buffered-graphics.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-manually-manage-buffered-graphics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/checkedlistbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/checkedlistbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-manually-render-buffered-graphics.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-manually-render-buffered-graphics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/colordialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/colordialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-obtain-font-metrics.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-obtain-font-metrics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/colordialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/colordialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-perform-drag-and-drop-operations-between-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-perform-drag-and-drop-operations-between-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/column-fill-mode-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/column-fill-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-a-multi-page-text-file-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/column-sort-modes-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/column-sort-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-print-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/column-types-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/column-types-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-print-graphics-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-graphics-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/combobox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/combobox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-print-in-windows-forms-using-print-preview.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-print-in-windows-forms-using-print-preview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/combobox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/combobox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-provide-help-in-a-windows-application.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-provide-help-in-a-windows-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-read-image-metadata.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-read-image-metadata?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/constituent-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/constituent-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-read-settings-at-run-time-with-csharp.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-read-settings-at-run-time-with-csharp?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/contextmenu-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/contextmenu-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-reduce-graphics-flicker-with-double-buffering-for-forms-and-controls.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-reduce-graphics-flicker-with-double-buffering-for-forms-and-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/contextmenu-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/contextmenu-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-render-images-with-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-render-images-with-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/contextmenustrip-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/contextmenustrip-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-retrieve-data-from-the-clipboard.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-retrieve-data-from-the-clipboard?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/contextmenustrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/contextmenustrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-rotate-colors.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-rotate-colors?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/control-type-recommendations.md", - "redirect_url": "/dotnet/desktop/winforms/controls/control-type-recommendations?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-rotate-reflect-and-skew-images.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-rotate-reflect-and-skew-images?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/controls-to-use-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/controls-to-use-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-send-data-to-the-active-mdi-child.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-send-data-to-the-active-mdi-child?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/controls-with-built-in-owner-drawing-support.md", - "redirect_url": "/dotnet/desktop/winforms/controls/controls-with-built-in-owner-drawing-support?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-set-jpeg-compression-level.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-jpeg-compression-level?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-a-basic-wf-toolstrip-with-standard-items-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-a-basic-wf-toolstrip-with-standard-items-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-set-pen-width-and-alignment.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-pen-width-and-alignment?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-set-tab-stops-in-drawn-text.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-tab-stops-in-drawn-text?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-a-master-detail-form-using-two-datagridviews?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-set-the-color-of-a-pen.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-set-the-color-of-a-pen?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-a-multipane-user-interface-with-wf-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-a-multipane-user-interface-with-wf-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-shear-colors.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-shear-colors?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-and-set-a-custom-renderer-for-the-toolstrip-control-in-wf.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-and-set-a-custom-renderer-for-the-toolstrip-control-in-wf?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-support-com-interop-by-displaying-each-windows-form-on-its-own-thread?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-tile-a-shape-with-an-image.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-tile-a-shape-with-an-image?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md", - "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-master-detail-form-using-two-datagridviews?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-translate-image-colors.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-translate-image-colors?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/creating-a-wf-control-design-time-features.md", - "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-wf-control-design-time-features?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-matrix-to-set-alpha-values-in-images.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-matrix-to-set-alpha-values-in-images?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/creating-an-explorer-style-interface-with-the-listview-and-treeview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/creating-an-explorer-style-interface-with-the-listview-and-treeview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-matrix-to-transform-a-single-color.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-matrix-to-transform-a-single-color?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/custom-control-painting-and-rendering.md", - "redirect_url": "/dotnet/desktop/winforms/controls/custom-control-painting-and-rendering?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-a-color-remap-table.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-color-remap-table?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/customize-cells-and-columns-in-the-datagrid-by-extending-behavior.md", - "redirect_url": "/dotnet/desktop/winforms/controls/customize-cells-and-columns-in-the-datagrid-by-extending-behavior?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-a-pen-to-draw-lines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-pen-to-draw-lines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/customize-the-appearance-of-cells-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/customize-the-appearance-of-cells-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-a-pen-to-draw-rectangles.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-a-pen-to-draw-rectangles?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/customize-the-appearance-of-rows-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/customize-the-appearance-of-rows-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-antialiasing-with-text.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-antialiasing-with-text?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/customizing-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/customizing-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-clipping-with-a-region.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-clipping-with-a-region?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/data-display-modes-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/data-display-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-compositing-mode-to-control-alpha-blending.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-compositing-mode-to-control-alpha-blending?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/data-entry-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/data-entry-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-hit-testing-with-a-region.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-hit-testing-with-a-region?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-interpolation-mode-to-control-image-quality-during-scaling.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-interpolation-mode-to-control-image-quality-during-scaling?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagrid-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagrid-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-use-the-modifiers-and-generatemember-properties.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-use-the-modifiers-and-generatemember-properties?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagrid-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagrid-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-validate-application-settings.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-validate-application-settings?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-architecture-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-architecture-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/how-to-write-user-settings-at-run-time-with-csharp.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/how-to-write-user-settings-at-run-time-with-csharp?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-code-directory-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-code-directory-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/images-bitmaps-and-metafiles.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/images-bitmaps-and-metafiles?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/index.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/index?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-scenarios-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-scenarios-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/integrating-user-help-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/integrating-user-help-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-technology-summary-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/international-fonts-in-windows-forms-and-controls.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/international-fonts-in-windows-forms-and-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datagridview-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/lines-curves-and-shapes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/lines-curves-and-shapes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datetimepicker-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datetimepicker-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/managing-the-state-of-a-graphics-object.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/managing-the-state-of-a-graphics-object?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/datetimepicker-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/datetimepicker-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/matrix-representation-of-transformations.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/matrix-representation-of-transformations?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/default-cell-styles-datagridview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/default-cell-styles-datagridview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/metafiles-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/metafiles-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/default-functionality-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/default-functionality-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/multiple-document-interface-mdi-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/multiple-document-interface-mdi-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/default-keyboard-and-mouse-handling-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/default-keyboard-and-mouse-handling-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/networking-in-windows-forms-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/networking-in-windows-forms-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/defining-a-property-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/open-and-closed-curves-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/open-and-closed-curves-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/defining-an-event-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/overview-of-graphics.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/overview-of-graphics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/defining-default-values-with-the-shouldserialize-and-reset-methods.md", - "redirect_url": "/dotnet/desktop/winforms/controls/defining-default-values-with-the-shouldserialize-and-reset-methods?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/pens-lines-and-rectangles-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/pens-lines-and-rectangles-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/design-time-errors-in-the-windows-forms-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/polygons-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/polygons-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/designate-a-wf-button-as-the-accept-button-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/designate-a-wf-button-as-the-accept-button-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/power-management-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/power-management-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/designate-a-wf-button-as-the-cancel-button-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/designate-a-wf-button-as-the-cancel-button-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/properties-on-windows-forms-controls-that-support-accessibility-guidelines.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/properties-on-windows-forms-controls-that-support-accessibility-guidelines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/determine-when-formatting-attributes-change-wf-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/determine-when-formatting-attributes-change-wf-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/recoloring-images.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/recoloring-images?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/determine-which-panel-wf-statusbar-control-was-clicked.md", - "redirect_url": "/dotnet/desktop/winforms/controls/determine-which-panel-wf-statusbar-control-was-clicked?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/regions-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/regions-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/developing-a-composite-windows-forms-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/developing-a-composite-windows-forms-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/restricting-the-drawing-surface-in-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/restricting-the-drawing-surface-in-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/developing-custom-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/developing-custom-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/structure-of-the-graphics-interface.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/structure-of-the-graphics-interface?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/developing-windows-forms-controls-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/system-information-and-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/system-information-and-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/dialog-box-controls-and-components-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/dialog-box-controls-and-components-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/three-categories-of-graphics-services.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/three-categories-of-graphics-services?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/differences-between-the-windows-forms-datagridview-and-datagrid-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/differences-between-the-windows-forms-datagridview-and-datagrid-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/types-of-bitmaps.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/types-of-bitmaps?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/types-of-coordinate-systems.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/types-of-coordinate-systems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/display-a-date-in-a-custom-format-with-wf-datetimepicker-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/display-a-date-in-a-custom-format-with-wf-datetimepicker-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-a-brush-to-fill-shapes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-brush-to-fill-shapes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/display-a-web-page-from-a-wf-linklabel-control-visual-basic.md", - "redirect_url": "/dotnet/desktop/winforms/controls/display-a-web-page-from-a-wf-linklabel-control-visual-basic?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-a-gradient-brush-to-fill-shapes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-gradient-brush-to-fill-shapes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/display-error-icons-for-form-validation-with-wf-errorprovider.md", - "redirect_url": "/dotnet/desktop/winforms/controls/display-error-icons-for-form-validation-with-wf-errorprovider?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-a-pen-to-draw-lines-and-shapes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-a-pen-to-draw-lines-and-shapes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/display-more-than-one-month-wf-monthcalendar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/display-more-than-one-month-wf-monthcalendar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-application-settings-and-user-settings.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-application-settings-and-user-settings?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/display-specific-days-in-bold-with-wf-monthcalendar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/display-specific-days-in-bold-with-wf-monthcalendar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-double-buffering.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-double-buffering?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/displaying-data-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/displaying-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-fonts-and-text.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-fonts-and-text?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/domainupdown-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/domainupdown-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-graphics-containers.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-graphics-containers?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/domainupdown-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/domainupdown-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-image-encoders-and-decoders-in-managed-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-image-encoders-and-decoders-in-managed-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/enable-column-reordering-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/enable-column-reordering-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-managed-graphics-classes.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-managed-graphics-classes?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/enable-drag-and-drop-operations-with-wf-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/enable-drag-and-drop-operations-with-wf-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-nested-graphics-containers.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-nested-graphics-containers?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/enable-tile-view-in-a-wf-listview-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/enable-tile-view-in-a-wf-listview-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-regions.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-regions?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/enable-users-to-copy-multiple-cells-to-the-clipboard-datagridview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/enable-users-to-copy-multiple-cells-to-the-clipboard-datagridview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-the-world-transformation.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-the-world-transformation?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/errorprovider-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/errorprovider-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-transformations-in-managed-gdi.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-transformations-in-managed-gdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/errorprovider-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/errorprovider-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-transformations-to-scale-colors.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-transformations-to-scale-colors?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/events-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/events-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/using-wpf-controls.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/using-wpf-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/filedialog-class.md", - "redirect_url": "/dotnet/desktop/winforms/controls/filedialog-class?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/vector-graphics-overview.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/vector-graphics-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/flowlayoutpanel-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/flowlayoutpanel-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-arranging-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/flowlayoutpanel-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/flowlayoutpanel-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-assigning-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/folderbrowserdialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/folderbrowserdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-changing-properties-of-a-hosted-wpf-element-at-design-time.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb384330(v=vs.100)" }, { - "source_path": "docs/framework/winforms/controls/folderbrowserdialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/folderbrowserdialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-creating-an-accessible-windows-based-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/fontdialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/fontdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-creating-new-wpf-content-on-windows-forms-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/fontdialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/fontdialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-demonstrating-visual-inheritance.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-demonstrating-visual-inheritance?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-performing-a-drag-and-drop-operation-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-performing-a-drag-and-drop-operation-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/get-and-set-the-current-cell-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/get-and-set-the-current-cell-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/walkthrough-styling-wpf-content.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/walkthrough-styling-wpf-content?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/group-controls-with-wf-panel-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/group-controls-with-wf-panel-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/why-transformation-order-is-significant.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/why-transformation-order-is-significant?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/groupbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/groupbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/windows-forms-accessibility.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-accessibility?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/groupbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/groupbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/windows-forms-and-unmanaged-applications-overview.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-and-unmanaged-applications-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/windows-forms-and-unmanaged-applications.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-and-unmanaged-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/handling-errors-that-occur-during-data-entry-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/handling-errors-that-occur-during-data-entry-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/windows-forms-print-support.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-print-support?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/handling-user-input.md", - "redirect_url": "/dotnet/desktop/winforms/controls/handling-user-input?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/windows-forms-visual-inheritance.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/windows-forms-visual-inheritance?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/helpprovider-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/helpprovider-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/advanced/working-with-images-bitmaps-icons-and-metafiles.md", + "redirect_url": "/dotnet/desktop/winforms/advanced/working-with-images-bitmaps-icons-and-metafiles?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/helpprovider-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/helpprovider-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/automatic-scaling-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/automatic-scaling-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/hide-columns-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/hide-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/change-notification-in-windows-forms-data-binding.md", + "redirect_url": "/dotnet/desktop/winforms/change-notification-in-windows-forms-data-binding?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-access-objects-bound-to-windows-forms-datagridview-rows.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-objects-bound-to-windows-forms-datagridview-rows?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/changing-the-appearance-of-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/changing-the-appearance-of-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-access-the-html-source-in-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-the-html-source-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/clickonce-deployment-for-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/clickonce-deployment-for-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/99f6e876-3f7f-4139-9063-e36587c95b02.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-a-master-detail-form-using-two-datagridviews", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-tab-page-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-tab-page-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/access-objects-in-a-wf-datagridviewcomboboxcell-drop-down-list.md", + "redirect_url": "/dotnet/desktop/winforms/controls/access-objects-in-a-wf-datagridviewcomboboxcell-drop-down-list?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-tab-page.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-tab-page?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/access-specific-items-in-a-wf-combobox-listbox-or-checkedlistbox.md", + "redirect_url": "/dotnet/desktop/winforms/controls/access-specific-items-in-a-wf-combobox-listbox-or-checkedlistbox?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-toolstripcontentpanel.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-toolstripcontentpanel?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/accessing-frames-in-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/accessing-frames-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-a-custom-place-to-a-file-dialog-box.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-custom-place-to-a-file-dialog-box?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/accessing-unexposed-members-on-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/accessing-unexposed-members-on-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-a-toolstripcontainer-to-a-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-toolstripcontainer-to-a-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-columns-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-activex-controls-to-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-items-from-a-wf-combobox.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-items-from-a-wf-combobox?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-items-with-the-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-items-with-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-items-with-wf-listview-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-items-with-wf-listview-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-nodes-with-the-windows-forms-treeview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-nodes-with-the-windows-forms-treeview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-menu-items-with-wf-contextmenu-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-menu-items-with-wf-contextmenu-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-tabs-with-the-windows-forms-tabcontrol.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-tabs-with-the-windows-forms-tabcontrol?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-nodes-with-wf-treeview-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-nodes-with-wf-treeview-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-buttons-to-a-toolbar-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-buttons-to-a-toolbar-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-and-remove-tabs-with-wf-tabcontrol-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-and-remove-tabs-with-wf-tabcontrol-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-buttons-to-a-toolbar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-buttons-to-a-toolbar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-custom-information-to-a-treeview-or-listview-control-wf?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-tables-and-columns-to-wf-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/add-tooltips-to-individual-cells-in-a-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/add-tooltips-to-individual-cells-in-a-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-controls-to-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-controls-to-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/app-icons-to-the-taskbar-with-wf-notifyicon.md", + "redirect_url": "/dotnet/desktop/winforms/controls/app-icons-to-the-taskbar-with-wf-notifyicon?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/arranging-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-enhancements-to-toolstripmenuitems.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-enhancements-to-toolstripmenuitems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/attributes-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/attributes-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-items-to-windows-forms-domainupdown-controls-programmatically.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-items-to-windows-forms-domainupdown-controls-programmatically?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/autogenerate-columns-in-a-data-bound-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/autogenerate-columns-in-a-data-bound-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-menu-items-to-a-contextmenustrip.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-menu-items-to-a-contextmenustrip?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/automatically-resize-cells-when-content-changes-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/automatically-resize-cells-when-content-changes-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-or-remove-imagelist-images-with-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-or-remove-imagelist-images-with-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/autosize-behavior-in-the-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/autosize-behavior-in-the-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-or-remove-images-with-the-windows-forms-imagelist-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-or-remove-images-with-the-windows-forms-imagelist-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/autosize-property-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/autosize-property-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-panels-to-a-statusbar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/backgroundworker-component-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/backgroundworker-component-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-search-capabilities-to-a-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-search-capabilities-to-a-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/backgroundworker-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/backgroundworker-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-tables-and-columns-to-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-tables-and-columns-to-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/basic-column-row-and-cell-features-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/basic-column-row-and-cell-features-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/basic-formatting-and-styling-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/basic-formatting-and-styling-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-toolstrip-items-dynamically.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-toolstrip-items-dynamically?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/best-practices-for-scaling-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-add-web-browser-capabilities-to-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-web-browser-capabilities-to-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/best-practices-for-the-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/best-practices-for-the-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-align-a-control-to-the-edges-of-forms-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-a-control-to-the-edges-of-forms-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bind-data-to-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bind-data-to-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-align-a-control-to-the-edges-of-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-a-control-to-the-edges-of-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bind-wf-controls-with-the-bindingsource.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bind-wf-controls-with-the-bindingsource?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-align-and-stretch-a-control-in-a-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-and-stretch-a-control-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bind-wf-datagrid-control-to-a-data-source-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-align-multiple-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bindingnavigator-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bindingnavigator-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-flowlayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-flowlayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bindingnavigator-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bindingnavigator-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bindingsource-component-architecture.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component-architecture?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-anchor-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bindingsource-component-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-append-a-menustrip-to-an-mdi-parent-window-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-append-a-menustrip-to-an-mdi-parent-window-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/bindingsource-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/bindingsource-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-apply-attributes-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/button-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/button-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-arrange-controls-with-snaplines-and-the-grid-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines" + "source_path": "docs/framework/winforms/controls/button-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/button-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-associate-a-contextmenustrip-with-a-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-associate-a-contextmenustrip-with-a-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/c5fa29e8-47f7-4691-829b-0e697a691f36.md", + "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-master-detail-form-using-two-datagridviews", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/controls/how-to-associate-a-shortcut-menu-with-a-windows-forms-notifyicon-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-associate-a-shortcut-menu-with-a-windows-forms-notifyicon-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treenode-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treenode-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/change-displayed-data-at-run-time-wf-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treeview-node.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treeview-node?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/change-the-border-and-gridline-styles-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/change-the-border-and-gridline-styles-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-author-composite-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-author-composite-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/change-the-order-of-columns-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/change-the-order-of-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-author-controls-for-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-author-controls-for-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/change-the-type-of-a-wf-datagridview-column-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/change-the-type-of-a-wf-datagridview-column-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-combobox-or-listbox-control-to-data.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-combobox-or-listbox-control-to-data?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/checkbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/checkbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-factory-object.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-factory-object?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/checkbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/checkbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/checkedlistbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/checkedlistbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/checkedlistbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/checkedlistbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-data-to-the-maskedtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-data-to-the-maskedtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/colordialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/colordialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/colordialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/colordialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-objects-to-windows-forms-datagridview-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-objects-to-windows-forms-datagridview-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/column-fill-mode-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/column-fill-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-the-windows-forms-datagrid-control-to-a-data-source.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-the-windows-forms-datagrid-control-to-a-data-source?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/column-sort-modes-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/column-sort-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-to-a-web-service-using-the-windows-forms-bindingsource.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-to-a-web-service-using-the-windows-forms-bindingsource?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/column-types-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/column-types-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-bind-windows-forms-controls-to-dbnull-database-values.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-windows-forms-controls-to-dbnull-database-values?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/combobox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/combobox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-monthcalendar-control-appearance.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-monthcalendar-control-appearance?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/combobox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/combobox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-styles-on-an-element-in-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-styles-on-an-element-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/considerations-when-hosting-an-activex-control-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-colordialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-colordialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/constituent-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/constituent-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-linklabel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-linklabel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/contextmenu-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/contextmenu-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-tabcontrol.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-tabcontrol?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/contextmenu-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/contextmenu-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-toolstrip-text-and-images-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-toolstrip-text-and-images-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/contextmenustrip-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/contextmenustrip-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-delay-of-the-windows-forms-tooltip-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-delay-of-the-windows-forms-tooltip-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/contextmenustrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/contextmenustrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-order-of-columns-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-order-of-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/control-type-recommendations.md", + "redirect_url": "/dotnet/desktop/winforms/controls/control-type-recommendations?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-change-the-spacing-and-alignment-of-toolstrip-items-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-spacing-and-alignment-of-toolstrip-items-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/controls-to-use-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/controls-to-use-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/controls-with-built-in-owner-drawing-support.md", + "redirect_url": "/dotnet/desktop/winforms/controls/controls-with-built-in-owner-drawing-support?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-configure-contextmenustrip-check-margins-and-image-margins.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-configure-contextmenustrip-check-margins-and-image-margins?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/create-a-basic-wf-toolstrip-with-standard-items-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-a-basic-wf-toolstrip-with-standard-items-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-configure-menustrip-check-margins-and-image-margins.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-configure-menustrip-check-margins-and-image-margins?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-a-lookup-table-for-a-wf-combobox-listbox?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-control-the-insertion-point-in-a-windows-forms-textbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-control-the-insertion-point-in-a-windows-forms-textbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/create-a-master-detail-form-using-two-datagridviews.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-a-master-detail-form-using-two-datagridviews?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-copy-controls-between-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms" + "source_path": "docs/framework/winforms/controls/create-a-multipane-user-interface-with-wf-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-a-multipane-user-interface-with-wf-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-copy-toolstripmenuitems.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-copy-toolstripmenuitems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/create-and-set-a-custom-renderer-for-the-toolstrip-control-in-wf.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-and-set-a-custom-renderer-for-the-toolstrip-control-in-wf?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-border-around-a-windows-forms-control-using-padding.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-border-around-a-windows-forms-control-using-padding?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/create-master-details-lists-with-wf-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-lookup-table-with-the-windows-forms-bindingsource-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-lookup-table-with-the-windows-forms-bindingsource-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/creating-a-master-detail-form-using-two-datagridviews.md", + "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-master-detail-form-using-two-datagridviews?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/creating-a-wf-control-design-time-features.md", + "redirect_url": "/dotnet/desktop/winforms/controls/creating-a-wf-control-design-time-features?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-password-text-box-with-the-windows-forms-textbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-password-text-box-with-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/creating-an-explorer-style-interface-with-the-listview-and-treeview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/creating-an-explorer-style-interface-with-the-listview-and-treeview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-professionally-styled-toolstrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-professionally-styled-toolstrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/custom-control-painting-and-rendering.md", + "redirect_url": "/dotnet/desktop/winforms/controls/custom-control-painting-and-rendering?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-read-only-text-box-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-read-only-text-box-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/customize-cells-and-columns-in-the-datagrid-by-extending-behavior.md", + "redirect_url": "/dotnet/desktop/winforms/controls/customize-cells-and-columns-in-the-datagrid-by-extending-behavior?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/customize-the-appearance-of-cells-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/customize-the-appearance-of-cells-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-windows-explorer-style-interface-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-windows-explorer-style-interface-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/customize-the-appearance-of-rows-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/customize-the-appearance-of-rows-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/customizing-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/customizing-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-for-windows-forms-controls-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-for-windows-forms-controls" + "source_path": "docs/framework/winforms/controls/data-display-modes-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/data-display-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-for-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-for-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/data-entry-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/data-entry-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-with-windows-forms-label-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-with-windows-forms-label-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/data-formatting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-an-html-document-viewer-in-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-html-document-viewer-in-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagrid-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagrid-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-form-with-menu-merging-and-toolstrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-form-with-menu-merging-and-toolstrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagrid-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagrid-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-form-with-toolstrippanel-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-form-with-toolstrippanel-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-architecture-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-architecture-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-window-list-with-menustrip-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-window-list-with-menustrip-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-code-directory-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-code-directory-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-an-unbound-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-unbound-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-master-detail-lists-with-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-master-detail-lists-with-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-scenarios-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-scenarios-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-toggle-buttons-in-toolstrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-toggle-buttons-in-toolstrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-technology-summary-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-technology-summary-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-create-variable-sized-text-in-a-combobox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-variable-sized-text-in-a-combobox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datagridview-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datagridview-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-custom-draw-a-toolstrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-custom-draw-a-toolstrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datetimepicker-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datetimepicker-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-customize-colors-in-toolstrip-applications.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-colors-in-toolstrip-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/datetimepicker-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/datetimepicker-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-customize-data-formatting-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-data-formatting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/default-cell-styles-datagridview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/default-cell-styles-datagridview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-customize-item-addition-with-the-windows-forms-bindingsource.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-item-addition-with-the-windows-forms-bindingsource?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/default-functionality-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/default-functionality-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-customize-sorting-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-sorting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/default-keyboard-and-mouse-handling-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/default-keyboard-and-mouse-handling-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-define-an-icon-for-a-toolbar-button-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-an-icon-for-a-toolbar-button-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/defining-a-property-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/defining-a-property-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-define-an-icon-for-a-toolbar-button.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-an-icon-for-a-toolbar-button?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/defining-an-event-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/defining-an-event-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-define-resize-and-positioning-behavior-in-a-split-window.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-resize-and-positioning-behavior-in-a-split-window?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/defining-default-values-with-the-shouldserialize-and-reset-methods.md", + "redirect_url": "/dotnet/desktop/winforms/controls/defining-default-values-with-the-shouldserialize-and-reset-methods?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-define-z-ordering-of-docked-toolstrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-z-ordering-of-docked-toolstrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/design-time-errors-in-the-windows-forms-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/design-time-errors-in-the-windows-forms-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-delete-or-hide-columns-in-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-delete-or-hide-columns-in-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/designate-a-wf-button-as-the-accept-button-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/designate-a-wf-button-as-the-accept-button-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/designate-a-wf-button-as-the-cancel-button-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/designate-a-wf-button-as-the-cancel-button-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-designate-a-windows-forms-button-as-the-accept-button.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-designate-a-windows-forms-button-as-the-accept-button?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/determine-when-formatting-attributes-change-wf-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/determine-when-formatting-attributes-change-wf-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-designate-a-windows-forms-button-as-the-cancel-button.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-designate-a-windows-forms-button-as-the-cancel-button?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/determine-which-panel-wf-statusbar-control-was-clicked.md", + "redirect_url": "/dotnet/desktop/winforms/controls/determine-which-panel-wf-statusbar-control-was-clicked?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-detect-when-the-mouse-pointer-is-over-a-toolstripitem.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-detect-when-the-mouse-pointer-is-over-a-toolstripitem?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/developing-a-composite-windows-forms-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/developing-a-composite-windows-forms-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-determine-checked-items-in-the-windows-forms-checkedlistbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-checked-items-in-the-windows-forms-checkedlistbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/developing-custom-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/developing-custom-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-determine-page-properties-using-the-pagesetupdialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-page-properties-using-the-pagesetupdialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/developing-windows-forms-controls-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/developing-windows-forms-controls-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-determine-which-treeview-node-was-clicked-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-which-treeview-node-was-clicked-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/dialog-box-controls-and-components-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/dialog-box-controls-and-components-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-develop-a-simple-windows-forms-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/differences-between-the-windows-forms-datagridview-and-datagrid-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/differences-between-the-windows-forms-datagridview-and-datagrid-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-disable-tab-pages.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-tab-pages?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-disable-toolstripmenuitems-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-toolstripmenuitems-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/display-a-date-in-a-custom-format-with-wf-datetimepicker-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/display-a-date-in-a-custom-format-with-wf-datetimepicker-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-disable-toolstripmenuitems.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-toolstripmenuitems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/display-a-web-page-from-a-wf-linklabel-control-visual-basic.md", + "redirect_url": "/dotnet/desktop/winforms/controls/display-a-web-page-from-a-wf-linklabel-control-visual-basic?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/display-error-icons-for-form-validation-with-wf-errorprovider.md", + "redirect_url": "/dotnet/desktop/winforms/controls/display-error-icons-for-form-validation-with-wf-errorprovider?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-an-insertion-mark-in-a-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-an-insertion-mark-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/display-more-than-one-month-wf-monthcalendar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/display-more-than-one-month-wf-monthcalendar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-icons-for-the-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-icons-for-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/display-specific-days-in-bold-with-wf-monthcalendar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/display-specific-days-in-bold-with-wf-monthcalendar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/displaying-data-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/displaying-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-option-buttons-in-a-menustrip-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-option-buttons-in-a-menustrip-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/domainupdown-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/domainupdown-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-print-preview-in-windows-forms-applications.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-print-preview-in-windows-forms-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/domainupdown-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/domainupdown-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-scroll-bars-in-the-windows-forms-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-scroll-bars-in-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/enable-column-reordering-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/enable-column-reordering-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/enable-drag-and-drop-operations-with-wf-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/enable-drag-and-drop-operations-with-wf-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-subitems-in-columns-with-the-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-subitems-in-columns-with-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/enable-tile-view-in-a-wf-listview-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/enable-tile-view-in-a-wf-listview-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-the-printdialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-the-printdialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/enable-users-to-copy-multiple-cells-to-the-clipboard-datagridview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/enable-users-to-copy-multiple-cells-to-the-clipboard-datagridview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-time-with-the-datetimepicker-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-time-with-the-datetimepicker-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/errorprovider-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/errorprovider-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/errorprovider-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/errorprovider-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-dock-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-dock-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/events-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/events-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-download-a-file-in-the-background.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-download-a-file-in-the-background?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/filedialog-class.md", + "redirect_url": "/dotnet/desktop/winforms/controls/filedialog-class?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-edit-columns-and-rows-in-a-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-edit-columns-and-rows-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/flowlayoutpanel-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/flowlayoutpanel-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-autocomplete-in-toolstrip-controls-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-autocomplete-in-toolstrip-controls-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/flowlayoutpanel-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/flowlayoutpanel-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-check-margins-and-image-margins-in-contextmenustrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-check-margins-and-image-margins-in-contextmenustrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/folderbrowserdialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/folderbrowserdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-column-reordering-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-column-reordering-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/folderbrowserdialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/folderbrowserdialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-reordering-of-toolstrip-items-at-run-time-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-reordering-of-toolstrip-items-at-run-time-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/fontdialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/fontdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-the-tab-key-to-move-out-of-a-toolstrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-the-tab-key-to-move-out-of-a-toolstrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/fontdialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/fontdialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-enable-tile-view-in-a-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-tile-view-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/freeze-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-expose-properties-of-constituent-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-expose-properties-of-constituent-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/get-and-set-the-current-cell-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/get-and-set-the-current-cell-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/group-controls-with-wf-panel-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/group-controls-with-wf-panel-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/groupbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/groupbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/groupbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/groupbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-freeze-columns-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-freeze-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/handle-errors-that-occur-during-data-entry-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-give-your-control-a-transparent-background.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-give-your-control-a-transparent-background?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/handling-errors-that-occur-during-data-entry-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/handling-errors-that-occur-during-data-entry-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-group-controls-with-the-windows-forms-groupbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-controls-with-the-windows-forms-groupbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/handling-user-input.md", + "redirect_url": "/dotnet/desktop/winforms/controls/handling-user-input?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/helpprovider-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/helpprovider-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/helpprovider-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/helpprovider-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-group-windows-forms-radiobutton-controls-to-function-as-a-set.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-windows-forms-radiobutton-controls-to-function-as-a-set?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/hide-columns-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/hide-columns-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-handle-errors-and-exceptions-that-occur-with-databinding.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-handle-errors-and-exceptions-that-occur-with-databinding?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-access-objects-bound-to-windows-forms-datagridview-rows.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-objects-bound-to-windows-forms-datagridview-rows?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-handle-the-contextmenustrip-opening-event.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-handle-the-contextmenustrip-opening-event?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-access-the-html-source-in-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-the-html-source-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-hide-column-headers-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-column-headers-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-access-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-access-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-hide-columns-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-tab-page-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-tab-page-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-hide-toolstripmenuitems-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-toolstripmenuitems-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-tab-page.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-tab-page?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-hide-toolstripmenuitems.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-toolstripmenuitems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-a-control-to-a-toolstripcontentpanel.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-control-to-a-toolstripcontentpanel?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-a-custom-place-to-a-file-dialog-box.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-custom-place-to-a-file-dialog-box?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-implement-a-custom-layout-engine.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-custom-layout-engine?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-a-toolstripcontainer-to-a-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-a-toolstripcontainer-to-a-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-implement-a-custom-toolstriprenderer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-custom-toolstriprenderer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-activex-controls-to-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-activex-controls-to-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-items-with-the-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-items-with-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-implement-virtual-mode-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-virtual-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-nodes-with-the-windows-forms-treeview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-nodes-with-the-windows-forms-treeview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-existing-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-and-remove-tabs-with-the-windows-forms-tabcontrol.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-and-remove-tabs-with-the-windows-forms-tabcontrol?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-inherit-from-the-control-class.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-the-control-class?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-buttons-to-a-toolbar-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-buttons-to-a-toolbar-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-the-usercontrol-class?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-buttons-to-a-toolbar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-buttons-to-a-toolbar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-insert-a-menustrip-into-an-mdi-drop-down-menu-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-insert-a-menustrip-into-an-mdi-drop-down-menu-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-columns-to-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-join-toolstrippanels.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-join-toolstrippanels?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-controls-to-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-controls-to-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-layer-objects-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-layer-objects-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-controls-without-a-user-interface-to-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-load-a-picture-using-the-designer-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-a-picture-using-the-designer-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-enhancements-to-toolstripmenuitems.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-enhancements-to-toolstripmenuitems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-load-a-sound-asynchronously-within-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-a-sound-asynchronously-within-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-items-to-windows-forms-domainupdown-controls-programmatically.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-items-to-windows-forms-domainupdown-controls-programmatically?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-load-files-into-the-windows-forms-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-files-into-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-menu-items-to-a-contextmenustrip.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-menu-items-to-a-contextmenustrip?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-lock-controls-to-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-lock-controls-to-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-or-remove-imagelist-images-with-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-or-remove-imagelist-images-with-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-loop-a-sound-playing-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-loop-a-sound-playing-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-or-remove-images-with-the-windows-forms-imagelist-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-or-remove-images-with-the-windows-forms-imagelist-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-make-columns-read-only-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-columns-read-only-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-panels-to-a-statusbar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-panels-to-a-statusbar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-search-capabilities-to-a-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-search-capabilities-to-a-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-make-your-control-invisible-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-your-control-invisible-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-tables-and-columns-to-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-tables-and-columns-to-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-manage-toolstrip-overflow-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manage-toolstrip-overflow-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-to-or-remove-from-a-collection-of-controls-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-manipulate-bands-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-bands-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-toolstrip-items-dynamically.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-toolstrip-items-dynamically?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-add-web-browser-capabilities-to-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-add-web-browser-capabilities-to-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-manipulate-rows-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-rows-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-align-a-control-to-the-edges-of-forms-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-a-control-to-the-edges-of-forms-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-modify-the-size-or-placement-of-a-picture-at-run-time-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-modify-the-size-or-placement-of-a-picture-at-run-time-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-align-a-control-to-the-edges-of-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-a-control-to-the-edges-of-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-move-a-toolstrip-out-of-a-toolstripcontainer-onto-a-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-move-a-toolstrip-out-of-a-toolstripcontainer-onto-a-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-align-and-stretch-a-control-in-a-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-and-stretch-a-control-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-move-toolstripmenuitems.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-move-toolstripmenuitems?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-align-multiple-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-navigate-data-with-the-windows-forms-bindingnavigator-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-navigate-data-with-the-windows-forms-bindingnavigator-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-flowlayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-flowlayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-navigate-to-a-url-with-the-webbrowser-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-navigate-to-a-url-with-the-webbrowser-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-and-dock-child-controls-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-open-files-using-the-openfiledialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-anchor-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-anchor-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-opt-out-of-file-dialog-box-automatic-upgrade.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-opt-out-of-file-dialog-box-automatic-upgrade?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-append-a-menustrip-to-an-mdi-parent-window-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-append-a-menustrip-to-an-mdi-parent-window-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-play-a-beep-from-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-beep-from-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-apply-attributes-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-apply-attributes-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-play-a-sound-embedded-in-a-resource-from-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-sound-embedded-in-a-resource-from-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-arrange-controls-with-snaplines-and-the-grid-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines" }, { - "source_path": "docs/framework/winforms/controls/how-to-play-a-sound-from-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-sound-from-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-associate-a-contextmenustrip-with-a-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-associate-a-contextmenustrip-with-a-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-play-a-system-sound-from-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-system-sound-from-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-associate-a-shortcut-menu-with-a-windows-forms-notifyicon-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-associate-a-shortcut-menu-with-a-windows-forms-notifyicon-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-position-a-toolstripitem-on-a-toolstrip.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-position-a-toolstripitem-on-a-toolstrip?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treenode-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treenode-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-position-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-position-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treeview-node.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-attach-a-shortcut-menu-to-a-treeview-node?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-print-with-a-webbrowser-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-print-with-a-webbrowser-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-author-composite-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-author-composite-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-author-controls-for-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-author-controls-for-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-provide-standard-menu-items-to-a-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-provide-standard-menu-items-to-a-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-combobox-or-listbox-control-to-data.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-combobox-or-listbox-control-to-data?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-put-quotation-marks-in-a-string-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-put-quotation-marks-in-a-string-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-factory-object.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-factory-object?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-raise-change-notifications-using-the-bindingsource-resetitem-method.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-raise-change-notifications-using-the-bindingsource-resetitem-method?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-reassign-existing-controls-to-a-different-parent.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-reassign-existing-controls-to-a-different-parent?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-a-windows-forms-control-to-a-type?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-remove-a-toolstripmenuitem-from-an-mdi-drop-down-menu-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-remove-a-toolstripmenuitem-from-an-mdi-drop-down-menu-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-data-to-the-maskedtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-data-to-the-maskedtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-remove-items-from-windows-forms-domainupdown-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-remove-items-from-windows-forms-domainupdown-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-data-to-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-render-a-visual-style-element.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-render-a-visual-style-element?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-objects-to-windows-forms-datagridview-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-objects-to-windows-forms-datagridview-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-resize-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-the-windows-forms-datagrid-control-to-a-data-source.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-the-windows-forms-datagrid-control-to-a-data-source?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-respond-to-clicks-in-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-clicks-in-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-to-a-web-service-using-the-windows-forms-bindingsource.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-to-a-web-service-using-the-windows-forms-bindingsource?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-respond-to-windows-forms-button-clicks.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-windows-forms-button-clicks?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-bind-windows-forms-controls-to-dbnull-database-values.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-bind-windows-forms-controls-to-dbnull-database-values?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-respond-to-windows-forms-checkbox-clicks.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-windows-forms-checkbox-clicks?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-monthcalendar-control-appearance.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-monthcalendar-control-appearance?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-run-an-operation-in-the-background.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-run-an-operation-in-the-background?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-styles-on-an-element-in-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-styles-on-an-element-in-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-save-files-using-the-savefiledialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-colordialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-colordialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-save-files-with-the-windows-forms-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-save-files-with-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-linklabel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-linklabel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-select-a-range-of-dates-in-the-windows-forms-monthcalendar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-a-range-of-dates-in-the-windows-forms-monthcalendar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-tabcontrol.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-the-windows-forms-tabcontrol?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-select-an-item-in-the-windows-forms-listview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-an-item-in-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-appearance-of-toolstrip-text-and-images-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-appearance-of-toolstrip-text-and-images-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-select-text-in-the-windows-forms-textbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-text-in-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-delay-of-the-windows-forms-tooltip-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-delay-of-the-windows-forms-tooltip-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-alternating-row-styles-for-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-alternating-row-styles-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-order-of-columns-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-order-of-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-and-return-dates-with-the-windows-forms-datetimepicker-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-and-return-dates-with-the-windows-forms-datetimepicker-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-change-the-spacing-and-alignment-of-toolstrip-items-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-change-the-spacing-and-alignment-of-toolstrip-items-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-default-cell-styles-for-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-default-cell-styles-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-choose-folders-with-the-windows-forms-folderbrowserdialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-font-and-color-styles-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-font-and-color-styles-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-configure-contextmenustrip-check-margins-and-image-margins.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-configure-contextmenustrip-check-margins-and-image-margins?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-font-attributes-for-the-windows-forms-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-font-attributes-for-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-configure-menustrip-check-margins-and-image-margins.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-configure-menustrip-check-margins-and-image-margins?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-grid-options-for-all-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-grid-options-for-all-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-control-the-insertion-point-in-a-windows-forms-textbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-control-the-insertion-point-in-a-windows-forms-textbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-icons-for-the-windows-forms-treeview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-icons-for-the-windows-forms-treeview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-copy-controls-between-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-align-multiple-controls-on-windows-forms" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-options-with-windows-forms-checkbox-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-options-with-windows-forms-checkbox-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-copy-toolstripmenuitems.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-copy-toolstripmenuitems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-pictures-at-run-time-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-border-around-a-windows-forms-control-using-padding.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-border-around-a-windows-forms-control-using-padding?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-lookup-table-with-the-windows-forms-bindingsource-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-lookup-table-with-the-windows-forms-bindingsource-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-multipane-user-interface-with-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-format-for-the-windows-forms-numericupdown-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-format-for-the-windows-forms-numericupdown-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-password-text-box-with-the-windows-forms-textbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-password-text-box-with-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control" + "source_path": "docs/framework/winforms/controls/how-to-create-a-professionally-styled-toolstrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-professionally-styled-toolstrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-read-only-text-box-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-read-only-text-box-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-input-mask.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-input-mask?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-resizable-windows-form-for-data-entry?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-selection-mode-of-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-selection-mode-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-windows-explorer-style-interface-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-windows-explorer-style-interface-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-size-of-status-bar-panels.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-size-of-status-bar-panels?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-a-windows-forms-control-that-shows-progress?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-sizing-modes-of-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-sizing-modes-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-for-windows-forms-controls-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-for-windows-forms-controls" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-tab-order-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-tab-order-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-for-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-for-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control" + "source_path": "docs/framework/winforms/controls/how-to-create-access-keys-with-windows-forms-label-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-with-windows-forms-label-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-an-html-document-viewer-in-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-html-document-viewer-in-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-toolstrip-renderer-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-toolstrip-renderer-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-form-with-menu-merging-and-toolstrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-form-with-menu-merging-and-toolstrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-toolstrip-renderer-for-an-application.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-toolstrip-renderer-for-an-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-form-with-toolstrippanel-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-form-with-toolstrippanel-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-the-value-displayed-by-the-windows-forms-progressbar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-value-displayed-by-the-windows-forms-progressbar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-an-mdi-window-list-with-menustrip-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-mdi-window-list-with-menustrip-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-tooltips-for-controls-on-a-windows-form-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-tooltips-for-controls-on-a-windows-form-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-an-unbound-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-an-unbound-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-set-up-automatic-menu-merging-for-mdi-applications.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-up-automatic-menu-merging-for-mdi-applications?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-master-detail-lists-with-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-master-detail-lists-with-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-share-bound-data-across-forms-using-the-bindingsource-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-share-bound-data-across-forms-using-the-bindingsource-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-toggle-buttons-in-toolstrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-toggle-buttons-in-toolstrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-show-a-color-palette-with-the-colordialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-show-a-color-palette-with-the-colordialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-create-variable-sized-text-in-a-combobox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-create-variable-sized-text-in-a-combobox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-show-a-font-list-with-the-fontdialog-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-show-a-font-list-with-the-fontdialog-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-custom-draw-a-toolstrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-custom-draw-a-toolstrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-size-a-windows-forms-label-control-to-fit-its-contents.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-size-a-windows-forms-label-control-to-fit-its-contents?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-customize-colors-in-toolstrip-applications.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-colors-in-toolstrip-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-span-rows-and-columns-in-a-tablelayoutpanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-span-rows-and-columns-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-customize-data-formatting-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-data-formatting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-specify-the-edit-mode-for-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-specify-the-edit-mode-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-customize-item-addition-with-the-windows-forms-bindingsource.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-item-addition-with-the-windows-forms-bindingsource?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-split-a-window-horizontally-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-split-a-window-horizontally-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-customize-sorting-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-customize-sorting-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-split-a-window-horizontally.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-split-a-window-horizontally?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-define-an-icon-for-a-toolbar-button-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-an-icon-for-a-toolbar-button-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-define-an-icon-for-a-toolbar-button.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-an-icon-for-a-toolbar-button?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-trigger-menu-events-for-toolbar-buttons.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-trigger-menu-events-for-toolbar-buttons?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-define-resize-and-positioning-behavior-in-a-split-window.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-resize-and-positioning-behavior-in-a-split-window?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-a-background-thread-to-search-for-files?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-define-z-ordering-of-docked-toolstrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-define-z-ordering-of-docked-toolstrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-use-a-control-rendering-class.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-a-control-rendering-class?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-delete-or-hide-columns-in-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-delete-or-hide-columns-in-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-use-the-spring-property-interactively-in-a-statusstrip.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-the-spring-property-interactively-in-a-statusstrip?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-design-a-windows-forms-layout-that-responds-well-to-localization?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-use-toolstrippanels-for-mdi.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-toolstrippanels-for-mdi?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-designate-a-windows-forms-button-as-the-accept-button.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-designate-a-windows-forms-button-as-the-accept-button?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-use-tooltips-in-toolstrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-tooltips-in-toolstrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-designate-a-windows-forms-button-as-the-cancel-button.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-designate-a-windows-forms-button-as-the-cancel-button?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-detect-when-the-mouse-pointer-is-over-a-toolstripitem.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-detect-when-the-mouse-pointer-is-over-a-toolstripitem?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-validate-input-with-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-validate-input-with-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-determine-checked-items-in-the-windows-forms-checkedlistbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-checked-items-in-the-windows-forms-checkedlistbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-view-multiple-lines-in-the-windows-forms-textbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-view-multiple-lines-in-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-determine-page-properties-using-the-pagesetupdialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-page-properties-using-the-pagesetupdialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-work-with-image-columns-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-work-with-image-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-determine-which-treeview-node-was-clicked-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-determine-which-treeview-node-was-clicked-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/how-to-wrap-a-windows-forms-control-with-toolstripcontrolhost.md", - "redirect_url": "/dotnet/desktop/winforms/controls/how-to-wrap-a-windows-forms-control-with-toolstripcontrolhost?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-develop-a-simple-windows-forms-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-develop-a-simple-windows-forms-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/hscrollbar-and-vscrollbar-controls-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/hscrollbar-and-vscrollbar-controls-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-disable-tab-pages.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-tab-pages?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/hscrollbar-and-vscrollbar-controls-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/hscrollbar-and-vscrollbar-controls-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-disable-toolstripmenuitems-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-toolstripmenuitems-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/imagelist-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/imagelist-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-disable-toolstripmenuitems.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-disable-toolstripmenuitems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/imagelist-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/imagelist-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-a-control-in-the-choose-toolbox-items-dialog-box?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/implement-two-way-com-between-dhtml-and-client.md", - "redirect_url": "/dotnet/desktop/winforms/controls/implement-two-way-com-between-dhtml-and-client?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-an-insertion-mark-in-a-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-an-insertion-mark-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-icons-for-the-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-icons-for-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/implementing-virtual-mode-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/implementing-virtual-mode-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-images-in-cells-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/index.md", - "redirect_url": "/dotnet/desktop/winforms/controls/index?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-option-buttons-in-a-menustrip-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-option-buttons-in-a-menustrip-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/keyboard-shortcuts-for-the-windows-forms-datagrid-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/keyboard-shortcuts-for-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-print-preview-in-windows-forms-applications.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-print-preview-in-windows-forms-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/known-folder-guids-for-file-dialog-custom-places.md", - "redirect_url": "/dotnet/desktop/winforms/controls/known-folder-guids-for-file-dialog-custom-places?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-scroll-bars-in-the-windows-forms-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-scroll-bars-in-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/label-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/label-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-side-aligned-tabs-with-tabcontrol?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/label-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/label-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-subitems-in-columns-with-the-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-subitems-in-columns-with-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them.md", - "redirect_url": "/dotnet/desktop/winforms/controls/labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-the-printdialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-the-printdialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/layout-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/layout-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-time-with-the-datetimepicker-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-time-with-the-datetimepicker-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md", - "redirect_url": "/dotnet/desktop/winforms/controls/limitations-of-the-timer-component-interval-property?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-display-web-style-links-with-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/link-to-an-object-or-web-page-with-wf-linklabel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/link-to-an-object-or-web-page-with-wf-linklabel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-dock-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-dock-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/linklabel-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/linklabel-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-download-a-file-in-the-background.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-download-a-file-in-the-background?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/linklabel-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/linklabel-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-edit-columns-and-rows-in-a-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-edit-columns-and-rows-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/listbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/listbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-autocomplete-in-toolstrip-controls-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-autocomplete-in-toolstrip-controls-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/listbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/listbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-check-margins-and-image-margins-in-contextmenustrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-check-margins-and-image-margins-in-contextmenustrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/listview-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/listview-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-column-reordering-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-column-reordering-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/listview-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/listview-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-reordering-of-toolstrip-items-at-run-time-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-reordering-of-toolstrip-items-at-run-time-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/load-save-and-cancel-bindingnavigator.md", - "redirect_url": "/dotnet/desktop/winforms/controls/load-save-and-cancel-bindingnavigator?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-the-tab-key-to-move-out-of-a-toolstrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-the-tab-key-to-move-out-of-a-toolstrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/mainmenu-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/mainmenu-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-enable-tile-view-in-a-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-enable-tile-view-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/mainmenu-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/mainmenu-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-expose-properties-of-constituent-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-expose-properties-of-constituent-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/make-columns-read-only-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/make-columns-read-only-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/margin-and-padding-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/margin-and-padding-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-the-windows-forms-datagrid-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/maskedtextbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/maskedtextbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-format-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-format-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/menustrip-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/menustrip-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-freeze-columns-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-freeze-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/menustrip-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/menustrip-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-give-your-control-a-transparent-background.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-give-your-control-a-transparent-background?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/merging-menu-items-in-the-windows-forms-menustrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/merging-menu-items-in-the-windows-forms-menustrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-group-controls-with-the-windows-forms-groupbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-controls-with-the-windows-forms-groupbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/method-implementation-in-custom-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/method-implementation-in-custom-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/monthcalendar-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/monthcalendar-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-items-in-a-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/monthcalendar-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/monthcalendar-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-group-windows-forms-radiobutton-controls-to-function-as-a-set.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-group-windows-forms-radiobutton-controls-to-function-as-a-set?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-handle-errors-and-exceptions-that-occur-with-databinding.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-handle-errors-and-exceptions-that-occur-with-databinding?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/multithreading-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/multithreading-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-handle-the-contextmenustrip-opening-event.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-handle-the-contextmenustrip-opening-event?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/notifyicon-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/notifyicon-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-hide-column-headers-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-column-headers-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/notifyicon-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/notifyicon-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-hide-columns-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/numericupdown-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/numericupdown-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-hide-toolstripmenuitems-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-toolstripmenuitems-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/numericupdown-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/numericupdown-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-hide-toolstripmenuitems.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-hide-toolstripmenuitems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/openfiledialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/openfiledialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-host-controls-in-windows-forms-datagridview-cells?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/openfiledialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/openfiledialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-implement-a-custom-layout-engine.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-custom-layout-engine?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/overriding-the-onpaint-method.md", - "redirect_url": "/dotnet/desktop/winforms/controls/overriding-the-onpaint-method?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-implement-a-custom-toolstriprenderer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-custom-toolstriprenderer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/overview-of-using-controls-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/overview-of-using-controls-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-a-form-that-uses-a-background-operation?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/pagesetupdialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/pagesetupdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-implement-virtual-mode-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-implement-virtual-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/pagesetupdialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/pagesetupdialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-inherit-from-existing-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-existing-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/panel-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/panel-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-inherit-from-the-control-class.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-the-control-class?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/panel-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/panel-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-inherit-from-the-usercontrol-class.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-inherit-from-the-usercontrol-class?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/perform-a-custom-action-based-on-changes-in-a-cell-of-a-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/perform-a-custom-action-based-on-changes-in-a-cell-of-a-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-insert-a-menustrip-into-an-mdi-drop-down-menu-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-insert-a-menustrip-into-an-mdi-drop-down-menu-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/perform-common-tasks-design-actions.md", - "redirect_url": "/dotnet/desktop/winforms/controls/perform-common-tasks-design-actions?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-iterate-through-all-nodes-of-a-windows-forms-treeview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/performance-tuning-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/performance-tuning-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-join-toolstrippanels.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-join-toolstrippanels?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/performing-common-tasks-using-smart-tags-on-wf-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/perform-common-tasks-design-actions", - "redirect_document_id": true + "source_path": "docs/framework/winforms/controls/how-to-layer-objects-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-layer-objects-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/picturebox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/picturebox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-load-a-picture-using-the-designer-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-a-picture-using-the-designer-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/picturebox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/picturebox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-load-a-sound-asynchronously-within-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-a-sound-asynchronously-within-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/prevent-row-addition-and-deletion-datagridview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/prevent-row-addition-and-deletion-datagridview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-load-files-into-the-windows-forms-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-load-files-into-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/prevent-row-addition-and-deletion-in-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/prevent-row-addition-and-deletion-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-lock-controls-to-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-lock-controls-to-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printdialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-loop-a-sound-playing-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-loop-a-sound-playing-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printdialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printdialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-make-columns-read-only-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-columns-read-only-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printdocument-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printdocument-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-thread-safe-calls-to-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printdocument-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printdocument-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-make-your-control-invisible-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-make-your-control-invisible-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printpreviewcontrol-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewcontrol-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-manage-toolstrip-overflow-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manage-toolstrip-overflow-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printpreviewcontrol-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewcontrol-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-manipulate-bands-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-bands-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewdialog-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/printpreviewdialog-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewdialog-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-manipulate-rows-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-manipulate-rows-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/programmatically-resize-cells-to-fit-content-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/programmatically-resize-cells-to-fit-content-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-modify-the-size-or-placement-of-a-picture-at-run-time-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-modify-the-size-or-placement-of-a-picture-at-run-time-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/programming-with-cells-rows-and-columns-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/programming-with-cells-rows-and-columns-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-move-a-toolstrip-out-of-a-toolstripcontainer-onto-a-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-move-a-toolstrip-out-of-a-toolstripcontainer-onto-a-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/progressbar-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/progressbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-move-toolstripmenuitems.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-move-toolstripmenuitems?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/progressbar-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/progressbar-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-navigate-data-with-the-windows-forms-bindingnavigator-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-navigate-data-with-the-windows-forms-bindingnavigator-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/properties-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/properties-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-navigate-to-a-url-with-the-webbrowser-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-navigate-to-a-url-with-the-webbrowser-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/property-changed-events.md", - "redirect_url": "/dotnet/desktop/winforms/controls/property-changed-events?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-open-files-using-the-openfiledialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-open-files-using-the-openfiledialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/providing-accessibility-information-for-controls-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/providing-accessibility-information-for-controls-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-opt-out-of-file-dialog-box-automatic-upgrade.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-opt-out-of-file-dialog-box-automatic-upgrade?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/putting-controls-on-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/putting-controls-on-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-play-a-beep-from-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-beep-from-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/radiobutton-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/radiobutton-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-play-a-sound-embedded-in-a-resource-from-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-sound-embedded-in-a-resource-from-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/radiobutton-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/radiobutton-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-play-a-sound-from-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-sound-from-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/raise-change-notifications--bindingsource.md", - "redirect_url": "/dotnet/desktop/winforms/controls/raise-change-notifications--bindingsource?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-play-a-system-sound-from-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-play-a-system-sound-from-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/reflect-data-source-updates-in-a-wf-control-with-the-bindingsource.md", - "redirect_url": "/dotnet/desktop/winforms/controls/reflect-data-source-updates-in-a-wf-control-with-the-bindingsource?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-position-a-toolstripitem-on-a-toolstrip.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-position-a-toolstripitem-on-a-toolstrip?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/remove-autogenerated-columns-from-a-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/remove-autogenerated-columns-from-a-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-position-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-position-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/rendering-a-windows-forms-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/rendering-a-windows-forms-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-print-with-a-webbrowser-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-print-with-a-webbrowser-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/rendering-controls-with-visual-styles.md", - "redirect_url": "/dotnet/desktop/winforms/controls/rendering-controls-with-visual-styles?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-provide-a-toolbox-bitmap-for-a-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/resizing-columns-and-rows-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/resizing-columns-and-rows-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-provide-standard-menu-items-to-a-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-provide-standard-menu-items-to-a-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/richtextbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/richtextbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-put-quotation-marks-in-a-string-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-put-quotation-marks-in-a-string-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/richtextbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/richtextbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-raise-change-notifications-using-the-bindingsource-resetitem-method.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-raise-change-notifications-using-the-bindingsource-resetitem-method?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-reassign-existing-controls-to-a-different-parent.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-reassign-existing-controls-to-a-different-parent?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/savefiledialog-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/savefiledialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-remove-a-toolstripmenuitem-from-an-mdi-drop-down-menu-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-remove-a-toolstripmenuitem-from-an-mdi-drop-down-menu-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/savefiledialog-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/savefiledialog-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-remove-items-from-windows-forms-domainupdown-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-remove-items-from-windows-forms-domainupdown-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/selected-cells-rows-and-columns-datagridview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/selected-cells-rows-and-columns-datagridview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-render-a-visual-style-element.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-render-a-visual-style-element?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/selection-and-clipboard-use-with-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/selection-and-clipboard-use-with-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-resize-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-resize-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/selection-modes-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/selection-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-respond-to-clicks-in-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-clicks-in-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md", - "redirect_url": "/dotnet/desktop/winforms/controls/serializing-collections-designerserializationvisibilityattribute?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-respond-to-windows-forms-button-clicks.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-windows-forms-button-clicks?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/set-alternating-row-styles-for-the-datagrid-using-the-designer.md", - "redirect_url": "/dotnet/desktop/winforms/controls/set-alternating-row-styles-for-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-respond-to-windows-forms-checkbox-clicks.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-respond-to-windows-forms-checkbox-clicks?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/set-and-return-numeric-values-with-wf-numericupdown-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/set-and-return-numeric-values-with-wf-numericupdown-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-run-an-operation-in-the-background.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-run-an-operation-in-the-background?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/set-indents-hanging-indents-bulleted-paragraphs-with-wf-richtextbox.md", - "redirect_url": "/dotnet/desktop/winforms/controls/set-indents-hanging-indents-bulleted-paragraphs-with-wf-richtextbox?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-save-files-using-the-savefiledialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-save-files-using-the-savefiledialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/set-the-sort-modes-for-columns-wf-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/set-the-sort-modes-for-columns-wf-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-save-files-with-the-windows-forms-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-save-files-with-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/sizing-options-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/sizing-options-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-select-a-range-of-dates-in-the-windows-forms-monthcalendar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-a-range-of-dates-in-the-windows-forms-monthcalendar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-select-an-item-in-the-windows-forms-listview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-an-item-in-the-windows-forms-listview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/sort-the-contents-of-a-wf-combobox-listbox-or-checkedlistbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/sort-the-contents-of-a-wf-combobox-listbox-or-checkedlistbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-select-text-in-the-windows-forms-textbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-select-text-in-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/sorting-data-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/sorting-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-alternating-row-styles-for-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-alternating-row-styles-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/soundplayer-class-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/soundplayer-class-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-and-return-dates-with-the-windows-forms-datetimepicker-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-and-return-dates-with-the-windows-forms-datetimepicker-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/soundplayer-class.md", - "redirect_url": "/dotnet/desktop/winforms/controls/soundplayer-class?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-default-cell-styles-for-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-default-cell-styles-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/specify-default-values-for-new-rows-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/specify-default-values-for-new-rows-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-font-and-color-styles-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-font-and-color-styles-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/splitcontainer-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-font-attributes-for-the-windows-forms-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-font-attributes-for-the-windows-forms-richtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/splitcontainer-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/splitcontainer-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-grid-options-for-all-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-grid-options-for-all-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/splitter-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/splitter-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-icons-for-the-windows-forms-treeview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-icons-for-the-windows-forms-treeview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/splitter-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/splitter-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-options-with-windows-forms-checkbox-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-options-with-windows-forms-checkbox-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/statusbar-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/statusbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-pictures-at-run-time-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-pictures-at-run-time-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/statusbar-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/statusbar-control-windows-forms?view=netframeworkdesktop-4.8" - }, + "source_path": "docs/framework/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel-using-the-designer?view=netframeworkdesktop-4.8" + }, { - "source_path": "docs/framework/winforms/controls/statusstrip-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/statusstrip-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-background-of-a-windows-forms-panel?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/statusstrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/statusstrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-format-for-the-windows-forms-numericupdown-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-format-for-the-windows-forms-numericupdown-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/stretch-a-toolstriptextbox-to-fill-the-remaining-width-of-a-toolstrip-wf.md", - "redirect_url": "/dotnet/desktop/winforms/controls/stretch-a-toolstriptextbox-to-fill-the-remaining-width-of-a-toolstrip-wf?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control" }, { - "source_path": "docs/framework/winforms/controls/tabcontrol-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tabcontrol-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/tabcontrol-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tabcontrol-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-input-mask.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-input-mask?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/tablelayoutpanel-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tablelayoutpanel-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-selection-mode-of-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-selection-mode-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tablelayoutpanel-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-size-of-status-bar-panels.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-size-of-status-bar-panels?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/textbox-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/textbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-sizing-modes-of-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-sizing-modes-of-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/textbox-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/textbox-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-tab-order-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-tab-order-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/timer-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/timer-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control" }, { - "source_path": "docs/framework/winforms/controls/timer-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/timer-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolbar-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-toolstrip-renderer-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-toolstrip-renderer-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolbar-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolbar-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-toolstrip-renderer-for-an-application.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-toolstrip-renderer-for-an-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrip-control-architecture.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-architecture?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-the-value-displayed-by-the-windows-forms-progressbar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-the-value-displayed-by-the-windows-forms-progressbar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrip-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-tooltips-for-controls-on-a-windows-form-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-tooltips-for-controls-on-a-windows-form-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrip-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-set-up-automatic-menu-merging-for-mdi-applications.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-set-up-automatic-menu-merging-for-mdi-applications?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrip-technology-summary.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-technology-summary?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-share-bound-data-across-forms-using-the-bindingsource-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-share-bound-data-across-forms-using-the-bindingsource-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripcontainer-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripcontainer-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-show-a-color-palette-with-the-colordialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-show-a-color-palette-with-the-colordialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripcontainer-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripcontainer-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-show-a-font-list-with-the-fontdialog-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-show-a-font-list-with-the-fontdialog-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrippanel-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrippanel-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-size-a-windows-forms-label-control-to-fit-its-contents.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-size-a-windows-forms-label-control-to-fit-its-contents?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstrippanel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstrippanel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-span-rows-and-columns-in-a-tablelayoutpanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-span-rows-and-columns-in-a-tablelayoutpanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripprogressbar-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripprogressbar-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-specify-the-edit-mode-for-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-specify-the-edit-mode-for-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripprogressbar-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripprogressbar-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-split-a-window-horizontally-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-split-a-window-horizontally-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripstatuslabel-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripstatuslabel-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-split-a-window-horizontally.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-split-a-window-horizontally?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/toolstripstatuslabel-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/toolstripstatuslabel-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-test-the-run-time-behavior-of-a-usercontrol?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/tooltip-component-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tooltip-component-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-trigger-menu-events-for-toolbar-buttons.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-trigger-menu-events-for-toolbar-buttons?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/tooltip-component-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/tooltip-component-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-use-a-background-thread-to-search-for-files.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-a-background-thread-to-search-for-files?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/trackbar-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/trackbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-use-a-control-rendering-class.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-a-control-rendering-class?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/trackbar-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/trackbar-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-use-the-spring-property-interactively-in-a-statusstrip.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-the-spring-property-interactively-in-a-statusstrip?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/treeview-control-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/treeview-control-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-use-toolstrippanels-for-mdi.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-toolstrippanels-for-mdi?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/treeview-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/treeview-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-use-tooltips-in-toolstrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-use-tooltips-in-toolstrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/troubleshooting-control-and-component-authoring.md", - "redirect_url": "/dotnet/desktop/winforms/controls/troubleshooting-control-and-component-authoring?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-validate-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/unbound-column-to-a-data-bound-datagridview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/unbound-column-to-a-data-bound-datagridview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-validate-input-with-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-validate-input-with-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/use-the-row-template-to-customize-rows-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/use-the-row-template-to-customize-rows-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-view-multiple-lines-in-the-windows-forms-textbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-view-multiple-lines-in-the-windows-forms-textbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/user-drawn-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/user-drawn-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-work-with-image-columns-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-work-with-image-columns-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/using-the-designer-with-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/using-the-designer-with-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/how-to-wrap-a-windows-forms-control-with-toolstripcontrolhost.md", + "redirect_url": "/dotnet/desktop/winforms/controls/how-to-wrap-a-windows-forms-control-with-toolstripcontrolhost?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/using-the-managed-html-document-object-model.md", - "redirect_url": "/dotnet/desktop/winforms/controls/using-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/hscrollbar-and-vscrollbar-controls-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/hscrollbar-and-vscrollbar-controls-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/using-the-row-for-new-records-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/using-the-row-for-new-records-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/hscrollbar-and-vscrollbar-controls-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/hscrollbar-and-vscrollbar-controls-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/varieties-of-custom-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/varieties-of-custom-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/imagelist-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/imagelist-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/view-errors-within-a-dataset-with-wf-errorprovider-component.md", - "redirect_url": "/dotnet/desktop/winforms/controls/view-errors-within-a-dataset-with-wf-errorprovider-component?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/imagelist-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/imagelist-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/virtual-mode-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/virtual-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/implement-two-way-com-between-dhtml-and-client.md", + "redirect_url": "/dotnet/desktop/winforms/controls/implement-two-way-com-between-dhtml-and-client?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md", - "redirect_url": "/dotnet/desktop/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/implementing-virtual-mode-jit-data-loading-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-flowlayoutpanel.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-flowlayoutpanel?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/implementing-virtual-mode-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/implementing-virtual-mode-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-tablelayoutpanel.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-tablelayoutpanel?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/index.md", + "redirect_url": "/dotnet/desktop/winforms/controls/index?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/keyboard-shortcuts-for-the-windows-forms-datagrid-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/keyboard-shortcuts-for-the-windows-forms-datagrid-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-basic.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp" + "source_path": "docs/framework/winforms/controls/known-folder-guids-for-file-dialog-custom-places.md", + "redirect_url": "/dotnet/desktop/winforms/controls/known-folder-guids-for-file-dialog-custom-places?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/label-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/label-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/label-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/label-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them.md", + "redirect_url": "/dotnet/desktop/winforms/controls/labeling-individual-windows-forms-controls-and-providing-shortcuts-to-them?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/layout-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/layout-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-creating-an-unbound-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-an-unbound-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/limitations-of-the-timer-component-interval-property.md", + "redirect_url": "/dotnet/desktop/winforms/controls/limitations-of-the-timer-component-interval-property?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-debugging-custom-windows-forms-controls-at-design-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-debugging-custom-windows-forms-controls-at-design-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/link-to-an-object-or-web-page-with-wf-linklabel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/link-to-an-object-or-web-page-with-wf-linklabel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/linklabel-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/linklabel-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-basic.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp" + "source_path": "docs/framework/winforms/controls/linklabel-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/linklabel-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/listbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/listbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-providing-standard-menu-items-to-a-form.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-providing-standard-menu-items-to-a-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/listbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/listbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-running-an-operation-in-the-background?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/listview-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/listview-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-updating-status-bar-information-at-run-time?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/listview-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/listview-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/load-save-and-cancel-bindingnavigator.md", + "redirect_url": "/dotnet/desktop/winforms/controls/load-save-and-cancel-bindingnavigator?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/walkthrough-working-with-the-maskedtextbox-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-working-with-the-maskedtextbox-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/mainmenu-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/mainmenu-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/ways-to-select-a-windows-forms-button-control.md", - "redirect_url": "/dotnet/desktop/winforms/controls/ways-to-select-a-windows-forms-button-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/mainmenu-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/mainmenu-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/webbrowser-control-overview.md", - "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-control-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/make-columns-read-only-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/make-columns-read-only-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/webbrowser-control-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-control-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/margin-and-padding-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/margin-and-padding-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/webbrowser-security.md", - "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-security?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/maskedtextbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/maskedtextbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/when-to-use-a-windows-forms-combobox-instead-of-a-listbox.md", - "redirect_url": "/dotnet/desktop/winforms/controls/when-to-use-a-windows-forms-combobox-instead-of-a-listbox?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/menustrip-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/menustrip-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/windows-forms-control-development-basics.md", - "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-control-development-basics?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/menustrip-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/menustrip-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/windows-forms-controls-by-function.md", - "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-by-function?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/merging-menu-items-in-the-windows-forms-menustrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/merging-menu-items-in-the-windows-forms-menustrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/windows-forms-controls-padding-autosize.md", - "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-padding-autosize?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/method-implementation-in-custom-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/method-implementation-in-custom-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/controls/windows-forms-controls-used-to-list-options.md", - "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-used-to-list-options?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/monthcalendar-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/monthcalendar-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/creating-a-new-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/creating-a-new-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/monthcalendar-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/monthcalendar-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/creating-event-handlers-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/move-through-a-dataset-with-wf-bindingnavigator-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/data-binding-and-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/data-binding-and-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/multithreading-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/multithreading-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/data-sources-supported-by-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/data-sources-supported-by-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/notifyicon-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/notifyicon-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/dialog-boxes-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/dialog-boxes-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/notifyicon-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/notifyicon-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/disable-dpi-awareness-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/designers/disable-dpi-awareness" + "source_path": "docs/framework/winforms/controls/numericupdown-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/numericupdown-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/drag-and-drop-functionality-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/drag-and-drop-functionality-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/numericupdown-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/numericupdown-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/ensure-the-selected-row-in-a-child-table-correct.md", - "redirect_url": "/dotnet/desktop/winforms/ensure-the-selected-row-in-a-child-table-correct?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/openfiledialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/openfiledialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/event-handlers-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/event-handlers-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/openfiledialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/openfiledialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/events-overview-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/events-overview-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/overriding-the-onpaint-method.md", + "redirect_url": "/dotnet/desktop/winforms/controls/overriding-the-onpaint-method?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/getting-started-with-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/getting-started-with-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/overview-of-using-controls-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/overview-of-using-controls-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/high-dpi-support-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/pagesetupdialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/pagesetupdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-keyboard-input-works.md", - "redirect_url": "/dotnet/desktop/winforms/how-keyboard-input-works?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/pagesetupdialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/pagesetupdialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-mouse-input-works-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-mouse-input-works-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/panel-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/panel-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-access-keyed-collections-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-access-keyed-collections-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/panel-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/panel-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-apply-the-propertynamechanged-pattern.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-apply-the-propertynamechanged-pattern?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/perform-a-custom-action-based-on-changes-in-a-cell-of-a-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/perform-a-custom-action-based-on-changes-in-a-cell-of-a-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-change-the-borders-of-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-change-the-borders-of-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/perform-common-tasks-design-actions.md", + "redirect_url": "/dotnet/desktop/winforms/controls/perform-common-tasks-design-actions?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-connect-multiple-events-to-a-single-event-handler-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-connect-multiple-events-to-a-single-event-handler-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/performance-tuning-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/performance-tuning-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-bound-control-and-format-the-displayed-data?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/performing-common-tasks-using-smart-tags-on-wf-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/perform-common-tasks-design-actions", + "redirect_document_id": true }, { - "source_path": "docs/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-simple-bound-control-on-a-windows-form?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/picturebox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/picturebox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-windows-forms-application-from-the-command-line?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/picturebox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/picturebox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/prevent-row-addition-and-deletion-datagridview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/prevent-row-addition-and-deletion-datagridview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-determine-which-modifier-key-was-pressed?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/prevent-row-addition-and-deletion-in-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/prevent-row-addition-and-deletion-in-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-display-dialog-boxes-for-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-display-dialog-boxes-for-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printdialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printdialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-distinguish-between-clicks-and-double-clicks.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-distinguish-between-clicks-and-double-clicks?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printdialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printdialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-handle-keyboard-input-at-the-form-level.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-handle-keyboard-input-at-the-form-level?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printdocument-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printdocument-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-handle-user-input-events-in-windows-forms-controls.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-handle-user-input-events-in-windows-forms-controls?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printdocument-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printdocument-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-implement-the-ilistsource-interface.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-ilistsource-interface?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printpreviewcontrol-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewcontrol-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-implement-the-inotifypropertychanged-interface.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-inotifypropertychanged-interface?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printpreviewcontrol-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewcontrol-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-implement-the-itypedlist-interface.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-itypedlist-interface?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printpreviewdialog-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewdialog-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-modify-keyboard-input-to-a-standard-control.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-modify-keyboard-input-to-a-standard-control?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/printpreviewdialog-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/printpreviewdialog-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-navigate-data-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-navigate-data-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/programmatically-resize-cells-to-fit-content-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/programmatically-resize-cells-to-fit-content-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-resize-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-resize-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/programming-with-cells-rows-and-columns-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/programming-with-cells-rows-and-columns-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-respond-to-font-scheme-changes-in-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-respond-to-font-scheme-changes-in-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/progressbar-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/progressbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/how-to-simulate-mouse-and-keyboard-events-in-code.md", - "redirect_url": "/dotnet/desktop/winforms/how-to-simulate-mouse-and-keyboard-events-in-code?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/progressbar-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/progressbar-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/index.md", - "redirect_url": "/dotnet/desktop/winforms/index?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/properties-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/properties-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/interfaces-related-to-data-binding.md", - "redirect_url": "/dotnet/desktop/winforms/interfaces-related-to-data-binding?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/property-changed-events.md", + "redirect_url": "/dotnet/desktop/winforms/controls/property-changed-events?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/keyboard-input-in-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/keyboard-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/providing-accessibility-information-for-controls-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/providing-accessibility-information-for-controls-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/more-secure-file-and-data-access-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/putting-controls-on-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/putting-controls-on-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/more-secure-printing-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/more-secure-printing-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/radiobutton-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/radiobutton-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/mouse-capture-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/mouse-capture-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/radiobutton-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/radiobutton-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/mouse-events-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/mouse-events-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/raise-change-notifications--bindingsource.md", + "redirect_url": "/dotnet/desktop/winforms/controls/raise-change-notifications--bindingsource?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/mouse-input-in-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/mouse-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/reflect-data-source-updates-in-a-wf-control-with-the-bindingsource.md", + "redirect_url": "/dotnet/desktop/winforms/controls/reflect-data-source-updates-in-a-wf-control-with-the-bindingsource?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/mouse-pointers-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/mouse-pointers-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/remove-autogenerated-columns-from-a-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/remove-autogenerated-columns-from-a-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/multiple-controls-bound-to-data-source-synchronized.md", - "redirect_url": "/dotnet/desktop/winforms/multiple-controls-bound-to-data-source-synchronized?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/rendering-a-windows-forms-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/rendering-a-windows-forms-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/order-of-events-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/order-of-events-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/rendering-controls-with-visual-styles.md", + "redirect_url": "/dotnet/desktop/winforms/controls/rendering-controls-with-visual-styles?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/security-in-windows-forms-overview.md", - "redirect_url": "/dotnet/desktop/winforms/security-in-windows-forms-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/resizing-columns-and-rows-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/resizing-columns-and-rows-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/user-input-in-a-windows-forms-application.md", - "redirect_url": "/dotnet/desktop/winforms/user-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/richtextbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/richtextbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/user-input-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/user-input-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/richtextbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/richtextbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/user-input-validation-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/winforms/user-input-validation-in-windows-forms?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/run-procedures-at-set-intervals-with-wf-timer-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/using-keyboard-events.md", - "redirect_url": "/dotnet/desktop/winforms/using-keyboard-events?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/savefiledialog-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/savefiledialog-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/windows-forms-accessibility-improvements.md", - "redirect_url": "/dotnet/desktop/winforms/windows-forms-accessibility-improvements?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/savefiledialog-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/savefiledialog-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/windows-forms-coordinates.md", - "redirect_url": "/dotnet/desktop/winforms/windows-forms-coordinates?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/selected-cells-rows-and-columns-datagridview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/selected-cells-rows-and-columns-datagridview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/windows-forms-data-binding.md", - "redirect_url": "/dotnet/desktop/winforms/windows-forms-data-binding?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/selection-and-clipboard-use-with-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/selection-and-clipboard-use-with-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/windows-forms-overview.md", - "redirect_url": "/dotnet/desktop/winforms/windows-forms-overview?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/selection-modes-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/selection-modes-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/winforms/windows-forms-security.md", - "redirect_url": "/dotnet/desktop/winforms/windows-forms-security?view=netframeworkdesktop-4.8" + "source_path": "docs/framework/winforms/controls/serializing-collections-designerserializationvisibilityattribute.md", + "redirect_url": "/dotnet/desktop/winforms/controls/serializing-collections-designerserializationvisibilityattribute?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/activate-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/activate-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/winforms/controls/set-alternating-row-styles-for-the-datagrid-using-the-designer.md", + "redirect_url": "/dotnet/desktop/winforms/controls/set-alternating-row-styles-for-the-datagrid-using-the-designer?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/advanced-ink-handling.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/advanced-ink-handling" + "source_path": "docs/framework/winforms/controls/set-and-return-numeric-values-with-wf-numericupdown-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/set-and-return-numeric-values-with-wf-numericupdown-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/advanced-text-formatting.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/advanced-text-formatting" + "source_path": "docs/framework/winforms/controls/set-indents-hanging-indents-bulleted-paragraphs-with-wf-richtextbox.md", + "redirect_url": "/dotnet/desktop/winforms/controls/set-indents-hanging-indents-bulleted-paragraphs-with-wf-richtextbox?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/alignment-margins-and-padding-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/alignment-margins-and-padding-overview" + "source_path": "docs/framework/winforms/controls/set-the-sort-modes-for-columns-wf-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/set-the-sort-modes-for-columns-wf-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/annotations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/annotations-overview" + "source_path": "docs/framework/winforms/controls/sizing-options-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/sizing-options-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/annotations-schema.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/annotations-schema" + "source_path": "docs/framework/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/sort-and-filter-ado-net-data-with-wf-bindingsource-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/annotations.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/annotations" + "source_path": "docs/framework/winforms/controls/sort-the-contents-of-a-wf-combobox-listbox-or-checkedlistbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/sort-the-contents-of-a-wf-combobox-listbox-or-checkedlistbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/application-startup-time.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/application-startup-time" + "source_path": "docs/framework/winforms/controls/sorting-data-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/sorting-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/attached-events-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/attached-events-overview" + "source_path": "docs/framework/winforms/controls/soundplayer-class-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/soundplayer-class-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/attached-properties-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/attached-properties-overview" + "source_path": "docs/framework/winforms/controls/soundplayer-class.md", + "redirect_url": "/dotnet/desktop/winforms/controls/soundplayer-class?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/base-elements-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements-how-to-topics" + "source_path": "docs/framework/winforms/controls/specify-default-values-for-new-rows-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/specify-default-values-for-new-rows-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/base-elements-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements-overview" + "source_path": "docs/framework/winforms/controls/splitcontainer-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/splitcontainer-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/base-elements.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements" + "source_path": "docs/framework/winforms/controls/splitcontainer-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/splitcontainer-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/bidirectional-features-in-wpf-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/bidirectional-features-in-wpf-overview" + "source_path": "docs/framework/winforms/controls/splitter-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/splitter-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/binding-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/binding-markup-extension" + "source_path": "docs/framework/winforms/controls/splitter-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/splitter-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/cleartype-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/cleartype-overview" + "source_path": "docs/framework/winforms/controls/statusbar-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/statusbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/cleartype-registry-settings.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/cleartype-registry-settings" + "source_path": "docs/framework/winforms/controls/statusbar-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/statusbar-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/code-behind-and-xaml-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/code-behind-and-xaml-in-wpf" + "source_path": "docs/framework/winforms/controls/statusstrip-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/statusstrip-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/collecting-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/collecting-ink" + "source_path": "docs/framework/winforms/controls/statusstrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/statusstrip-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/collection-type-dependency-properties.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/collection-type-dependency-properties" + "source_path": "docs/framework/winforms/controls/stretch-a-toolstriptextbox-to-fill-the-remaining-width-of-a-toolstrip-wf.md", + "redirect_url": "/dotnet/desktop/winforms/controls/stretch-a-toolstriptextbox-to-fill-the-remaining-width-of-a-toolstrip-wf?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/colorconvertedbitmap-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/colorconvertedbitmap-markup-extension" + "source_path": "docs/framework/winforms/controls/tabcontrol-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tabcontrol-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/commanding-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/commanding-overview" + "source_path": "docs/framework/winforms/controls/tabcontrol-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tabcontrol-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/componentresourcekey-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/componentresourcekey-markup-extension" + "source_path": "docs/framework/winforms/controls/tablelayoutpanel-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tablelayoutpanel-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/createidispatchstaforwarder-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/createidispatchstaforwarder-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/winforms/controls/tablelayoutpanel-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tablelayoutpanel-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/creating-an-ink-input-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/creating-an-ink-input-control" + "source_path": "docs/framework/winforms/controls/textbox-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/textbox-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/custom-dependency-properties.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/custom-dependency-properties" + "source_path": "docs/framework/winforms/controls/textbox-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/textbox-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/custom-rendering-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/custom-rendering-ink" + "source_path": "docs/framework/winforms/controls/timer-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/timer-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/data-and-data-objects.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/data-and-data-objects" + "source_path": "docs/framework/winforms/controls/timer-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/timer-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/datetime-xaml-syntax.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/datetime-xaml-syntax" + "source_path": "docs/framework/winforms/controls/toolbar-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/deactivate-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/deactivate-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/winforms/controls/toolbar-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolbar-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dependency-properties-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-properties-overview" + "source_path": "docs/framework/winforms/controls/toolstrip-control-architecture.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-architecture?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dependency-property-callbacks-and-validation.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-callbacks-and-validation" + "source_path": "docs/framework/winforms/controls/toolstrip-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dependency-property-metadata.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-metadata" + "source_path": "docs/framework/winforms/controls/toolstrip-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dependency-property-security.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-security" + "source_path": "docs/framework/winforms/controls/toolstrip-technology-summary.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrip-technology-summary?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dependency-property-value-precedence.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-value-precedence" + "source_path": "docs/framework/winforms/controls/toolstripcontainer-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripcontainer-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/digital-ink-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink-how-to-topics" + "source_path": "docs/framework/winforms/controls/toolstripcontainer-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripcontainer-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/digital-ink-overviews.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink-overviews" + "source_path": "docs/framework/winforms/controls/toolstrippanel-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrippanel-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/digital-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink" + "source_path": "docs/framework/winforms/controls/toolstrippanel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstrippanel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/disable-the-realtimestylus-for-wpf-applications.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/disable-the-realtimestylus-for-wpf-applications" + "source_path": "docs/framework/winforms/controls/toolstripprogressbar-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripprogressbar-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/document-serialization-and-storage.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/document-serialization-and-storage" + "source_path": "docs/framework/winforms/controls/toolstripprogressbar-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripprogressbar-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/documents-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/documents-in-wpf" + "source_path": "docs/framework/winforms/controls/toolstripstatuslabel-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripstatuslabel-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/documents.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/documents" + "source_path": "docs/framework/winforms/controls/toolstripstatuslabel-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/toolstripstatuslabel-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/drag-and-drop-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop-how-to-topics" + "source_path": "docs/framework/winforms/controls/tooltip-component-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tooltip-component-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/drag-and-drop-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop-overview" + "source_path": "docs/framework/winforms/controls/tooltip-component-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/tooltip-component-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/drag-and-drop.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop" + "source_path": "docs/framework/winforms/controls/trackbar-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/trackbar-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/draw-text-using-glyphs.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/draw-text-using-glyphs" + "source_path": "docs/framework/winforms/controls/trackbar-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/trackbar-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/drawing-formatted-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/drawing-formatted-text" + "source_path": "docs/framework/winforms/controls/treeview-control-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/treeview-control-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/dynamicresource-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/dynamicresource-markup-extension" + "source_path": "docs/framework/winforms/controls/treeview-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/treeview-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/element-tree-and-serialization-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/element-tree-and-serialization-how-to-topics" + "source_path": "docs/framework/winforms/controls/troubleshooting-control-and-component-authoring.md", + "redirect_url": "/dotnet/desktop/winforms/controls/troubleshooting-control-and-component-authoring?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/element-tree-and-serialization.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/element-tree-and-serialization" + "source_path": "docs/framework/winforms/controls/unbound-column-to-a-data-bound-datagridview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/unbound-column-to-a-data-bound-datagridview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/events-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/events-how-to-topics" + "source_path": "docs/framework/winforms/controls/use-the-row-template-to-customize-rows-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/use-the-row-template-to-customize-rows-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/events-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/events-wpf" + "source_path": "docs/framework/winforms/controls/user-drawn-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/user-drawn-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/flow-content-elements-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/flow-content-elements-how-to-topics" + "source_path": "docs/framework/winforms/controls/using-the-designer-with-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/using-the-designer-with-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/flow-content.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/flow-content" + "source_path": "docs/framework/winforms/controls/using-the-managed-html-document-object-model.md", + "redirect_url": "/dotnet/desktop/winforms/controls/using-the-managed-html-document-object-model?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/flow-document-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/flow-document-overview" + "source_path": "docs/framework/winforms/controls/using-the-row-for-new-records-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/using-the-row-for-new-records-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/focus-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/focus-overview" + "source_path": "docs/framework/winforms/controls/varieties-of-custom-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/varieties-of-custom-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/fonts-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/fonts-how-to-topics" + "source_path": "docs/framework/winforms/controls/view-errors-within-a-dataset-with-wf-errorprovider-component.md", + "redirect_url": "/dotnet/desktop/winforms/controls/view-errors-within-a-dataset-with-wf-errorprovider-component?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/fonts-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/fonts-wpf" + "source_path": "docs/framework/winforms/controls/virtual-mode-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/virtual-mode-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/forwardtranslateaccelerator-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/forwardtranslateaccelerator-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid.md", + "redirect_url": "/dotnet/desktop/winforms/controls/virtual-mode-with-just-in-time-data-loading-in-the-datagrid?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/framework-property-metadata.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/framework-property-metadata" + "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-flowlayoutpanel.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-flowlayoutpanel?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/freezable-objects-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/freezable-objects-overview" + "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-tablelayoutpanel.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-a-tablelayoutpanel?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/getting-started-with-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/getting-started-with-ink" + "source_path": "docs/framework/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-arranging-controls-on-windows-forms-using-snaplines?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/globalization-and-localization-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-localize-an-application", - "redirect_document_id": true + "source_path": "docs/framework/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-basic.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp" }, { - "source_path": "docs/framework/wpf/advanced/globalization-and-localization.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/globalization-and-localization" + "source_path": "docs/framework/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-authoring-a-composite-control-with-visual-csharp?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/globalization-for-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/globalization-for-wpf" + "source_path": "docs/framework/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-automatically-populating-the-toolbox-with-custom-components?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/glyphs.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/glyphs" - }, + "source_path": "docs/framework/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-a-professionally-styled-toolstrip-control?view=netframeworkdesktop-4.8" + }, { - "source_path": "docs/framework/wpf/advanced/graphics-rendering-tiers.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/graphics-rendering-tiers" + "source_path": "docs/framework/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-an-mdi-form-with-menu-merging-and-toolstrip-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/handwriting-recognition.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/handwriting-recognition" + "source_path": "docs/framework/winforms/controls/walkthrough-creating-an-unbound-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-creating-an-unbound-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/hosting-win32-content-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/hosting-win32-content-in-wpf" + "source_path": "docs/framework/winforms/controls/walkthrough-debugging-custom-windows-forms-controls-at-design-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-debugging-custom-windows-forms-controls-at-design-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-add-an-event-handler-using-code.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-an-event-handler-using-code" + "source_path": "docs/framework/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-implementing-a-form-that-uses-a-background-operation?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-add-an-owner-type-for-a-dependency-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-an-owner-type-for-a-dependency-property" + "source_path": "docs/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-basic.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp" }, { - "source_path": "docs/framework/wpf/advanced/how-to-add-class-handling-for-a-routed-event.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-class-handling-for-a-routed-event" + "source_path": "docs/framework/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-inheriting-from-a-windows-forms-control-with-visual-csharp?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-add-custom-data-to-ink-data.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-custom-data-to-ink-data" + "source_path": "docs/framework/winforms/controls/walkthrough-providing-standard-menu-items-to-a-form.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-providing-standard-menu-items-to-a-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-adjust-spacing-between-paragraphs.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-adjust-spacing-between-paragraphs" + "source_path": "docs/framework/winforms/controls/walkthrough-running-an-operation-in-the-background.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-running-an-operation-in-the-background?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-alter-the-typography-of-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-alter-the-typography-of-text" + "source_path": "docs/framework/winforms/controls/walkthrough-updating-status-bar-information-at-run-time.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-updating-status-bar-information-at-run-time?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-analyze-ink-with-analysis-hints.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-analyze-ink-with-analysis-hints" + "source_path": "docs/framework/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-validating-data-in-the-windows-forms-datagridview-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-animate-the-size-of-a-frameworkelement.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-animate-the-size-of-a-frameworkelement" + "source_path": "docs/framework/winforms/controls/walkthrough-working-with-the-maskedtextbox-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/walkthrough-working-with-the-maskedtextbox-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-apply-a-focusvisualstyle-to-a-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-a-focusvisualstyle-to-a-control" + "source_path": "docs/framework/winforms/controls/ways-to-select-a-windows-forms-button-control.md", + "redirect_url": "/dotnet/desktop/winforms/controls/ways-to-select-a-windows-forms-button-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-apply-animations-to-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-animations-to-text" + "source_path": "docs/framework/winforms/controls/webbrowser-control-overview.md", + "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-control-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-apply-transforms-to-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-transforms-to-text" + "source_path": "docs/framework/winforms/controls/webbrowser-control-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-control-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-build-a-table-programmatically.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-build-a-table-programmatically" + "source_path": "docs/framework/winforms/controls/webbrowser-security.md", + "redirect_url": "/dotnet/desktop/winforms/controls/webbrowser-security?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-change-the-color-of-an-element-using-focus-events.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-color-of-an-element-using-focus-events" + "source_path": "docs/framework/winforms/controls/when-to-use-a-windows-forms-combobox-instead-of-a-listbox.md", + "redirect_url": "/dotnet/desktop/winforms/controls/when-to-use-a-windows-forms-combobox-instead-of-a-listbox?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-change-the-cursor-type.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-cursor-type" + "source_path": "docs/framework/winforms/controls/windows-forms-control-development-basics.md", + "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-control-development-basics?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-change-the-flowdirection-of-content-programmatically.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-flowdirection-of-content-programmatically" + "source_path": "docs/framework/winforms/controls/windows-forms-controls-by-function.md", + "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-by-function?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-change-the-textwrapping-property-programmatically.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-textwrapping-property-programmatically" + "source_path": "docs/framework/winforms/controls/windows-forms-controls-padding-autosize.md", + "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-padding-autosize?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-clone-a-printer.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-clone-a-printer" + "source_path": "docs/framework/winforms/controls/windows-forms-controls-used-to-list-options.md", + "redirect_url": "/dotnet/desktop/winforms/controls/windows-forms-controls-used-to-list-options?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-a-custom-routed-event.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-custom-routed-event" + "source_path": "docs/framework/winforms/creating-a-new-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/creating-a-new-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-a-data-object.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-data-object" + "source_path": "docs/framework/winforms/creating-event-handlers-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-a-rollover-effect-using-events.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-rollover-effect-using-events" + "source_path": "docs/framework/winforms/data-binding-and-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/data-binding-and-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-a-routedcommand.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-routedcommand" + "source_path": "docs/framework/winforms/data-sources-supported-by-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/data-sources-supported-by-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-a-text-decoration.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-text-decoration" + "source_path": "docs/framework/winforms/dialog-boxes-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/dialog-boxes-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-outlined-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-outlined-text" + "source_path": "docs/framework/winforms/disable-dpi-awareness-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/designers/disable-dpi-awareness" }, { - "source_path": "docs/framework/wpf/advanced/how-to-create-text-with-a-shadow.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-text-with-a-shadow" + "source_path": "docs/framework/winforms/drag-and-drop-functionality-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/drag-and-drop-functionality-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-data-bind-to-an-inkcanvas.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-data-bind-to-an-inkcanvas" + "source_path": "docs/framework/winforms/ensure-the-selected-row-in-a-child-table-correct.md", + "redirect_url": "/dotnet/desktop/winforms/ensure-the-selected-row-in-a-child-table-correct?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-define-a-table-with-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-define-a-table-with-xaml" + "source_path": "docs/framework/winforms/event-handlers-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/event-handlers-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-define-and-reference-a-resource" + "source_path": "docs/framework/winforms/events-overview-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/events-overview-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-detect-when-the-enter-key-pressed.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-detect-when-the-enter-key-pressed" + "source_path": "docs/framework/winforms/getting-started-with-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/getting-started-with-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-determine-if-a-data-format-is-present-in-a-data-object.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-determine-if-a-data-format-is-present-in-a-data-object" + "source_path": "docs/framework/winforms/high-dpi-support-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-determine-whether-a-freezable-is-frozen.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-determine-whether-a-freezable-is-frozen" + "source_path": "docs/framework/winforms/how-keyboard-input-works.md", + "redirect_url": "/dotnet/desktop/winforms/how-keyboard-input-works?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-diagnose-problematic-print-job.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-diagnose-problematic-print-job" + "source_path": "docs/framework/winforms/how-mouse-input-works-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-mouse-input-works-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-discover-whether-a-print-job-can-be-printed-at-this-time-of-day.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-discover-whether-a-print-job-can-be-printed-at-this-time-of-day" + "source_path": "docs/framework/winforms/how-to-access-keyed-collections-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-access-keyed-collections-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-drag-and-drop-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-drag-and-drop-ink" + "source_path": "docs/framework/winforms/how-to-apply-the-propertynamechanged-pattern.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-apply-the-propertynamechanged-pattern?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-draw-text-to-a-control-background.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-draw-text-to-a-control-background" + "source_path": "docs/framework/winforms/how-to-change-the-borders-of-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-change-the-borders-of-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-draw-text-to-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-draw-text-to-a-visual" + "source_path": "docs/framework/winforms/how-to-connect-multiple-events-to-a-single-event-handler-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-connect-multiple-events-to-a-single-event-handler-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-enable-a-command.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-a-command" + "source_path": "docs/framework/winforms/how-to-create-a-bound-control-and-format-the-displayed-data.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-bound-control-and-format-the-displayed-data?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-enable-text-trimming.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-text-trimming" + "source_path": "docs/framework/winforms/how-to-create-a-simple-bound-control-on-a-windows-form.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-simple-bound-control-on-a-windows-form?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application" + "source_path": "docs/framework/winforms/how-to-create-a-windows-forms-application-from-the-command-line.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-create-a-windows-forms-application-from-the-command-line?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-enumerate-a-subset-of-print-queues.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enumerate-a-subset-of-print-queues" + "source_path": "docs/framework/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-enumerate-system-fonts.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enumerate-system-fonts" + "source_path": "docs/framework/winforms/how-to-determine-which-modifier-key-was-pressed.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-determine-which-modifier-key-was-pressed?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-erase-ink-on-a-custom-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-erase-ink-on-a-custom-control" + "source_path": "docs/framework/winforms/how-to-display-dialog-boxes-for-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-display-dialog-boxes-for-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-find-an-element-by-its-name.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-find-an-element-by-its-name" + "source_path": "docs/framework/winforms/how-to-distinguish-between-clicks-and-double-clicks.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-distinguish-between-clicks-and-double-clicks?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-find-the-source-element-in-an-event-handler.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-find-the-source-element-in-an-event-handler" + "source_path": "docs/framework/winforms/how-to-handle-keyboard-input-at-the-form-level.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-handle-keyboard-input-at-the-form-level?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-flip-a-uielement-horizontally-or-vertically.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-flip-a-uielement-horizontally-or-vertically" + "source_path": "docs/framework/winforms/how-to-handle-user-input-events-in-windows-forms-controls.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-handle-user-input-events-in-windows-forms-controls?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-get-print-system-object-properties-without-reflection.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-get-print-system-object-properties-without-reflection" + "source_path": "docs/framework/winforms/how-to-implement-the-ilistsource-interface.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-ilistsource-interface?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-handle-a-loaded-event.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-a-loaded-event" + "source_path": "docs/framework/winforms/how-to-implement-the-inotifypropertychanged-interface.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-inotifypropertychanged-interface?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-handle-a-routed-event.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-a-routed-event" + "source_path": "docs/framework/winforms/how-to-implement-the-itypedlist-interface.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-implement-the-itypedlist-interface?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-handle-the-contextmenuopening-event.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-the-contextmenuopening-event" + "source_path": "docs/framework/winforms/how-to-modify-keyboard-input-to-a-standard-control.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-modify-keyboard-input-to-a-standard-control?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-command-support.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-command-support" + "source_path": "docs/framework/winforms/how-to-navigate-data-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-navigate-data-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-no-command-support.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-no-command-support" + "source_path": "docs/framework/winforms/how-to-resize-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-resize-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-implement-a-dependency-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-implement-a-dependency-property" + "source_path": "docs/framework/winforms/how-to-respond-to-font-scheme-changes-in-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-respond-to-font-scheme-changes-in-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-implement-icommandsource.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-implement-icommandsource" + "source_path": "docs/framework/winforms/how-to-simulate-mouse-and-keyboard-events-in-code.md", + "redirect_url": "/dotnet/desktop/winforms/how-to-simulate-mouse-and-keyboard-events-in-code?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-insert-an-element-into-text-programmatically.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-insert-an-element-into-text-programmatically" + "source_path": "docs/framework/winforms/index.md", + "redirect_url": "/dotnet/desktop/winforms/index?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-invoke-a-print-dialog.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-invoke-a-print-dialog" + "source_path": "docs/framework/winforms/interfaces-related-to-data-binding.md", + "redirect_url": "/dotnet/desktop/winforms/interfaces-related-to-data-binding?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-list-the-data-formats-in-a-data-object.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-list-the-data-formats-in-a-data-object" + "source_path": "docs/framework/winforms/keyboard-input-in-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/keyboard-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-localize-an-application.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-localize-an-application" + "source_path": "docs/framework/winforms/more-secure-file-and-data-access-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/more-secure-file-and-data-access-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-make-a-freezable-read-only.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-a-freezable-read-only" + "source_path": "docs/framework/winforms/more-secure-printing-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/more-secure-printing-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-make-a-uielement-transparent-or-semi-transparent.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-a-uielement-transparent-or-semi-transparent" + "source_path": "docs/framework/winforms/mouse-capture-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/mouse-capture-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-make-an-object-follow-the-mouse-pointer.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-an-object-follow-the-mouse-pointer" + "source_path": "docs/framework/winforms/mouse-events-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/mouse-events-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-manipulate-a-flowdocument-through-the-blocks-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-a-flowdocument-through-the-blocks-property" + "source_path": "docs/framework/winforms/mouse-input-in-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/mouse-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-blocks-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-blocks-property" + "source_path": "docs/framework/winforms/mouse-pointers-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/mouse-pointers-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-inlines-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-inlines-property" + "source_path": "docs/framework/winforms/multiple-controls-bound-to-data-source-synchronized.md", + "redirect_url": "/dotnet/desktop/winforms/multiple-controls-bound-to-data-source-synchronized?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-manipulate-table-columns-through-the-columns-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-table-columns-through-the-columns-property" + "source_path": "docs/framework/winforms/order-of-events-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/order-of-events-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-manipulate-table-row-groups-through-the-rowgroups-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-table-row-groups-through-the-rowgroups-property" + "source_path": "docs/framework/winforms/security-in-windows-forms-overview.md", + "redirect_url": "/dotnet/desktop/winforms/security-in-windows-forms-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-obtain-a-writable-copy-of-a-read-only-freezable.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-obtain-a-writable-copy-of-a-read-only-freezable" + "source_path": "docs/framework/winforms/user-input-in-a-windows-forms-application.md", + "redirect_url": "/dotnet/desktop/winforms/user-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-open-a-file-that-is-dropped-on-a-richtextbox-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-open-a-file-that-is-dropped-on-a-richtextbox-control" + "source_path": "docs/framework/winforms/user-input-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/user-input-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-override-metadata-for-a-dependency-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-override-metadata-for-a-dependency-property" + "source_path": "docs/framework/winforms/user-input-validation-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/winforms/user-input-validation-in-windows-forms?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-override-the-logical-tree.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-override-the-logical-tree" + "source_path": "docs/framework/winforms/using-keyboard-events.md", + "redirect_url": "/dotnet/desktop/winforms/using-keyboard-events?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-programmatically-print-xps-files.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-programmatically-print-xps-files" + "source_path": "docs/framework/winforms/windows-forms-accessibility-improvements.md", + "redirect_url": "/dotnet/desktop/winforms/windows-forms-accessibility-improvements?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-recognize-application-gestures.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-recognize-application-gestures" + "source_path": "docs/framework/winforms/windows-forms-coordinates.md", + "redirect_url": "/dotnet/desktop/winforms/windows-forms-coordinates?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-register-an-attached-property.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-register-an-attached-property" + "source_path": "docs/framework/winforms/windows-forms-data-binding.md", + "redirect_url": "/dotnet/desktop/winforms/windows-forms-data-binding?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-remotely-survey-the-status-of-printers.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-remotely-survey-the-status-of-printers" + "source_path": "docs/framework/winforms/windows-forms-overview.md", + "redirect_url": "/dotnet/desktop/winforms/windows-forms-overview?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-retrieve-data-in-a-particular-data-format.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-retrieve-data-in-a-particular-data-format" + "source_path": "docs/framework/winforms/windows-forms-security.md", + "redirect_url": "/dotnet/desktop/winforms/windows-forms-security?view=netframeworkdesktop-4.8" }, { - "source_path": "docs/framework/wpf/advanced/how-to-rotate-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-rotate-ink" + "source_path": "docs/framework/wpf/advanced/activate-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/activate-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/advanced/how-to-select-ink-from-a-custom-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-select-ink-from-a-custom-control" + "source_path": "docs/framework/wpf/advanced/advanced-ink-handling.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/advanced-ink-handling" }, { - "source_path": "docs/framework/wpf/advanced/how-to-set-margins-of-elements-and-controls.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-set-margins-of-elements-and-controls" + "source_path": "docs/framework/wpf/advanced/advanced-text-formatting.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/advanced-text-formatting" }, { - "source_path": "docs/framework/wpf/advanced/how-to-specify-whether-a-hyperlink-is-underlined.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-specify-whether-a-hyperlink-is-underlined" + "source_path": "docs/framework/wpf/advanced/alignment-margins-and-padding-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/alignment-margins-and-padding-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-store-multiple-data-formats-in-a-data-object.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-store-multiple-data-formats-in-a-data-object" + "source_path": "docs/framework/wpf/advanced/annotations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/annotations-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-a-grid-for-automatic-layout.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-grid-for-automatic-layout" + "source_path": "docs/framework/wpf/advanced/annotations-schema.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/annotations-schema" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-a-resourcedictionary-to-manage-localizable-string-resources.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-resourcedictionary-to-manage-localizable-string-resources" + "source_path": "docs/framework/wpf/advanced/annotations.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/annotations" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-a-thicknessconverter-object.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-thicknessconverter-object" + "source_path": "docs/framework/wpf/advanced/application-startup-time.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/application-startup-time" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-application-resources.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-application-resources" + "source_path": "docs/framework/wpf/advanced/attached-events-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/attached-events-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-automatic-layout-to-create-a-button.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-automatic-layout-to-create-a-button" + "source_path": "docs/framework/wpf/advanced/attached-properties-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/attached-properties-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-flow-content-elements.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-flow-content-elements" + "source_path": "docs/framework/wpf/advanced/base-elements-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-flowdocument-column-separating-attributes.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-flowdocument-column-separating-attributes" + "source_path": "docs/framework/wpf/advanced/base-elements-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-resources-in-localizable-applications.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-resources-in-localizable-applications" + "source_path": "docs/framework/wpf/advanced/base-elements.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/base-elements" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-special-characters-in-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-special-characters-in-xaml" + "source_path": "docs/framework/wpf/advanced/bidirectional-features-in-wpf-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/bidirectional-features-in-wpf-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-system-fonts-keys.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-system-fonts-keys" + "source_path": "docs/framework/wpf/advanced/binding-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/binding-markup-extension" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-system-parameters-keys.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-system-parameters-keys" + "source_path": "docs/framework/wpf/advanced/cleartype-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/cleartype-overview" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-systemfonts.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-systemfonts" + "source_path": "docs/framework/wpf/advanced/cleartype-registry-settings.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/cleartype-registry-settings" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-systemparameters.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-systemparameters" + "source_path": "docs/framework/wpf/advanced/code-behind-and-xaml-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/code-behind-and-xaml-in-wpf" }, { - "source_path": "docs/framework/wpf/advanced/how-to-use-the-fontsizeconverter-class.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-the-fontsizeconverter-class" + "source_path": "docs/framework/wpf/advanced/collecting-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/collecting-ink" }, { - "source_path": "docs/framework/wpf/advanced/how-to-validate-and-merge-printtickets.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-validate-and-merge-printtickets" + "source_path": "docs/framework/wpf/advanced/collection-type-dependency-properties.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/collection-type-dependency-properties" }, { - "source_path": "docs/framework/wpf/advanced/index.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/index" + "source_path": "docs/framework/wpf/advanced/colorconvertedbitmap-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/colorconvertedbitmap-markup-extension" }, { - "source_path": "docs/framework/wpf/advanced/initialization-for-object-elements-not-in-an-object-tree.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/initialization-for-object-elements-not-in-an-object-tree" + "source_path": "docs/framework/wpf/advanced/commanding-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/commanding-overview" }, { - "source_path": "docs/framework/wpf/advanced/inline-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/inline-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/componentresourcekey-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/componentresourcekey-markup-extension" }, { - "source_path": "docs/framework/wpf/advanced/input-and-commands-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/input-and-commands-how-to-topics" + "source_path": "docs/framework/wpf/advanced/createidispatchstaforwarder-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/createidispatchstaforwarder-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/advanced/input-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/input-overview" + "source_path": "docs/framework/wpf/advanced/creating-an-ink-input-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/creating-an-ink-input-control" }, { - "source_path": "docs/framework/wpf/advanced/input-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/input-wpf" + "source_path": "docs/framework/wpf/advanced/custom-dependency-properties.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/custom-dependency-properties" }, { - "source_path": "docs/framework/wpf/advanced/intercepting-input-from-the-stylus.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/intercepting-input-from-the-stylus" + "source_path": "docs/framework/wpf/advanced/custom-rendering-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/custom-rendering-ink" }, { - "source_path": "docs/framework/wpf/advanced/introduction-to-the-glyphrun-object-and-glyphs-element.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/introduction-to-the-glyphrun-object-and-glyphs-element" + "source_path": "docs/framework/wpf/advanced/data-and-data-objects.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/data-and-data-objects" }, { - "source_path": "docs/framework/wpf/advanced/layout-considerations-for-the-windowsformshost-element.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/layout-considerations-for-the-windowsformshost-element" + "source_path": "docs/framework/wpf/advanced/datetime-xaml-syntax.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/datetime-xaml-syntax" }, { - "source_path": "docs/framework/wpf/advanced/layout.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/layout" + "source_path": "docs/framework/wpf/advanced/deactivate-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/deactivate-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/advanced/loadfromhistory-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/loadfromhistory-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/wpf/advanced/dependency-properties-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-properties-overview" }, { - "source_path": "docs/framework/wpf/advanced/localization-attributes-and-comments.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/localization-attributes-and-comments" + "source_path": "docs/framework/wpf/advanced/dependency-property-callbacks-and-validation.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-callbacks-and-validation" }, { - "source_path": "docs/framework/wpf/advanced/marking-routed-events-as-handled-and-class-handling.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/marking-routed-events-as-handled-and-class-handling" + "source_path": "docs/framework/wpf/advanced/dependency-property-metadata.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-metadata" }, { - "source_path": "docs/framework/wpf/advanced/markup-compatibility-mc-language-features.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/markup-compatibility-mc-language-features" + "source_path": "docs/framework/wpf/advanced/dependency-property-security.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-security" }, { - "source_path": "docs/framework/wpf/advanced/markup-extensions-and-wpf-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/markup-extensions-and-wpf-xaml" + "source_path": "docs/framework/wpf/advanced/dependency-property-value-precedence.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dependency-property-value-precedence" }, { - "source_path": "docs/framework/wpf/advanced/mc-ignorable-attribute.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/mc-ignorable-attribute" + "source_path": "docs/framework/wpf/advanced/digital-ink-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/mc-processcontent-attribute.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/mc-processcontent-attribute" + "source_path": "docs/framework/wpf/advanced/digital-ink-overviews.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink-overviews" }, { - "source_path": "docs/framework/wpf/advanced/merged-resource-dictionaries.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/merged-resource-dictionaries" + "source_path": "docs/framework/wpf/advanced/digital-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/digital-ink" }, { - "source_path": "docs/framework/wpf/advanced/migration-and-interoperability.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/migration-and-interoperability" + "source_path": "docs/framework/wpf/advanced/disable-the-realtimestylus-for-wpf-applications.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/disable-the-realtimestylus-for-wpf-applications" }, { - "source_path": "docs/framework/wpf/advanced/object-lifetime-events.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/object-lifetime-events" + "source_path": "docs/framework/wpf/advanced/document-serialization-and-storage.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/document-serialization-and-storage" }, { - "source_path": "docs/framework/wpf/advanced/opentype-font-features.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/opentype-font-features" + "source_path": "docs/framework/wpf/advanced/documents-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/documents-in-wpf" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-2d-graphics-and-imaging.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-2d-graphics-and-imaging" + "source_path": "docs/framework/wpf/advanced/documents.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/documents" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-application-resources.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-application-resources" + "source_path": "docs/framework/wpf/advanced/drag-and-drop-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-controls.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-controls" + "source_path": "docs/framework/wpf/advanced/drag-and-drop-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop-overview" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-data-binding.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-data-binding" + "source_path": "docs/framework/wpf/advanced/drag-and-drop.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/drag-and-drop" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-layout-and-design.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-layout-and-design" + "source_path": "docs/framework/wpf/advanced/draw-text-using-glyphs.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/draw-text-using-glyphs" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-object-behavior.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-object-behavior" + "source_path": "docs/framework/wpf/advanced/drawing-formatted-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/drawing-formatted-text" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-other-recommendations.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-other-recommendations" + "source_path": "docs/framework/wpf/advanced/dynamicresource-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/dynamicresource-markup-extension" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-taking-advantage-of-hardware.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-taking-advantage-of-hardware" + "source_path": "docs/framework/wpf/advanced/element-tree-and-serialization-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/element-tree-and-serialization-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-performance-text.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-text" + "source_path": "docs/framework/wpf/advanced/element-tree-and-serialization.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/element-tree-and-serialization" }, { - "source_path": "docs/framework/wpf/advanced/optimizing-wpf-application-performance.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-wpf-application-performance" + "source_path": "docs/framework/wpf/advanced/events-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/events-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/packaging-fonts-with-applications.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/packaging-fonts-with-applications" + "source_path": "docs/framework/wpf/advanced/events-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/events-wpf" }, { - "source_path": "docs/framework/wpf/advanced/performance-considerations-for-direct3d9-and-wpf-interoperability.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/performance-considerations-for-direct3d9-and-wpf-interoperability" + "source_path": "docs/framework/wpf/advanced/flow-content-elements-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/flow-content-elements-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/performance.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/performance" + "source_path": "docs/framework/wpf/advanced/flow-content.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/flow-content" }, { - "source_path": "docs/framework/wpf/advanced/planning-for-application-performance.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/planning-for-application-performance" + "source_path": "docs/framework/wpf/advanced/flow-document-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/flow-document-overview" }, { - "source_path": "docs/framework/wpf/advanced/presentationoptions-freeze-attribute.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/presentationoptions-freeze-attribute" + "source_path": "docs/framework/wpf/advanced/focus-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/focus-overview" }, { - "source_path": "docs/framework/wpf/advanced/preview-events.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/preview-events" + "source_path": "docs/framework/wpf/advanced/fonts-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/fonts-how-to-topics" }, { - "source_path": "docs/framework/wpf/advanced/printing-and-print-system-management.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/printing-and-print-system-management" + "source_path": "docs/framework/wpf/advanced/fonts-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/fonts-wpf" }, { - "source_path": "docs/framework/wpf/advanced/printing-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/printing-how-to-topics" + "source_path": "docs/framework/wpf/advanced/forwardtranslateaccelerator-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/forwardtranslateaccelerator-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/advanced/printing-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/printing-overview" + "source_path": "docs/framework/wpf/advanced/framework-property-metadata.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/framework-property-metadata" }, { - "source_path": "docs/framework/wpf/advanced/processunhandledexception-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/processunhandledexception-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/wpf/advanced/freezable-objects-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/freezable-objects-overview" }, { - "source_path": "docs/framework/wpf/advanced/properties-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/properties-how-to-topics" + "source_path": "docs/framework/wpf/advanced/getting-started-with-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/getting-started-with-ink" }, { - "source_path": "docs/framework/wpf/advanced/properties-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/properties-wpf" + "source_path": "docs/framework/wpf/advanced/globalization-and-localization-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-localize-an-application", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/advanced/property-change-events.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/property-change-events" + "source_path": "docs/framework/wpf/advanced/globalization-and-localization.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/globalization-and-localization" }, { - "source_path": "docs/framework/wpf/advanced/property-value-inheritance.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/property-value-inheritance" + "source_path": "docs/framework/wpf/advanced/globalization-for-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/globalization-for-wpf" }, { - "source_path": "docs/framework/wpf/advanced/propertypath-xaml-syntax.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/propertypath-xaml-syntax" + "source_path": "docs/framework/wpf/advanced/glyphs.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/glyphs" }, { - "source_path": "docs/framework/wpf/advanced/read-only-dependency-properties.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/read-only-dependency-properties" + "source_path": "docs/framework/wpf/advanced/graphics-rendering-tiers.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/graphics-rendering-tiers" }, { - "source_path": "docs/framework/wpf/advanced/relativesource-markupextension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/relativesource-markupextension" + "source_path": "docs/framework/wpf/advanced/handwriting-recognition.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/handwriting-recognition" }, { - "source_path": "docs/framework/wpf/advanced/resources-and-code.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/resources-and-code" + "source_path": "docs/framework/wpf/advanced/hosting-win32-content-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/hosting-win32-content-in-wpf" }, { - "source_path": "docs/framework/wpf/advanced/resources-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/resources-how-to-topics" + "source_path": "docs/framework/wpf/advanced/how-to-add-an-event-handler-using-code.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-an-event-handler-using-code" }, { - "source_path": "docs/framework/wpf/advanced/resources-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/resources-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-add-an-owner-type-for-a-dependency-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-an-owner-type-for-a-dependency-property" }, { - "source_path": "docs/framework/wpf/advanced/routed-events-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/routed-events-overview" + "source_path": "docs/framework/wpf/advanced/how-to-add-class-handling-for-a-routed-event.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-class-handling-for-a-routed-event" }, { - "source_path": "docs/framework/wpf/advanced/safe-constructor-patterns-for-dependencyobjects.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/safe-constructor-patterns-for-dependencyobjects" + "source_path": "docs/framework/wpf/advanced/how-to-add-custom-data-to-ink-data.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-add-custom-data-to-ink-data" }, { - "source_path": "docs/framework/wpf/advanced/sample-opentype-font-pack.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/sample-opentype-font-pack" + "source_path": "docs/framework/wpf/advanced/how-to-adjust-spacing-between-paragraphs.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-adjust-spacing-between-paragraphs" }, { - "source_path": "docs/framework/wpf/advanced/savetohistory-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/savetohistory-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/wpf/advanced/how-to-alter-the-typography-of-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-alter-the-typography-of-text" }, { - "source_path": "docs/framework/wpf/advanced/serialization-limitations-of-xamlwriter-save.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/serialization-limitations-of-xamlwriter-save" + "source_path": "docs/framework/wpf/advanced/how-to-analyze-ink-with-analysis-hints.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-analyze-ink-with-analysis-hints" }, { - "source_path": "docs/framework/wpf/advanced/setfakeactivewindow-function-wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/setfakeactivewindow-function-wpf-unmanaged-api-reference" + "source_path": "docs/framework/wpf/advanced/how-to-animate-the-size-of-a-frameworkelement.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-animate-the-size-of-a-frameworkelement" }, { - "source_path": "docs/framework/wpf/advanced/sharing-message-loops-between-win32-and-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/sharing-message-loops-between-win32-and-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-apply-a-focusvisualstyle-to-a-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-a-focusvisualstyle-to-a-control" }, { - "source_path": "docs/framework/wpf/advanced/staticresource-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/staticresource-markup-extension" + "source_path": "docs/framework/wpf/advanced/how-to-apply-animations-to-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-animations-to-text" }, { - "source_path": "docs/framework/wpf/advanced/storing-ink.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/storing-ink" + "source_path": "docs/framework/wpf/advanced/how-to-apply-transforms-to-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-apply-transforms-to-text" }, { - "source_path": "docs/framework/wpf/advanced/styling-for-focus-in-controls-and-focusvisualstyle.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/styling-for-focus-in-controls-and-focusvisualstyle" + "source_path": "docs/framework/wpf/advanced/how-to-build-a-table-programmatically.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-build-a-table-programmatically" }, { - "source_path": "docs/framework/wpf/advanced/table-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/table-overview" + "source_path": "docs/framework/wpf/advanced/how-to-change-the-color-of-an-element-using-focus-events.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-color-of-an-element-using-focus-events" }, { - "source_path": "docs/framework/wpf/advanced/technology-regions-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/technology-regions-overview" + "source_path": "docs/framework/wpf/advanced/how-to-change-the-cursor-type.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-cursor-type" }, { - "source_path": "docs/framework/wpf/advanced/templatebinding-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/templatebinding-markup-extension" + "source_path": "docs/framework/wpf/advanced/how-to-change-the-flowdirection-of-content-programmatically.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-flowdirection-of-content-programmatically" }, { - "source_path": "docs/framework/wpf/advanced/textelement-content-model-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/textelement-content-model-overview" + "source_path": "docs/framework/wpf/advanced/how-to-change-the-textwrapping-property-programmatically.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-change-the-textwrapping-property-programmatically" }, { - "source_path": "docs/framework/wpf/advanced/the-ink-object-model-windows-forms-and-com-versus-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/the-ink-object-model-windows-forms-and-com-versus-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-clone-a-printer.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-clone-a-printer" }, { - "source_path": "docs/framework/wpf/advanced/the-ink-threading-model.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/the-ink-threading-model" + "source_path": "docs/framework/wpf/advanced/how-to-create-a-custom-routed-event.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-custom-routed-event" }, { - "source_path": "docs/framework/wpf/advanced/themedictionary-markup-extension.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/themedictionary-markup-extension" + "source_path": "docs/framework/wpf/advanced/how-to-create-a-data-object.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-data-object" }, { - "source_path": "docs/framework/wpf/advanced/threading-model.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/threading-model" + "source_path": "docs/framework/wpf/advanced/how-to-create-a-rollover-effect-using-events.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-rollover-effect-using-events" }, { - "source_path": "docs/framework/wpf/advanced/trees-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/trees-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-create-a-routedcommand.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-routedcommand" }, { - "source_path": "docs/framework/wpf/advanced/troubleshooting-hybrid-applications.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/troubleshooting-hybrid-applications" + "source_path": "docs/framework/wpf/advanced/how-to-create-a-text-decoration.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-a-text-decoration" }, { - "source_path": "docs/framework/wpf/advanced/typeconverters-and-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/typeconverters-and-xaml" + "source_path": "docs/framework/wpf/advanced/how-to-create-outlined-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-outlined-text" }, { - "source_path": "docs/framework/wpf/advanced/types-migrated-from-wpf-to-system.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system" + "source_path": "docs/framework/wpf/advanced/how-to-create-text-with-a-shadow.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-create-text-with-a-shadow" }, { - "source_path": "docs/framework/wpf/advanced/typography-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/typography-how-to-topics" + "source_path": "docs/framework/wpf/advanced/how-to-data-bind-to-an-inkcanvas.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-data-bind-to-an-inkcanvas" }, { - "source_path": "docs/framework/wpf/advanced/typography-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/typography-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-define-a-table-with-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-define-a-table-with-xaml" }, { - "source_path": "docs/framework/wpf/advanced/typography.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/typography" + "source_path": "docs/framework/wpf/advanced/how-to-define-and-reference-a-resource.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-define-and-reference-a-resource" }, { - "source_path": "docs/framework/wpf/advanced/use-automatic-layout-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/use-automatic-layout-overview" + "source_path": "docs/framework/wpf/advanced/how-to-detect-when-the-enter-key-pressed.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-detect-when-the-enter-key-pressed" }, { - "source_path": "docs/framework/wpf/advanced/visual-basic-and-wpf-event-handling.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/visual-basic-and-wpf-event-handling" + "source_path": "docs/framework/wpf/advanced/how-to-determine-if-a-data-format-is-present-in-a-data-object.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-determine-if-a-data-format-is-present-in-a-data-object" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-arranging-windows-forms-controls-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-arranging-windows-forms-controls-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-determine-whether-a-freezable-is-frozen.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-determine-whether-a-freezable-is-frozen" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-binding-to-data-in-hybrid-applications.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-binding-to-data-in-hybrid-applications" + "source_path": "docs/framework/wpf/advanced/how-to-diagnose-problematic-print-job.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-diagnose-problematic-print-job" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-caching-application-data-in-a-wpf-application.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-caching-application-data-in-a-wpf-application" + "source_path": "docs/framework/wpf/advanced/how-to-discover-whether-a-print-job-can-be-printed-at-this-time-of-day.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-discover-whether-a-print-job-can-be-printed-at-this-time-of-day" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-creating-direct3d9-content-for-hosting-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-creating-direct3d9-content-for-hosting-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-drag-and-drop-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-drag-and-drop-ink" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-creating-your-first-touch-application.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-creating-your-first-touch-application" + "source_path": "docs/framework/wpf/advanced/how-to-draw-text-to-a-control-background.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-draw-text-to-a-control-background" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-enabling-drag-and-drop-on-a-user-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-enabling-drag-and-drop-on-a-user-control" + "source_path": "docs/framework/wpf/advanced/how-to-draw-text-to-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-draw-text-to-a-visual" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-3-d-wpf-composite-control-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-3-d-wpf-composite-control-in-windows-forms" + "source_path": "docs/framework/wpf/advanced/how-to-enable-a-command.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-a-command" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-win32-control-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-win32-control-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-enable-text-trimming.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-text-trimming" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-composite-control-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-composite-control-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enable-visual-styles-in-a-hybrid-application" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml" + "source_path": "docs/framework/wpf/advanced/how-to-enumerate-a-subset-of-print-queues.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enumerate-a-subset-of-print-queues" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-enumerate-system-fonts.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-enumerate-system-fonts" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-wpf-clock-in-win32.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-wpf-clock-in-win32" + "source_path": "docs/framework/wpf/advanced/how-to-erase-ink-on-a-custom-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-erase-ink-on-a-custom-control" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-wpf-composite-control-in-windows-forms.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-wpf-composite-control-in-windows-forms" + "source_path": "docs/framework/wpf/advanced/how-to-find-an-element-by-its-name.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-find-an-element-by-its-name" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-an-activex-control-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-an-activex-control-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-find-the-source-element-in-an-event-handler.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-find-the-source-element-in-an-event-handler" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-direct3d9-content-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-direct3d9-content-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-flip-a-uielement-horizontally-or-vertically.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-flip-a-uielement-horizontally-or-vertically" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-wpf-content-in-win32.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-wpf-content-in-win32" + "source_path": "docs/framework/wpf/advanced/how-to-get-print-system-object-properties-without-reflection.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-get-print-system-object-properties-without-reflection" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-localizing-a-hybrid-application.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-localizing-a-hybrid-application" + "source_path": "docs/framework/wpf/advanced/how-to-handle-a-loaded-event.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-a-loaded-event" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-mapping-properties-using-the-elementhost-control.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-mapping-properties-using-the-elementhost-control" + "source_path": "docs/framework/wpf/advanced/how-to-handle-a-routed-event.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-a-routed-event" }, { - "source_path": "docs/framework/wpf/advanced/walkthrough-mapping-properties-using-the-windowsformshost-element.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-mapping-properties-using-the-windowsformshost-element" + "source_path": "docs/framework/wpf/advanced/how-to-handle-the-contextmenuopening-event.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-handle-the-contextmenuopening-event" }, { - "source_path": "docs/framework/wpf/advanced/weak-event-patterns.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/weak-event-patterns" + "source_path": "docs/framework/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-command-support.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-command-support" }, { - "source_path": "docs/framework/wpf/advanced/windows-forms-and-wpf-interoperability-input-architecture.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-and-wpf-interoperability-input-architecture" + "source_path": "docs/framework/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-no-command-support.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-hook-up-a-command-to-a-control-with-no-command-support" }, { - "source_path": "docs/framework/wpf/advanced/windows-forms-and-wpf-property-mapping.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-and-wpf-property-mapping" + "source_path": "docs/framework/wpf/advanced/how-to-implement-a-dependency-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-implement-a-dependency-property" }, { - "source_path": "docs/framework/wpf/advanced/windows-forms-controls-and-equivalent-wpf-controls.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-controls-and-equivalent-wpf-controls" + "source_path": "docs/framework/wpf/advanced/how-to-implement-icommandsource.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-implement-icommandsource" }, { - "source_path": "docs/framework/wpf/advanced/wpf-and-direct3d9-interoperation.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-direct3d9-interoperation" + "source_path": "docs/framework/wpf/advanced/how-to-insert-an-element-into-text-programmatically.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-insert-an-element-into-text-programmatically" }, { - "source_path": "docs/framework/wpf/advanced/wpf-and-win32-interoperation.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-win32-interoperation" + "source_path": "docs/framework/wpf/advanced/how-to-invoke-a-print-dialog.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-invoke-a-print-dialog" }, { - "source_path": "docs/framework/wpf/advanced/wpf-and-windows-forms-interoperation.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-windows-forms-interoperation" + "source_path": "docs/framework/wpf/advanced/how-to-list-the-data-formats-in-a-data-object.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-list-the-data-formats-in-a-data-object" }, { - "source_path": "docs/framework/wpf/advanced/wpf-architecture.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-architecture" + "source_path": "docs/framework/wpf/advanced/how-to-localize-an-application.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-localize-an-application" }, { - "source_path": "docs/framework/wpf/advanced/wpf-globalization-and-localization-overview.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-globalization-and-localization-overview" + "source_path": "docs/framework/wpf/advanced/how-to-make-a-freezable-read-only.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-a-freezable-read-only" }, { - "source_path": "docs/framework/wpf/advanced/wpf-unmanaged-api-reference.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-unmanaged-api-reference" + "source_path": "docs/framework/wpf/advanced/how-to-make-a-uielement-transparent-or-semi-transparent.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-a-uielement-transparent-or-semi-transparent" }, { - "source_path": "docs/framework/wpf/advanced/wpf-xaml-extensions.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-xaml-extensions" + "source_path": "docs/framework/wpf/advanced/how-to-make-an-object-follow-the-mouse-pointer.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-make-an-object-follow-the-mouse-pointer" }, { - "source_path": "docs/framework/wpf/advanced/wpf-xaml-namescopes.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-xaml-namescopes" + "source_path": "docs/framework/wpf/advanced/how-to-manipulate-a-flowdocument-through-the-blocks-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-a-flowdocument-through-the-blocks-property" }, { - "source_path": "docs/framework/wpf/advanced/xaml-and-custom-classes-for-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-and-custom-classes-for-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-blocks-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-blocks-property" }, { - "source_path": "docs/framework/wpf/advanced/xaml-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-in-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-inlines-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-flow-content-elements-through-the-inlines-property" }, { - "source_path": "docs/framework/wpf/advanced/xaml-loading-and-dependency-properties.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-loading-and-dependency-properties" + "source_path": "docs/framework/wpf/advanced/how-to-manipulate-table-columns-through-the-columns-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-table-columns-through-the-columns-property" }, { - "source_path": "docs/framework/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml" + "source_path": "docs/framework/wpf/advanced/how-to-manipulate-table-row-groups-through-the-rowgroups-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-manipulate-table-row-groups-through-the-rowgroups-property" }, { - "source_path": "docs/framework/wpf/advanced/xaml-overview-wpf.md", - "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml", - "redirect_document_id": true + "source_path": "docs/framework/wpf/advanced/how-to-obtain-a-writable-copy-of-a-read-only-freezable.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-obtain-a-writable-copy-of-a-read-only-freezable" }, { - "source_path": "docs/framework/wpf/advanced/xaml-resources.md", - "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml-resources-define", - "redirect_document_id": true + "source_path": "docs/framework/wpf/advanced/how-to-open-a-file-that-is-dropped-on-a-richtextbox-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-open-a-file-that-is-dropped-on-a-richtextbox-control" }, { - "source_path": "docs/framework/wpf/advanced/xaml-syntax-in-detail.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-syntax-in-detail" + "source_path": "docs/framework/wpf/advanced/how-to-override-metadata-for-a-dependency-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-override-metadata-for-a-dependency-property" }, { - "source_path": "docs/framework/wpf/app-development/application-management-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/application-management-overview" + "source_path": "docs/framework/wpf/advanced/how-to-override-the-logical-tree.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-override-the-logical-tree" }, { - "source_path": "docs/framework/wpf/app-development/build-and-deploy-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/build-and-deploy-how-to-topics" + "source_path": "docs/framework/wpf/advanced/how-to-programmatically-print-xps-files.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-programmatically-print-xps-files" }, { - "source_path": "docs/framework/wpf/app-development/building-a-wpf-application-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/building-a-wpf-application-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-recognize-application-gestures.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-recognize-application-gestures" }, { - "source_path": "docs/framework/wpf/app-development/building-and-deploying-wpf-applications.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/building-and-deploying-wpf-applications" + "source_path": "docs/framework/wpf/advanced/how-to-register-an-attached-property.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-register-an-attached-property" }, { - "source_path": "docs/framework/wpf/app-development/configure-vs-to-debug-a-xaml-browser-to-call-a-web-service.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/configure-vs-to-debug-a-xaml-browser-to-call-a-web-service" + "source_path": "docs/framework/wpf/advanced/how-to-remotely-survey-the-status-of-printers.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-remotely-survey-the-status-of-printers" }, { - "source_path": "docs/framework/wpf/app-development/deploying-a-wpf-application-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/deploying-a-wpf-application-wpf" + "source_path": "docs/framework/wpf/advanced/how-to-retrieve-data-in-a-particular-data-format.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-retrieve-data-in-a-particular-data-format" }, { - "source_path": "docs/framework/wpf/app-development/dialog-boxes-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/dialog-boxes-overview" + "source_path": "docs/framework/wpf/advanced/how-to-rotate-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-rotate-ink" }, { - "source_path": "docs/framework/wpf/app-development/filterinputmessage.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/filterinputmessage" + "source_path": "docs/framework/wpf/advanced/how-to-select-ink-from-a-custom-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-select-ink-from-a-custom-control" }, { - "source_path": "docs/framework/wpf/app-development/firefox-add-ons-to-support-net-application-deployment.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/firefox-add-ons-to-support-net-application-deployment" + "source_path": "docs/framework/wpf/advanced/how-to-set-margins-of-elements-and-controls.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-set-margins-of-elements-and-controls" }, { - "source_path": "docs/framework/wpf/app-development/getcustomui.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/getcustomui" + "source_path": "docs/framework/wpf/advanced/how-to-specify-whether-a-hyperlink-is-underlined.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-specify-whether-a-hyperlink-is-underlined" }, { - "source_path": "docs/framework/wpf/app-development/getrawinputdevices.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/getrawinputdevices" + "source_path": "docs/framework/wpf/advanced/how-to-store-multiple-data-formats-in-a-data-object.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-store-multiple-data-formats-in-a-data-object" }, { - "source_path": "docs/framework/wpf/app-development/hosting-wpf-applications.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/hosting-wpf-applications" + "source_path": "docs/framework/wpf/advanced/how-to-use-a-grid-for-automatic-layout.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-grid-for-automatic-layout" }, { - "source_path": "docs/framework/wpf/app-development/how-to-add-a-splash-screen-to-a-wpf-application.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-add-a-splash-screen-to-a-wpf-application" + "source_path": "docs/framework/wpf/advanced/how-to-use-a-resourcedictionary-to-manage-localizable-string-resources.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-resourcedictionary-to-manage-localizable-string-resources" }, { - "source_path": "docs/framework/wpf/app-development/how-to-automatically-size-a-window-to-fit-its-content.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-automatically-size-a-window-to-fit-its-content" + "source_path": "docs/framework/wpf/advanced/how-to-use-a-thicknessconverter-object.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-a-thicknessconverter-object" }, { - "source_path": "docs/framework/wpf/app-development/how-to-call-a-page-function.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-call-a-page-function" + "source_path": "docs/framework/wpf/advanced/how-to-use-application-resources.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-application-resources" }, { - "source_path": "docs/framework/wpf/app-development/how-to-configure-iis-5-0-and-iis-6-0-to-deploy-wpf-applications.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-configure-iis-5-0-and-iis-6-0-to-deploy-wpf-applications" + "source_path": "docs/framework/wpf/advanced/how-to-use-automatic-layout-to-create-a-button.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-automatic-layout-to-create-a-button" }, { - "source_path": "docs/framework/wpf/app-development/how-to-create-an-add-in-that-is-a-ui.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-create-an-add-in-that-is-a-ui" + "source_path": "docs/framework/wpf/advanced/how-to-use-flow-content-elements.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-flow-content-elements" }, { - "source_path": "docs/framework/wpf/app-development/how-to-create-an-add-in-that-returns-a-ui.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-create-an-add-in-that-returns-a-ui" + "source_path": "docs/framework/wpf/advanced/how-to-use-flowdocument-column-separating-attributes.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-flowdocument-column-separating-attributes" }, { - "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-net-framework-3-0-is-installed.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-net-framework-3-0-is-installed" + "source_path": "docs/framework/wpf/advanced/how-to-use-resources-in-localizable-applications.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-resources-in-localizable-applications" }, { - "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-net-framework-3-5-is-installed.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-net-framework-3-5-is-installed" + "source_path": "docs/framework/wpf/advanced/how-to-use-special-characters-in-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-special-characters-in-xaml" }, { - "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-wpf-plug-in-for-firefox-is-installed.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-wpf-plug-in-for-firefox-is-installed" + "source_path": "docs/framework/wpf/advanced/how-to-use-system-fonts-keys.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-system-fonts-keys" }, { - "source_path": "docs/framework/wpf/app-development/how-to-determine-if-a-page-is-browser-hosted.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-determine-if-a-page-is-browser-hosted" + "source_path": "docs/framework/wpf/advanced/how-to-use-system-parameters-keys.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-system-parameters-keys" }, { - "source_path": "docs/framework/wpf/app-development/how-to-determine-the-installed-version-of-wpf.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/aa349641(v=vs.90)" + "source_path": "docs/framework/wpf/advanced/how-to-use-systemfonts.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-systemfonts" }, { - "source_path": "docs/framework/wpf/app-development/how-to-get-all-windows-in-an-application.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-all-windows-in-an-application" + "source_path": "docs/framework/wpf/advanced/how-to-use-systemparameters.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-systemparameters" }, { - "source_path": "docs/framework/wpf/app-development/how-to-get-and-set-the-main-application-window.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-and-set-the-main-application-window" + "source_path": "docs/framework/wpf/advanced/how-to-use-the-fontsizeconverter-class.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-use-the-fontsizeconverter-class" }, { - "source_path": "docs/framework/wpf/app-development/how-to-get-the-return-value-of-a-page-function.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-the-return-value-of-a-page-function" + "source_path": "docs/framework/wpf/advanced/how-to-validate-and-merge-printtickets.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/how-to-validate-and-merge-printtickets" }, { - "source_path": "docs/framework/wpf/app-development/how-to-navigate-back-through-navigation-history.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-back-through-navigation-history" + "source_path": "docs/framework/wpf/advanced/index.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/index" }, { - "source_path": "docs/framework/wpf/app-development/how-to-navigate-forward-or-back-through-navigation-history.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-forward-or-back-through-navigation-history" + "source_path": "docs/framework/wpf/advanced/initialization-for-object-elements-not-in-an-object-tree.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/initialization-for-object-elements-not-in-an-object-tree" }, { - "source_path": "docs/framework/wpf/app-development/how-to-navigate-to-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-to-a-page" + "source_path": "docs/framework/wpf/advanced/inline-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/inline-styles-and-templates" }, { - "source_path": "docs/framework/wpf/app-development/how-to-open-a-dialog-box.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-dialog-box" + "source_path": "docs/framework/wpf/advanced/input-and-commands-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/input-and-commands-how-to-topics" }, { - "source_path": "docs/framework/wpf/app-development/how-to-open-a-message-box.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-message-box" + "source_path": "docs/framework/wpf/advanced/input-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/input-overview" }, { - "source_path": "docs/framework/wpf/app-development/how-to-open-a-window.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-window" + "source_path": "docs/framework/wpf/advanced/input-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/input-wpf" }, { - "source_path": "docs/framework/wpf/app-development/how-to-refresh-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-refresh-a-page" + "source_path": "docs/framework/wpf/advanced/intercepting-input-from-the-stylus.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/intercepting-input-from-the-stylus" }, { - "source_path": "docs/framework/wpf/app-development/how-to-return-a-dialog-box-result.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-return-a-dialog-box-result" + "source_path": "docs/framework/wpf/advanced/introduction-to-the-glyphrun-object-and-glyphs-element.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/introduction-to-the-glyphrun-object-and-glyphs-element" }, { - "source_path": "docs/framework/wpf/app-development/how-to-return-from-a-page-function.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-return-from-a-page-function" + "source_path": "docs/framework/wpf/advanced/layout-considerations-for-the-windowsformshost-element.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/layout-considerations-for-the-windowsformshost-element" }, { - "source_path": "docs/framework/wpf/app-development/how-to-set-the-height-of-a-window-from-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-height-of-a-window-from-a-page" + "source_path": "docs/framework/wpf/advanced/layout.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/layout" }, { - "source_path": "docs/framework/wpf/app-development/how-to-set-the-title-of-a-window-from-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-title-of-a-window-from-a-page" + "source_path": "docs/framework/wpf/advanced/loadfromhistory-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/loadfromhistory-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/app-development/how-to-set-the-width-of-a-window-from-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-width-of-a-window-from-a-page" + "source_path": "docs/framework/wpf/advanced/localization-attributes-and-comments.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/localization-attributes-and-comments" }, { - "source_path": "docs/framework/wpf/app-development/how-to-stop-a-page-from-loading.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-stop-a-page-from-loading" + "source_path": "docs/framework/wpf/advanced/marking-routed-events-as-handled-and-class-handling.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/marking-routed-events-as-handled-and-class-handling" }, { - "source_path": "docs/framework/wpf/app-development/how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-topics" + "source_path": "docs/framework/wpf/advanced/markup-compatibility-mc-language-features.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/markup-compatibility-mc-language-features" }, { - "source_path": "docs/framework/wpf/app-development/how-to-use-an-application-scope-resource-dictionary.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-use-an-application-scope-resource-dictionary" + "source_path": "docs/framework/wpf/advanced/markup-extensions-and-wpf-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/markup-extensions-and-wpf-xaml" }, { - "source_path": "docs/framework/wpf/app-development/how-to-use-mailto-to-send-mail-from-a-page.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-use-mailto-to-send-mail-from-a-page" + "source_path": "docs/framework/wpf/advanced/mc-ignorable-attribute.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/mc-ignorable-attribute" }, { - "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-clone.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-clone" + "source_path": "docs/framework/wpf/advanced/mc-processcontent-attribute.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/mc-processcontent-attribute" }, { - "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-next.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-next" + "source_path": "docs/framework/wpf/advanced/merged-resource-dictionaries.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/merged-resource-dictionaries" }, { - "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-reset.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-reset" + "source_path": "docs/framework/wpf/advanced/migration-and-interoperability.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/migration-and-interoperability" }, { - "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-skip.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-skip" + "source_path": "docs/framework/wpf/advanced/object-lifetime-events.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/object-lifetime-events" }, { - "source_path": "docs/framework/wpf/app-development/ienumrawinputdevice.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevice" + "source_path": "docs/framework/wpf/advanced/opentype-font-features.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/opentype-font-features" }, { - "source_path": "docs/framework/wpf/app-development/index.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/index" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-2d-graphics-and-imaging.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-2d-graphics-and-imaging" }, { - "source_path": "docs/framework/wpf/app-development/iwpfhostsupport.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/iwpfhostsupport" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-application-resources.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-application-resources" }, { - "source_path": "docs/framework/wpf/app-development/native-wpf-browser-hosting-support-apis.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/native-wpf-browser-hosting-support-apis" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-controls.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-controls" }, { - "source_path": "docs/framework/wpf/app-development/navigation-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-how-to-topics" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-data-binding.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-data-binding" }, { - "source_path": "docs/framework/wpf/app-development/navigation-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-overview" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-layout-and-design.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-layout-and-design" }, { - "source_path": "docs/framework/wpf/app-development/navigation-topologies-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-topologies-overview" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-object-behavior.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-object-behavior" }, { - "source_path": "docs/framework/wpf/app-development/pack-uris-in-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/pack-uris-in-wpf" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-other-recommendations.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-other-recommendations" }, { - "source_path": "docs/framework/wpf/app-development/persist-and-restore-application-scope-properties.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/persist-and-restore-application-scope-properties" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-taking-advantage-of-hardware.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-taking-advantage-of-hardware" }, { - "source_path": "docs/framework/wpf/app-development/structured-navigation-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/structured-navigation-overview" + "source_path": "docs/framework/wpf/advanced/optimizing-performance-text.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-performance-text" }, { - "source_path": "docs/framework/wpf/app-development/window-management-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/window-management-how-to-topics" + "source_path": "docs/framework/wpf/advanced/optimizing-wpf-application-performance.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/optimizing-wpf-application-performance" }, { - "source_path": "docs/framework/wpf/app-development/windows-in-wpf-applications.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/windows-in-wpf-applications" + "source_path": "docs/framework/wpf/advanced/packaging-fonts-with-applications.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/packaging-fonts-with-applications" }, { - "source_path": "docs/framework/wpf/app-development/wpf-add-ins-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-add-ins-overview" + "source_path": "docs/framework/wpf/advanced/performance-considerations-for-direct3d9-and-wpf-interoperability.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/performance-considerations-for-direct3d9-and-wpf-interoperability" }, { - "source_path": "docs/framework/wpf/app-development/wpf-application-resource-content-and-data-files.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-application-resource-content-and-data-files" + "source_path": "docs/framework/wpf/advanced/performance.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/performance" }, { - "source_path": "docs/framework/wpf/app-development/wpf-host-presentationhost-exe.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-host-presentationhost-exe" + "source_path": "docs/framework/wpf/advanced/planning-for-application-performance.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/planning-for-application-performance" }, { - "source_path": "docs/framework/wpf/app-development/wpf-windows-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-windows-overview" + "source_path": "docs/framework/wpf/advanced/presentationoptions-freeze-attribute.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/presentationoptions-freeze-attribute" }, { - "source_path": "docs/framework/wpf/app-development/wpf-xaml-browser-applications-overview.md", - "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-xaml-browser-applications-overview" + "source_path": "docs/framework/wpf/advanced/preview-events.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/preview-events" }, { - "source_path": "docs/framework/wpf/class-library-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/class-library-wpf" + "source_path": "docs/framework/wpf/advanced/printing-and-print-system-management.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/printing-and-print-system-management" }, { - "source_path": "docs/framework/wpf/controls/adorners-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/adorners-how-to-topics" + "source_path": "docs/framework/wpf/advanced/printing-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/printing-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/adorners-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/adorners-overview" + "source_path": "docs/framework/wpf/advanced/printing-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/printing-overview" }, { - "source_path": "docs/framework/wpf/controls/adorners.md", - "redirect_url": "/dotnet/desktop/wpf/controls/adorners" + "source_path": "docs/framework/wpf/advanced/processunhandledexception-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/processunhandledexception-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/controls/border.md", - "redirect_url": "/dotnet/desktop/wpf/controls/border" + "source_path": "docs/framework/wpf/advanced/properties-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/properties-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/bulletdecorator.md", - "redirect_url": "/dotnet/desktop/wpf/controls/bulletdecorator" + "source_path": "docs/framework/wpf/advanced/properties-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/properties-wpf" }, { - "source_path": "docs/framework/wpf/controls/button-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/button-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/property-change-events.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/property-change-events" }, { - "source_path": "docs/framework/wpf/controls/button.md", - "redirect_url": "/dotnet/desktop/wpf/controls/button" + "source_path": "docs/framework/wpf/advanced/property-value-inheritance.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/property-value-inheritance" }, { - "source_path": "docs/framework/wpf/controls/calendar-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/calendar-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/propertypath-xaml-syntax.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/propertypath-xaml-syntax" }, { - "source_path": "docs/framework/wpf/controls/calendar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/calendar" + "source_path": "docs/framework/wpf/advanced/read-only-dependency-properties.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/read-only-dependency-properties" }, { - "source_path": "docs/framework/wpf/controls/canvas-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/canvas-how-to-topics" + "source_path": "docs/framework/wpf/advanced/relativesource-markupextension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/relativesource-markupextension" }, { - "source_path": "docs/framework/wpf/controls/canvas.md", - "redirect_url": "/dotnet/desktop/wpf/controls/canvas" + "source_path": "docs/framework/wpf/advanced/resources-and-code.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/resources-and-code" }, { - "source_path": "docs/framework/wpf/controls/change-selection-in-a-richtextbox-programmatically.md", - "redirect_url": "/dotnet/desktop/wpf/controls/change-selection-in-a-richtextbox-programmatically" + "source_path": "docs/framework/wpf/advanced/resources-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/resources-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/checkbox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/checkbox-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/resources-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/resources-wpf" }, { - "source_path": "docs/framework/wpf/controls/checkbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/checkbox" + "source_path": "docs/framework/wpf/advanced/routed-events-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/routed-events-overview" }, { - "source_path": "docs/framework/wpf/controls/combobox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/combobox-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/safe-constructor-patterns-for-dependencyobjects.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/safe-constructor-patterns-for-dependencyobjects" }, { - "source_path": "docs/framework/wpf/controls/combobox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/combobox" + "source_path": "docs/framework/wpf/advanced/sample-opentype-font-pack.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/sample-opentype-font-pack" }, { - "source_path": "docs/framework/wpf/controls/contextmenu-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu-overview" + "source_path": "docs/framework/wpf/advanced/savetohistory-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/savetohistory-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/controls/contextmenu-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/serialization-limitations-of-xamlwriter-save.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/serialization-limitations-of-xamlwriter-save" }, { - "source_path": "docs/framework/wpf/controls/contextmenu.md", - "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu" + "source_path": "docs/framework/wpf/advanced/setfakeactivewindow-function-wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/setfakeactivewindow-function-wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/controls/control-authoring-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/control-authoring-overview" + "source_path": "docs/framework/wpf/advanced/sharing-message-loops-between-win32-and-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/sharing-message-loops-between-win32-and-wpf" }, { - "source_path": "docs/framework/wpf/controls/control-customization.md", - "redirect_url": "/dotnet/desktop/wpf/controls/control-customization" + "source_path": "docs/framework/wpf/advanced/staticresource-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/staticresource-markup-extension" }, { - "source_path": "docs/framework/wpf/controls/control-library.md", - "redirect_url": "/dotnet/desktop/wpf/controls/control-library" + "source_path": "docs/framework/wpf/advanced/storing-ink.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/storing-ink" }, { - "source_path": "docs/framework/wpf/controls/control-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/control-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/styling-for-focus-in-controls-and-focusvisualstyle.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/styling-for-focus-in-controls-and-focusvisualstyle" }, { - "source_path": "docs/framework/wpf/controls/controls-by-category.md", - "redirect_url": "/dotnet/desktop/wpf/controls/controls-by-category" + "source_path": "docs/framework/wpf/advanced/table-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/table-overview" }, { - "source_path": "docs/framework/wpf/controls/creating-a-control-that-has-a-customizable-appearance.md", - "redirect_url": "/dotnet/desktop/wpf/controls/creating-a-control-that-has-a-customizable-appearance" + "source_path": "docs/framework/wpf/advanced/technology-regions-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/technology-regions-overview" }, { - "source_path": "docs/framework/wpf/controls/customizing-the-appearance-of-an-existing-control.md", - "redirect_url": "/dotnet/desktop-wpf/themes/how-to-create-apply-template" + "source_path": "docs/framework/wpf/advanced/templatebinding-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/templatebinding-markup-extension" }, { - "source_path": "docs/framework/wpf/controls/datagrid-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/datagrid-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/textelement-content-model-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/textelement-content-model-overview" }, { - "source_path": "docs/framework/wpf/controls/datagrid.md", - "redirect_url": "/dotnet/desktop/wpf/controls/datagrid" + "source_path": "docs/framework/wpf/advanced/the-ink-object-model-windows-forms-and-com-versus-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/the-ink-object-model-windows-forms-and-com-versus-wpf" }, { - "source_path": "docs/framework/wpf/controls/datepicker-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/datepicker-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/the-ink-threading-model.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/the-ink-threading-model" }, { - "source_path": "docs/framework/wpf/controls/datepicker-syles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/datepicker-styles-and-templates", - "redirect_document_id": true + "source_path": "docs/framework/wpf/advanced/themedictionary-markup-extension.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/themedictionary-markup-extension" }, { - "source_path": "docs/framework/wpf/controls/datepicker.md", - "redirect_url": "/dotnet/desktop/wpf/controls/datepicker" + "source_path": "docs/framework/wpf/advanced/threading-model.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/threading-model" }, { - "source_path": "docs/framework/wpf/controls/default-keyboard-and-mouse-behavior-in-the-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/default-keyboard-and-mouse-behavior-in-the-datagrid-control" + "source_path": "docs/framework/wpf/advanced/trees-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/trees-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/dockpanel-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/dockpanel-how-to-topics" + "source_path": "docs/framework/wpf/advanced/troubleshooting-hybrid-applications.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/troubleshooting-hybrid-applications" }, { - "source_path": "docs/framework/wpf/controls/dockpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/dockpanel" + "source_path": "docs/framework/wpf/advanced/typeconverters-and-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/typeconverters-and-xaml" }, { - "source_path": "docs/framework/wpf/controls/documentviewer-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/documentviewer-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/types-migrated-from-wpf-to-system.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system" }, { - "source_path": "docs/framework/wpf/controls/documentviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/documentviewer" + "source_path": "docs/framework/wpf/advanced/typography-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/typography-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/expander-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/expander-how-to-topics" + "source_path": "docs/framework/wpf/advanced/typography-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/typography-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/expander-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/expander-overview" + "source_path": "docs/framework/wpf/advanced/typography.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/typography" }, { - "source_path": "docs/framework/wpf/controls/expander-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/expander-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/use-automatic-layout-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/use-automatic-layout-overview" }, { - "source_path": "docs/framework/wpf/controls/expander.md", - "redirect_url": "/dotnet/desktop/wpf/controls/expander" + "source_path": "docs/framework/wpf/advanced/visual-basic-and-wpf-event-handling.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/visual-basic-and-wpf-event-handling" }, { - "source_path": "docs/framework/wpf/controls/flowdocumentpageviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentpageviewer" + "source_path": "docs/framework/wpf/advanced/walkthrough-arranging-windows-forms-controls-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-arranging-windows-forms-controls-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/flowdocumentreader.md", - "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentreader" + "source_path": "docs/framework/wpf/advanced/walkthrough-binding-to-data-in-hybrid-applications.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-binding-to-data-in-hybrid-applications" }, { - "source_path": "docs/framework/wpf/controls/flowdocumentscrollviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentscrollviewer" + "source_path": "docs/framework/wpf/advanced/walkthrough-caching-application-data-in-a-wpf-application.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-caching-application-data-in-a-wpf-application" }, { - "source_path": "docs/framework/wpf/controls/frame-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/frame-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/walkthrough-creating-direct3d9-content-for-hosting-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-creating-direct3d9-content-for-hosting-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/frame.md", - "redirect_url": "/dotnet/desktop/wpf/controls/frame" + "source_path": "docs/framework/wpf/advanced/walkthrough-creating-your-first-touch-application.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-creating-your-first-touch-application" }, { - "source_path": "docs/framework/wpf/controls/grid-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/grid-how-to-topics" + "source_path": "docs/framework/wpf/advanced/walkthrough-enabling-drag-and-drop-on-a-user-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-enabling-drag-and-drop-on-a-user-control" }, { - "source_path": "docs/framework/wpf/controls/grid.md", - "redirect_url": "/dotnet/desktop/wpf/controls/grid" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-3-d-wpf-composite-control-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-3-d-wpf-composite-control-in-windows-forms" }, { - "source_path": "docs/framework/wpf/controls/gridsplitter-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/gridsplitter-how-to-topics" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-win32-control-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-win32-control-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/gridsplitter.md", - "redirect_url": "/dotnet/desktop/wpf/controls/gridsplitter" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-composite-control-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-composite-control-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/gridview-column-header-styles-and-templates-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/gridview-column-header-styles-and-templates-overview" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml" }, { - "source_path": "docs/framework/wpf/controls/gridview-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/gridview-overview" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/groupbox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/groupbox-styles-and-templates" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-wpf-clock-in-win32.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-wpf-clock-in-win32" }, { - "source_path": "docs/framework/wpf/controls/groupbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/groupbox" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-a-wpf-composite-control-in-windows-forms.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-a-wpf-composite-control-in-windows-forms" }, { - "source_path": "docs/framework/wpf/controls/guidelines-for-designing-stylable-controls.md", - "redirect_url": "/dotnet/desktop/wpf/controls/guidelines-for-designing-stylable-controls" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-an-activex-control-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-an-activex-control-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-add-a-watermark-to-a-textbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-add-a-watermark-to-a-textbox" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-direct3d9-content-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-direct3d9-content-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-add-row-details-to-a-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-add-row-details-to-a-datagrid-control" + "source_path": "docs/framework/wpf/advanced/walkthrough-hosting-wpf-content-in-win32.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-hosting-wpf-content-in-win32" }, { - "source_path": "docs/framework/wpf/controls/how-to-adorn-the-children-of-a-panel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-adorn-the-children-of-a-panel" + "source_path": "docs/framework/wpf/advanced/walkthrough-localizing-a-hybrid-application.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-localizing-a-hybrid-application" }, { - "source_path": "docs/framework/wpf/controls/how-to-animate-a-borderthickness-value.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-animate-a-borderthickness-value" + "source_path": "docs/framework/wpf/advanced/walkthrough-mapping-properties-using-the-elementhost-control.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-mapping-properties-using-the-elementhost-control" }, { - "source_path": "docs/framework/wpf/controls/how-to-animate-a-popup.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-animate-a-popup" + "source_path": "docs/framework/wpf/advanced/walkthrough-mapping-properties-using-the-windowsformshost-element.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/walkthrough-mapping-properties-using-the-windowsformshost-element" }, { - "source_path": "docs/framework/wpf/controls/how-to-apply-stretch-properties-to-the-contents-of-a-viewbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-apply-stretch-properties-to-the-contents-of-a-viewbox" + "source_path": "docs/framework/wpf/advanced/weak-event-patterns.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/weak-event-patterns" }, { - "source_path": "docs/framework/wpf/controls/how-to-bind-a-listbox-to-data.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-a-listbox-to-data" + "source_path": "docs/framework/wpf/advanced/windows-forms-and-wpf-interoperability-input-architecture.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-and-wpf-interoperability-input-architecture" }, { - "source_path": "docs/framework/wpf/controls/how-to-bind-a-treeview-to-data-that-has-an-indeterminable-depth.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-a-treeview-to-data-that-has-an-indeterminable-depth" + "source_path": "docs/framework/wpf/advanced/windows-forms-and-wpf-property-mapping.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-and-wpf-property-mapping" }, { - "source_path": "docs/framework/wpf/controls/how-to-bind-an-adorner-to-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-an-adorner-to-an-element" + "source_path": "docs/framework/wpf/advanced/windows-forms-controls-and-equivalent-wpf-controls.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/windows-forms-controls-and-equivalent-wpf-controls" }, { - "source_path": "docs/framework/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid" + "source_path": "docs/framework/wpf/advanced/wpf-and-direct3d9-interoperation.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-direct3d9-interoperation" }, { - "source_path": "docs/framework/wpf/controls/how-to-change-the-horizontal-alignment-of-a-column-in-a-listview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-change-the-horizontal-alignment-of-a-column-in-a-listview" + "source_path": "docs/framework/wpf/advanced/wpf-and-win32-interoperation.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-win32-interoperation" }, { - "source_path": "docs/framework/wpf/controls/how-to-choose-between-stackpanel-and-dockpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-choose-between-stackpanel-and-dockpanel" + "source_path": "docs/framework/wpf/advanced/wpf-and-windows-forms-interoperation.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-and-windows-forms-interoperation" }, { - "source_path": "docs/framework/wpf/controls/how-to-convert-an-image-to-greyscale.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-convert-an-image-to-greyscale" + "source_path": "docs/framework/wpf/advanced/wpf-architecture.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-architecture" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-button-that-has-an-image.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-button-that-has-an-image" + "source_path": "docs/framework/wpf/advanced/wpf-globalization-and-localization-overview.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-globalization-and-localization-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-complex-grid.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-complex-grid" + "source_path": "docs/framework/wpf/advanced/wpf-unmanaged-api-reference.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-unmanaged-api-reference" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-control-that-has-an-access-key-and-text-wrapping.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-control-that-has-an-access-key-and-text-wrapping" + "source_path": "docs/framework/wpf/advanced/wpf-xaml-extensions.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-xaml-extensions" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-custom-panel-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-custom-panel-element" + "source_path": "docs/framework/wpf/advanced/wpf-xaml-namescopes.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/wpf-xaml-namescopes" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-custom-view-mode-for-a-listview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-custom-view-mode-for-a-listview" + "source_path": "docs/framework/wpf/advanced/xaml-and-custom-classes-for-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-and-custom-classes-for-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-dockpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-dockpanel" + "source_path": "docs/framework/wpf/advanced/xaml-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-grid-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-grid-element" + "source_path": "docs/framework/wpf/advanced/xaml-loading-and-dependency-properties.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-loading-and-dependency-properties" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-multiline-textbox-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-multiline-textbox-control" + "source_path": "docs/framework/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-namespaces-and-namespace-mapping-for-wpf-xaml" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-stackpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-stackpanel" + "source_path": "docs/framework/wpf/advanced/xaml-overview-wpf.md", + "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/controls/how-to-create-a-style-for-a-dragged-gridview-column-header.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-style-for-a-dragged-gridview-column-header" + "source_path": "docs/framework/wpf/advanced/xaml-resources.md", + "redirect_url": "/dotnet/desktop-wpf/fundamentals/xaml-resources-define", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/controls/how-to-create-an-expander-with-a-scrollviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-an-expander-with-a-scrollviewer" + "source_path": "docs/framework/wpf/advanced/xaml-syntax-in-detail.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/xaml-syntax-in-detail" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-and-use-a-canvas.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-and-use-a-canvas" + "source_path": "docs/framework/wpf/app-development/application-management-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/application-management-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-and-use-a-gridlengthconverter-object.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-and-use-a-gridlengthconverter-object" + "source_path": "docs/framework/wpf/app-development/build-and-deploy-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/build-and-deploy-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-listviewitems-with-a-checkbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-listviewitems-with-a-checkbox" + "source_path": "docs/framework/wpf/app-development/building-a-wpf-application-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/building-a-wpf-application-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-create-simple-or-complex-treeviews.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-simple-or-complex-treeviews" + "source_path": "docs/framework/wpf/app-development/building-and-deploying-wpf-applications.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/building-and-deploying-wpf-applications" }, { - "source_path": "docs/framework/wpf/controls/how-to-crop-an-image.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-crop-an-image" + "source_path": "docs/framework/wpf/app-development/configure-vs-to-debug-a-xaml-browser-to-call-a-web-service.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/configure-vs-to-debug-a-xaml-browser-to-call-a-web-service" }, { - "source_path": "docs/framework/wpf/controls/how-to-customize-the-thumb-size-on-a-scrollbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-customize-the-thumb-size-on-a-scrollbar" + "source_path": "docs/framework/wpf/app-development/deploying-a-wpf-application-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/deploying-a-wpf-application-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-customize-the-ticks-on-a-slider.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-customize-the-ticks-on-a-slider" + "source_path": "docs/framework/wpf/app-development/dialog-boxes-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/dialog-boxes-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-define-a-groupbox-template.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-define-a-groupbox-template" + "source_path": "docs/framework/wpf/app-development/filterinputmessage.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/filterinputmessage" }, { - "source_path": "docs/framework/wpf/controls/how-to-detect-when-text-in-a-textbox-has-changed.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-detect-when-text-in-a-textbox-has-changed" + "source_path": "docs/framework/wpf/app-development/firefox-add-ons-to-support-net-application-deployment.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/firefox-add-ons-to-support-net-application-deployment" }, { - "source_path": "docs/framework/wpf/controls/how-to-display-data-by-using-gridviewrowpresenter.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-display-data-by-using-gridviewrowpresenter" + "source_path": "docs/framework/wpf/app-development/getcustomui.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/getcustomui" }, { - "source_path": "docs/framework/wpf/controls/how-to-display-listview-contents-by-using-a-gridview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-display-listview-contents-by-using-a-gridview" + "source_path": "docs/framework/wpf/app-development/getrawinputdevices.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/getrawinputdevices" }, { - "source_path": "docs/framework/wpf/controls/how-to-enable-spell-checking-in-a-text-editing-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-enable-spell-checking-in-a-text-editing-control" + "source_path": "docs/framework/wpf/app-development/hosting-wpf-applications.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/hosting-wpf-applications" }, { - "source_path": "docs/framework/wpf/controls/how-to-enable-tab-characters-in-a-textbox-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-enable-tab-characters-in-a-textbox-control" + "source_path": "docs/framework/wpf/app-development/how-to-add-a-splash-screen-to-a-wpf-application.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-add-a-splash-screen-to-a-wpf-application" }, { - "source_path": "docs/framework/wpf/controls/how-to-extract-the-text-content-from-a-richtextbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-extract-the-text-content-from-a-richtextbox" + "source_path": "docs/framework/wpf/app-development/how-to-automatically-size-a-window-to-fit-its-content.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-automatically-size-a-window-to-fit-its-content" }, { - "source_path": "docs/framework/wpf/controls/how-to-find-a-treeviewitem-in-a-treeview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-find-a-treeviewitem-in-a-treeview" + "source_path": "docs/framework/wpf/app-development/how-to-call-a-page-function.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-call-a-page-function" }, { - "source_path": "docs/framework/wpf/controls/how-to-find-controltemplate-generated-elements.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-find-controltemplate-generated-elements" + "source_path": "docs/framework/wpf/app-development/how-to-configure-iis-5-0-and-iis-6-0-to-deploy-wpf-applications.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-configure-iis-5-0-and-iis-6-0-to-deploy-wpf-applications" }, { - "source_path": "docs/framework/wpf/controls/how-to-get-a-collection-of-lines-from-a-textbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-a-collection-of-lines-from-a-textbox" + "source_path": "docs/framework/wpf/app-development/how-to-create-an-add-in-that-is-a-ui.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-create-an-add-in-that-is-a-ui" }, { - "source_path": "docs/framework/wpf/controls/how-to-get-a-listboxitem.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-a-listboxitem" + "source_path": "docs/framework/wpf/app-development/how-to-create-an-add-in-that-returns-a-ui.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-create-an-add-in-that-returns-a-ui" }, { - "source_path": "docs/framework/wpf/controls/how-to-get-or-set-a-dock-value.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-or-set-a-dock-value" + "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-net-framework-3-0-is-installed.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-net-framework-3-0-is-installed" }, { - "source_path": "docs/framework/wpf/controls/how-to-get-or-set-canvas-positioning-properties.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-or-set-canvas-positioning-properties" + "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-net-framework-3-5-is-installed.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-net-framework-3-5-is-installed" }, { - "source_path": "docs/framework/wpf/controls/how-to-group-items-in-a-listview-that-implements-a-gridview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-group-items-in-a-listview-that-implements-a-gridview" + "source_path": "docs/framework/wpf/app-development/how-to-detect-whether-the-wpf-plug-in-for-firefox-is-installed.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-detect-whether-the-wpf-plug-in-for-firefox-is-installed" }, { - "source_path": "docs/framework/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control" + "source_path": "docs/framework/wpf/app-development/how-to-determine-if-a-page-is-browser-hosted.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-determine-if-a-page-is-browser-hosted" }, { - "source_path": "docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview" + "source_path": "docs/framework/wpf/app-development/how-to-determine-the-installed-version-of-wpf.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-3.5/aa349641(v=vs.90)" }, { - "source_path": "docs/framework/wpf/controls/how-to-handle-the-scrollchanged-event.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-handle-the-scrollchanged-event" + "source_path": "docs/framework/wpf/app-development/how-to-get-all-windows-in-an-application.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-all-windows-in-an-application" }, { - "source_path": "docs/framework/wpf/controls/how-to-horizontally-or-vertically-align-content-in-a-stackpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-horizontally-or-vertically-align-content-in-a-stackpanel" + "source_path": "docs/framework/wpf/app-development/how-to-get-and-set-the-main-application-window.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-and-set-the-main-application-window" }, { - "source_path": "docs/framework/wpf/controls/how-to-implement-an-adorner.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-implement-an-adorner" + "source_path": "docs/framework/wpf/app-development/how-to-get-the-return-value-of-a-page-function.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-get-the-return-value-of-a-page-function" }, { - "source_path": "docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-implement-validation-with-the-datagrid-control" + "source_path": "docs/framework/wpf/app-development/how-to-navigate-back-through-navigation-history.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-back-through-navigation-history" }, { - "source_path": "docs/framework/wpf/controls/how-to-improve-the-performance-of-a-treeview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-improve-the-performance-of-a-treeview" - }, + "source_path": "docs/framework/wpf/app-development/how-to-navigate-forward-or-back-through-navigation-history.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-forward-or-back-through-navigation-history" + }, { - "source_path": "docs/framework/wpf/controls/how-to-improve-the-scrolling-performance-of-a-listbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-improve-the-scrolling-performance-of-a-listbox" + "source_path": "docs/framework/wpf/app-development/how-to-navigate-to-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-navigate-to-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-make-a-textbox-control-read-only.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-make-a-textbox-control-read-only" + "source_path": "docs/framework/wpf/app-development/how-to-open-a-dialog-box.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-dialog-box" }, { - "source_path": "docs/framework/wpf/controls/how-to-make-sure-that-a-gridsplitter-is-visible.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-make-sure-that-a-gridsplitter-is-visible" + "source_path": "docs/framework/wpf/app-development/how-to-open-a-message-box.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-message-box" }, { - "source_path": "docs/framework/wpf/controls/how-to-override-the-panel-onrender-method.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-override-the-panel-onrender-method" + "source_path": "docs/framework/wpf/app-development/how-to-open-a-window.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-open-a-window" }, { - "source_path": "docs/framework/wpf/controls/how-to-partition-space-by-using-the-dockpanel-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-partition-space-by-using-the-dockpanel-element" + "source_path": "docs/framework/wpf/app-development/how-to-refresh-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-refresh-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-position-a-custom-context-menu-in-a-richtextbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-a-custom-context-menu-in-a-richtextbox" + "source_path": "docs/framework/wpf/app-development/how-to-return-a-dialog-box-result.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-return-a-dialog-box-result" }, { - "source_path": "docs/framework/wpf/controls/how-to-position-a-tooltip.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-a-tooltip" + "source_path": "docs/framework/wpf/app-development/how-to-return-from-a-page-function.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-return-from-a-page-function" }, { - "source_path": "docs/framework/wpf/controls/how-to-position-the-child-elements-of-a-grid.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-the-child-elements-of-a-grid" + "source_path": "docs/framework/wpf/app-development/how-to-set-the-height-of-a-window-from-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-height-of-a-window-from-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-remove-all-adorners-from-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-remove-all-adorners-from-an-element" + "source_path": "docs/framework/wpf/app-development/how-to-set-the-title-of-a-window-from-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-title-of-a-window-from-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-remove-an-adorner-from-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-remove-an-adorner-from-an-element" + "source_path": "docs/framework/wpf/app-development/how-to-set-the-width-of-a-window-from-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-set-the-width-of-a-window-from-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-resize-a-canvas-by-using-a-thumb.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-a-canvas-by-using-a-thumb" + "source_path": "docs/framework/wpf/app-development/how-to-stop-a-page-from-loading.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-stop-a-page-from-loading" }, { - "source_path": "docs/framework/wpf/controls/how-to-resize-columns-with-a-gridsplitter.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-columns-with-a-gridsplitter" + "source_path": "docs/framework/wpf/app-development/how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/how-to-resize-rows-with-a-gridsplitter.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-rows-with-a-gridsplitter" + "source_path": "docs/framework/wpf/app-development/how-to-use-an-application-scope-resource-dictionary.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-use-an-application-scope-resource-dictionary" }, { - "source_path": "docs/framework/wpf/controls/how-to-retrieve-a-text-selection.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-retrieve-a-text-selection" + "source_path": "docs/framework/wpf/app-development/how-to-use-mailto-to-send-mail-from-a-page.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/how-to-use-mailto-to-send-mail-from-a-page" }, { - "source_path": "docs/framework/wpf/controls/how-to-rotate-an-image.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-rotate-an-image" + "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-clone.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-clone" }, { - "source_path": "docs/framework/wpf/controls/how-to-save-load-and-print-richtextbox-content.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-save-load-and-print-richtextbox-content" + "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-next.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-next" }, { - "source_path": "docs/framework/wpf/controls/how-to-scroll-content-by-using-the-iscrollinfo-interface.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-scroll-content-by-using-the-iscrollinfo-interface" + "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-reset.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-reset" }, { - "source_path": "docs/framework/wpf/controls/how-to-set-focus-in-a-textbox-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-focus-in-a-textbox-control" + "source_path": "docs/framework/wpf/app-development/ienumrawinputdevic-skip.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevic-skip" }, { - "source_path": "docs/framework/wpf/controls/how-to-set-the-height-properties-of-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-height-properties-of-an-element" + "source_path": "docs/framework/wpf/app-development/ienumrawinputdevice.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/ienumrawinputdevice" }, { - "source_path": "docs/framework/wpf/controls/how-to-set-the-text-content-of-a-textbox-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-text-content-of-a-textbox-control" + "source_path": "docs/framework/wpf/app-development/index.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/index" }, { - "source_path": "docs/framework/wpf/controls/how-to-set-the-width-properties-of-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-width-properties-of-an-element" + "source_path": "docs/framework/wpf/app-development/iwpfhostsupport.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/iwpfhostsupport" }, { - "source_path": "docs/framework/wpf/controls/how-to-share-sizing-properties-between-grids.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-share-sizing-properties-between-grids" + "source_path": "docs/framework/wpf/app-development/native-wpf-browser-hosting-support-apis.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/native-wpf-browser-hosting-support-apis" }, { - "source_path": "docs/framework/wpf/controls/how-to-sort-a-gridview-column-when-a-header-is-clicked.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-sort-a-gridview-column-when-a-header-is-clicked" + "source_path": "docs/framework/wpf/app-development/navigation-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/how-to-specify-a-custom-popup-position.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-specify-a-custom-popup-position" + "source_path": "docs/framework/wpf/app-development/navigation-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-style-a-row-in-a-listview-that-implements-a-gridview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-style-a-row-in-a-listview-that-implements-a-gridview" + "source_path": "docs/framework/wpf/app-development/navigation-topologies-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/navigation-topologies-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-style-controls-on-a-toolbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-style-controls-on-a-toolbar" + "source_path": "docs/framework/wpf/app-development/pack-uris-in-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/pack-uris-in-wpf" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-a-custom-context-menu-with-a-textbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-a-custom-context-menu-with-a-textbox" + "source_path": "docs/framework/wpf/app-development/persist-and-restore-application-scope-properties.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/persist-and-restore-application-scope-properties" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-selectedvalue-selectedvaluepath-and-selecteditem.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-selectedvalue-selectedvaluepath-and-selecteditem" + "source_path": "docs/framework/wpf/app-development/structured-navigation-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/structured-navigation-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-spell-checking-with-a-context-menu.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-spell-checking-with-a-context-menu" + "source_path": "docs/framework/wpf/app-development/window-management-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/window-management-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-templates-to-style-a-listview-that-uses-gridview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-templates-to-style-a-listview-that-uses-gridview" + "source_path": "docs/framework/wpf/app-development/windows-in-wpf-applications.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/windows-in-wpf-applications" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-the-attached-properties-of-canvas-to-position-child-elements.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-attached-properties-of-canvas-to-position-child-elements" + "source_path": "docs/framework/wpf/app-development/wpf-add-ins-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-add-ins-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-the-betweenshowdelay-property.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-betweenshowdelay-property" + "source_path": "docs/framework/wpf/app-development/wpf-application-resource-content-and-data-files.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-application-resource-content-and-data-files" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-the-content-scrolling-methods-of-scrollviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-content-scrolling-methods-of-scrollviewer" + "source_path": "docs/framework/wpf/app-development/wpf-host-presentationhost-exe.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-host-presentationhost-exe" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-the-image-element.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-image-element" + "source_path": "docs/framework/wpf/app-development/wpf-windows-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-windows-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-use-triggers-to-style-selected-items-in-a-listview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-triggers-to-style-selected-items-in-a-listview" + "source_path": "docs/framework/wpf/app-development/wpf-xaml-browser-applications-overview.md", + "redirect_url": "/dotnet/desktop/wpf/app-development/wpf-xaml-browser-applications-overview" }, { - "source_path": "docs/framework/wpf/controls/how-to-wrap-a-border-around-the-content-of-a-canvas.md", - "redirect_url": "/dotnet/desktop/wpf/controls/how-to-wrap-a-border-around-the-content-of-a-canvas" + "source_path": "docs/framework/wpf/class-library-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/class-library-wpf" }, { - "source_path": "docs/framework/wpf/controls/image-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/image-how-to-topics" + "source_path": "docs/framework/wpf/controls/adorners-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/adorners-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/image.md", - "redirect_url": "/dotnet/desktop/wpf/controls/image" + "source_path": "docs/framework/wpf/controls/adorners-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/adorners-overview" }, { - "source_path": "docs/framework/wpf/controls/index.md", - "redirect_url": "/dotnet/desktop/wpf/controls/index" + "source_path": "docs/framework/wpf/controls/adorners.md", + "redirect_url": "/dotnet/desktop/wpf/controls/adorners" }, { - "source_path": "docs/framework/wpf/controls/label-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/label-styles-and-templates" + "source_path": "docs/framework/wpf/controls/border.md", + "redirect_url": "/dotnet/desktop/wpf/controls/border" }, { - "source_path": "docs/framework/wpf/controls/label.md", - "redirect_url": "/dotnet/desktop/wpf/controls/label" + "source_path": "docs/framework/wpf/controls/bulletdecorator.md", + "redirect_url": "/dotnet/desktop/wpf/controls/bulletdecorator" }, { - "source_path": "docs/framework/wpf/controls/listbox-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listbox-how-to-topics" + "source_path": "docs/framework/wpf/controls/button-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/button-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/listbox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listbox-styles-and-templates" + "source_path": "docs/framework/wpf/controls/button.md", + "redirect_url": "/dotnet/desktop/wpf/controls/button" }, { - "source_path": "docs/framework/wpf/controls/listbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listbox" + "source_path": "docs/framework/wpf/controls/calendar-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/calendar-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/listview-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listview-how-to-topics" + "source_path": "docs/framework/wpf/controls/calendar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/calendar" }, { - "source_path": "docs/framework/wpf/controls/listview-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listview-overview" + "source_path": "docs/framework/wpf/controls/canvas-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/canvas-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/listview-overviews.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listview-overviews" + "source_path": "docs/framework/wpf/controls/canvas.md", + "redirect_url": "/dotnet/desktop/wpf/controls/canvas" }, { - "source_path": "docs/framework/wpf/controls/listview-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listview-styles-and-templates" + "source_path": "docs/framework/wpf/controls/change-selection-in-a-richtextbox-programmatically.md", + "redirect_url": "/dotnet/desktop/wpf/controls/change-selection-in-a-richtextbox-programmatically" }, { - "source_path": "docs/framework/wpf/controls/listview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/listview" + "source_path": "docs/framework/wpf/controls/checkbox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/checkbox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md", - "redirect_url": "/dotnet/desktop/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections" + "source_path": "docs/framework/wpf/controls/checkbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/checkbox" }, { - "source_path": "docs/framework/wpf/controls/menu-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/menu-overview" + "source_path": "docs/framework/wpf/controls/combobox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/combobox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/menu-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/menu-styles-and-templates" + "source_path": "docs/framework/wpf/controls/combobox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/combobox" }, { - "source_path": "docs/framework/wpf/controls/menu.md", - "redirect_url": "/dotnet/desktop/wpf/controls/menu" + "source_path": "docs/framework/wpf/controls/contextmenu-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu-overview" }, { - "source_path": "docs/framework/wpf/controls/navigationwindow-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/navigationwindow-styles-and-templates" + "source_path": "docs/framework/wpf/controls/contextmenu-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/panel-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/panel-how-to-topics" + "source_path": "docs/framework/wpf/controls/contextmenu.md", + "redirect_url": "/dotnet/desktop/wpf/controls/contextmenu" }, { - "source_path": "docs/framework/wpf/controls/panel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/panel" + "source_path": "docs/framework/wpf/controls/control-authoring-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/control-authoring-overview" }, { - "source_path": "docs/framework/wpf/controls/panels-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/panels-overview" + "source_path": "docs/framework/wpf/controls/control-customization.md", + "redirect_url": "/dotnet/desktop/wpf/controls/control-customization" }, { - "source_path": "docs/framework/wpf/controls/passwordbox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox-styles-and-templates" + "source_path": "docs/framework/wpf/controls/control-library.md", + "redirect_url": "/dotnet/desktop/wpf/controls/control-library" }, { - "source_path": "docs/framework/wpf/controls/passwordbox-syles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox-styles-and-templates", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/control-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/control-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/passwordbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox" + "source_path": "docs/framework/wpf/controls/controls-by-category.md", + "redirect_url": "/dotnet/desktop/wpf/controls/controls-by-category" }, { - "source_path": "docs/framework/wpf/controls/popup-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/popup-how-to-topics" + "source_path": "docs/framework/wpf/controls/creating-a-control-that-has-a-customizable-appearance.md", + "redirect_url": "/dotnet/desktop/wpf/controls/creating-a-control-that-has-a-customizable-appearance" }, { - "source_path": "docs/framework/wpf/controls/popup-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/popup-overview" + "source_path": "docs/framework/wpf/controls/customizing-the-appearance-of-an-existing-control.md", + "redirect_url": "/dotnet/desktop-wpf/themes/how-to-create-apply-template" }, { - "source_path": "docs/framework/wpf/controls/popup-placement-behavior.md", - "redirect_url": "/dotnet/desktop/wpf/controls/popup-placement-behavior" + "source_path": "docs/framework/wpf/controls/datagrid-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/datagrid-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/popup.md", - "redirect_url": "/dotnet/desktop/wpf/controls/popup" + "source_path": "docs/framework/wpf/controls/datagrid.md", + "redirect_url": "/dotnet/desktop/wpf/controls/datagrid" }, { - "source_path": "docs/framework/wpf/controls/position-the-cursor-at-the-beginning-or-end-of-text.md", - "redirect_url": "/dotnet/desktop/wpf/controls/position-the-cursor-at-the-beginning-or-end-of-text" + "source_path": "docs/framework/wpf/controls/datepicker-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/datepicker-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/printdialog.md", - "redirect_url": "/dotnet/desktop/wpf/controls/printdialog" + "source_path": "docs/framework/wpf/controls/datepicker-syles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/datepicker-styles-and-templates", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/controls/progressbar-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/progressbar-styles-and-templates" + "source_path": "docs/framework/wpf/controls/datepicker.md", + "redirect_url": "/dotnet/desktop/wpf/controls/datepicker" }, { - "source_path": "docs/framework/wpf/controls/progressbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/progressbar" + "source_path": "docs/framework/wpf/controls/default-keyboard-and-mouse-behavior-in-the-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/default-keyboard-and-mouse-behavior-in-the-datagrid-control" }, { - "source_path": "docs/framework/wpf/controls/radiobutton-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/radiobutton-styles-and-templates" + "source_path": "docs/framework/wpf/controls/dockpanel-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/dockpanel-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/radiobutton.md", - "redirect_url": "/dotnet/desktop/wpf/controls/radiobutton" + "source_path": "docs/framework/wpf/controls/dockpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/dockpanel" }, { - "source_path": "docs/framework/wpf/controls/repeatbutton-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton-styles-and-templates" + "source_path": "docs/framework/wpf/controls/documentviewer-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/documentviewer-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/repeatbutton-syles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton-styles-and-templates", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/documentviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/documentviewer" }, { - "source_path": "docs/framework/wpf/controls/repeatbutton.md", - "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton" + "source_path": "docs/framework/wpf/controls/expander-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/expander-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/richtextbox-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox-how-to-topics" + "source_path": "docs/framework/wpf/controls/expander-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/expander-overview" }, { - "source_path": "docs/framework/wpf/controls/richtextbox-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox-overview" + "source_path": "docs/framework/wpf/controls/expander-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/expander-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/richtextbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox" + "source_path": "docs/framework/wpf/controls/expander.md", + "redirect_url": "/dotnet/desktop/wpf/controls/expander" }, { - "source_path": "docs/framework/wpf/controls/scrollbar-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollbar-styles-and-templates" + "source_path": "docs/framework/wpf/controls/flowdocumentpageviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentpageviewer" }, { - "source_path": "docs/framework/wpf/controls/scrollbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollbar" + "source_path": "docs/framework/wpf/controls/flowdocumentreader.md", + "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentreader" }, { - "source_path": "docs/framework/wpf/controls/scrollviewer-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-how-to-topics" + "source_path": "docs/framework/wpf/controls/flowdocumentscrollviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/flowdocumentscrollviewer" }, { - "source_path": "docs/framework/wpf/controls/scrollviewer-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-overview" + "source_path": "docs/framework/wpf/controls/frame-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/frame-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/scrollviewer-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-styles-and-templates" + "source_path": "docs/framework/wpf/controls/frame.md", + "redirect_url": "/dotnet/desktop/wpf/controls/frame" }, { - "source_path": "docs/framework/wpf/controls/scrollviewer.md", - "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer" + "source_path": "docs/framework/wpf/controls/grid-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/grid-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/separator.md", - "redirect_url": "/dotnet/desktop/wpf/controls/separator" + "source_path": "docs/framework/wpf/controls/grid.md", + "redirect_url": "/dotnet/desktop/wpf/controls/grid" }, { - "source_path": "docs/framework/wpf/controls/sizing-options-in-the-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/sizing-options-in-the-datagrid-control" + "source_path": "docs/framework/wpf/controls/gridsplitter-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/gridsplitter-how-to-topics" }, { - "source_path": "docs/framework/wpf/controls/slider-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/slider-styles-and-templates" + "source_path": "docs/framework/wpf/controls/gridsplitter.md", + "redirect_url": "/dotnet/desktop/wpf/controls/gridsplitter" }, { - "source_path": "docs/framework/wpf/controls/slider.md", - "redirect_url": "/dotnet/desktop/wpf/controls/slider" + "source_path": "docs/framework/wpf/controls/gridview-column-header-styles-and-templates-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/gridview-column-header-styles-and-templates-overview" }, { - "source_path": "docs/framework/wpf/controls/stackpanel-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/stackpanel-how-to-topics" + "source_path": "docs/framework/wpf/controls/gridview-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/gridview-overview" }, { - "source_path": "docs/framework/wpf/controls/stackpanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/stackpanel" + "source_path": "docs/framework/wpf/controls/groupbox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/groupbox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/controls/statusbar-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/statusbar-styles-and-templates" + "source_path": "docs/framework/wpf/controls/groupbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/groupbox" }, { - "source_path": "docs/framework/wpf/controls/statusbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/statusbar" + "source_path": "docs/framework/wpf/controls/guidelines-for-designing-stylable-controls.md", + "redirect_url": "/dotnet/desktop/wpf/controls/guidelines-for-designing-stylable-controls" }, { - "source_path": "docs/framework/wpf/controls/styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-add-a-watermark-to-a-textbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-add-a-watermark-to-a-textbox" }, { - "source_path": "docs/framework/wpf/controls/styling-and-templating.md", - "redirect_url": "/dotnet/desktop-wpf/fundamentals/styles-templates-overview", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/how-to-add-row-details-to-a-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-add-row-details-to-a-datagrid-control" }, { - "source_path": "docs/framework/wpf/controls/tabcontrol-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tabcontrol-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-adorn-the-children-of-a-panel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-adorn-the-children-of-a-panel" }, { - "source_path": "docs/framework/wpf/controls/tabcontrol.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tabcontrol" + "source_path": "docs/framework/wpf/controls/how-to-animate-a-borderthickness-value.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-animate-a-borderthickness-value" }, { - "source_path": "docs/framework/wpf/controls/textblock-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textblock-overview" + "source_path": "docs/framework/wpf/controls/how-to-animate-a-popup.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-animate-a-popup" }, { - "source_path": "docs/framework/wpf/controls/textblock.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textblock" + "source_path": "docs/framework/wpf/controls/how-to-apply-stretch-properties-to-the-contents-of-a-viewbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-apply-stretch-properties-to-the-contents-of-a-viewbox" }, { - "source_path": "docs/framework/wpf/controls/textbox-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textbox-how-to-topics" + "source_path": "docs/framework/wpf/controls/how-to-bind-a-listbox-to-data.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-a-listbox-to-data" }, { - "source_path": "docs/framework/wpf/controls/textbox-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textbox-overview" + "source_path": "docs/framework/wpf/controls/how-to-bind-a-treeview-to-data-that-has-an-indeterminable-depth.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-a-treeview-to-data-that-has-an-indeterminable-depth" }, { - "source_path": "docs/framework/wpf/controls/textbox-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textbox-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-bind-an-adorner-to-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-bind-an-adorner-to-an-element" }, { - "source_path": "docs/framework/wpf/controls/textbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/textbox" + "source_path": "docs/framework/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-build-a-standard-ui-dialog-box-by-using-grid" }, { - "source_path": "docs/framework/wpf/controls/thumb-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/thumb-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-change-the-horizontal-alignment-of-a-column-in-a-listview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-change-the-horizontal-alignment-of-a-column-in-a-listview" }, { - "source_path": "docs/framework/wpf/controls/thumb-syles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/thumb-styles-and-templates", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/how-to-choose-between-stackpanel-and-dockpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-choose-between-stackpanel-and-dockpanel" }, { - "source_path": "docs/framework/wpf/controls/togglebutton-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/togglebutton-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-convert-an-image-to-greyscale.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-convert-an-image-to-greyscale" }, { - "source_path": "docs/framework/wpf/controls/togglebutton-syles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/togglebutton-styles-and-templates", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/how-to-create-a-button-that-has-an-image.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-button-that-has-an-image" }, { - "source_path": "docs/framework/wpf/controls/toolbar-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/toolbar-overview" + "source_path": "docs/framework/wpf/controls/how-to-create-a-complex-grid.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-complex-grid" }, { - "source_path": "docs/framework/wpf/controls/toolbar-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/toolbar-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-create-a-control-that-has-an-access-key-and-text-wrapping.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-control-that-has-an-access-key-and-text-wrapping" }, { - "source_path": "docs/framework/wpf/controls/toolbar.md", - "redirect_url": "/dotnet/desktop/wpf/controls/toolbar" + "source_path": "docs/framework/wpf/controls/how-to-create-a-custom-panel-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-custom-panel-element" }, { - "source_path": "docs/framework/wpf/controls/tooltip-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-how-to-topics" + "source_path": "docs/framework/wpf/controls/how-to-create-a-custom-view-mode-for-a-listview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-custom-view-mode-for-a-listview" }, { - "source_path": "docs/framework/wpf/controls/tooltip-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-overview" + "source_path": "docs/framework/wpf/controls/how-to-create-a-dockpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-dockpanel" }, { - "source_path": "docs/framework/wpf/controls/tooltip-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-create-a-grid-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-grid-element" }, { - "source_path": "docs/framework/wpf/controls/tooltip.md", - "redirect_url": "/dotnet/desktop/wpf/controls/tooltip" + "source_path": "docs/framework/wpf/controls/how-to-create-a-multiline-textbox-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-multiline-textbox-control" }, { - "source_path": "docs/framework/wpf/controls/treeview-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/controls/treeview-how-to-topics" + "source_path": "docs/framework/wpf/controls/how-to-create-a-stackpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-stackpanel" }, { - "source_path": "docs/framework/wpf/controls/treeview-overview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/treeview-overview" + "source_path": "docs/framework/wpf/controls/how-to-create-a-style-for-a-dragged-gridview-column-header.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-a-style-for-a-dragged-gridview-column-header" }, { - "source_path": "docs/framework/wpf/controls/treeview-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/treeview-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-create-an-expander-with-a-scrollviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-an-expander-with-a-scrollviewer" }, { - "source_path": "docs/framework/wpf/controls/treeview.md", - "redirect_url": "/dotnet/desktop/wpf/controls/treeview" + "source_path": "docs/framework/wpf/controls/how-to-create-and-use-a-canvas.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-and-use-a-canvas" }, { - "source_path": "docs/framework/wpf/controls/ui-automation-of-a-wpf-custom-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/ui-automation-of-a-wpf-custom-control" + "source_path": "docs/framework/wpf/controls/how-to-create-and-use-a-gridlengthconverter-object.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-and-use-a-gridlengthconverter-object" }, { - "source_path": "docs/framework/wpf/controls/viewbox.md", - "redirect_url": "/dotnet/desktop/wpf/controls/viewbox" + "source_path": "docs/framework/wpf/controls/how-to-create-listviewitems-with-a-checkbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-listviewitems-with-a-checkbox" }, { - "source_path": "docs/framework/wpf/controls/walkthrough-create-a-button-by-using-microsoft-expression-blend.md", - "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-create-a-button-by-using-microsoft-expression-blend" + "source_path": "docs/framework/wpf/controls/how-to-create-simple-or-complex-treeviews.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-create-simple-or-complex-treeviews" }, { - "source_path": "docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-create-a-button-by-using-xaml" + "source_path": "docs/framework/wpf/controls/how-to-crop-an-image.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-crop-an-image" }, { - "source_path": "docs/framework/wpf/controls/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control.md", - "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control" + "source_path": "docs/framework/wpf/controls/how-to-customize-the-thumb-size-on-a-scrollbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-customize-the-thumb-size-on-a-scrollbar" }, { - "source_path": "docs/framework/wpf/controls/walkthroughs-create-a-custom-animated-button.md", - "redirect_url": "/dotnet/desktop/wpf/controls/walkthroughs-create-a-custom-animated-button" + "source_path": "docs/framework/wpf/controls/how-to-customize-the-ticks-on-a-slider.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-customize-the-ticks-on-a-slider" }, { - "source_path": "docs/framework/wpf/controls/window-styles-and-templates.md", - "redirect_url": "/dotnet/desktop/wpf/controls/window-styles-and-templates" + "source_path": "docs/framework/wpf/controls/how-to-define-a-groupbox-template.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-define-a-groupbox-template" }, { - "source_path": "docs/framework/wpf/controls/wpf-content-model.md", - "redirect_url": "/dotnet/desktop/wpf/controls/wpf-content-model" + "source_path": "docs/framework/wpf/controls/how-to-detect-when-text-in-a-textbox-has-changed.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-detect-when-text-in-a-textbox-has-changed" }, { - "source_path": "docs/framework/wpf/controls/wrappanel.md", - "redirect_url": "/dotnet/desktop/wpf/controls/wrappanel" + "source_path": "docs/framework/wpf/controls/how-to-display-data-by-using-gridviewrowpresenter.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-display-data-by-using-gridviewrowpresenter" }, { - "source_path": "docs/framework/wpf/data/attribute-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/attribute-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-display-listview-contents-by-using-a-gridview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-display-listview-contents-by-using-a-gridview" }, { - "source_path": "docs/framework/wpf/data/binding-declarations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/data/binding-declarations-overview" - }, + "source_path": "docs/framework/wpf/controls/how-to-enable-spell-checking-in-a-text-editing-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-enable-spell-checking-in-a-text-editing-control" + }, { - "source_path": "docs/framework/wpf/data/binding-sources-overview.md", - "redirect_url": "/dotnet/desktop/wpf/data/binding-sources-overview" + "source_path": "docs/framework/wpf/controls/how-to-enable-tab-characters-in-a-textbox-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-enable-tab-characters-in-a-textbox-control" }, { - "source_path": "docs/framework/wpf/data/data-binding-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/data/data-binding-how-to-topics" + "source_path": "docs/framework/wpf/controls/how-to-extract-the-text-content-from-a-richtextbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-extract-the-text-content-from-a-richtextbox" }, { - "source_path": "docs/framework/wpf/data/data-binding-overview.md", - "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview", - "redirect_document_id": true + "source_path": "docs/framework/wpf/controls/how-to-find-a-treeviewitem-in-a-treeview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-find-a-treeviewitem-in-a-treeview" }, { - "source_path": "docs/framework/wpf/data/data-binding-wpf.md", - "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" + "source_path": "docs/framework/wpf/controls/how-to-find-controltemplate-generated-elements.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-find-controltemplate-generated-elements" }, { - "source_path": "docs/framework/wpf/data/data-templating-overview.md", - "redirect_url": "/dotnet/desktop/wpf/data/data-templating-overview" + "source_path": "docs/framework/wpf/controls/how-to-get-a-collection-of-lines-from-a-textbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-a-collection-of-lines-from-a-textbox" }, { - "source_path": "docs/framework/wpf/data/descendants-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/descendants-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-get-a-listboxitem.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-a-listboxitem" }, { - "source_path": "docs/framework/wpf/data/element-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/element-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-get-or-set-a-dock-value.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-or-set-a-dock-value" }, { - "source_path": "docs/framework/wpf/data/elements-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/elements-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-get-or-set-canvas-positioning-properties.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-get-or-set-canvas-positioning-properties" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-the-properties-of-two-controls.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-the-properties-of-two-controls" + "source_path": "docs/framework/wpf/controls/how-to-group-items-in-a-listview-that-implements-a-gridview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-group-items-in-a-listview-that-implements-a-gridview" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-a-collection-and-display-information-based-on-selection.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-a-collection-and-display-information-based-on-selection" + "source_path": "docs/framework/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-group-sort-and-filter-data-in-the-datagrid-control" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-a-method.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-a-method" + "source_path": "docs/framework/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-handle-the-mousedoubleclick-event-for-each-item-in-a-listview" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-a-web-service.md", - "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" + "source_path": "docs/framework/wpf/controls/how-to-handle-the-scrollchanged-event.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-handle-the-scrollchanged-event" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-an-ado-net-data-source.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-an-ado-net-data-source" + "source_path": "docs/framework/wpf/controls/how-to-horizontally-or-vertically-align-content-in-a-stackpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-horizontally-or-vertically-align-content-in-a-stackpanel" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-an-enumeration.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-an-enumeration" + "source_path": "docs/framework/wpf/controls/how-to-implement-an-adorner.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-implement-an-adorner" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-the-results-of-a-linq-query.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-the-results-of-a-linq-query" + "source_path": "docs/framework/wpf/controls/how-to-implement-validation-with-the-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-implement-validation-with-the-datagrid-control" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-xdocument-xelement-or-linq-for-xml-query-results.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-xdocument-xelement-or-linq-for-xml-query-results" + "source_path": "docs/framework/wpf/controls/how-to-improve-the-performance-of-a-treeview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-improve-the-performance-of-a-treeview" }, { - "source_path": "docs/framework/wpf/data/how-to-bind-to-xml-data-using-an-xmldataprovider-and-xpath-queries.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-xml-data-using-an-xmldataprovider-and-xpath-queries" + "source_path": "docs/framework/wpf/controls/how-to-improve-the-scrolling-performance-of-a-listbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-improve-the-scrolling-performance-of-a-listbox" }, { - "source_path": "docs/framework/wpf/data/how-to-clear-bindings.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-clear-bindings" + "source_path": "docs/framework/wpf/controls/how-to-make-a-textbox-control-read-only.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-make-a-textbox-control-read-only" }, { - "source_path": "docs/framework/wpf/data/how-to-control-when-the-textbox-text-updates-the-source.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-control-when-the-textbox-text-updates-the-source" + "source_path": "docs/framework/wpf/controls/how-to-make-sure-that-a-gridsplitter-is-visible.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-make-sure-that-a-gridsplitter-is-visible" }, { - "source_path": "docs/framework/wpf/data/how-to-convert-bound-data.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-convert-bound-data" + "source_path": "docs/framework/wpf/controls/how-to-override-the-panel-onrender-method.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-override-the-panel-onrender-method" }, { - "source_path": "docs/framework/wpf/data/how-to-create-a-binding-in-code.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-a-binding-in-code" + "source_path": "docs/framework/wpf/controls/how-to-partition-space-by-using-the-dockpanel-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-partition-space-by-using-the-dockpanel-element" }, { - "source_path": "docs/framework/wpf/data/how-to-create-a-simple-binding.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-a-simple-binding" + "source_path": "docs/framework/wpf/controls/how-to-position-a-custom-context-menu-in-a-richtextbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-a-custom-context-menu-in-a-richtextbox" }, { - "source_path": "docs/framework/wpf/data/how-to-create-and-bind-to-an-observablecollection.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-and-bind-to-an-observablecollection" + "source_path": "docs/framework/wpf/controls/how-to-position-a-tooltip.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-a-tooltip" }, { - "source_path": "docs/framework/wpf/data/how-to-filter-data-in-a-view.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-filter-data-in-a-view" + "source_path": "docs/framework/wpf/controls/how-to-position-the-child-elements-of-a-grid.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-position-the-child-elements-of-a-grid" }, { - "source_path": "docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-find-datatemplate-generated-elements" + "source_path": "docs/framework/wpf/controls/how-to-remove-all-adorners-from-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-remove-all-adorners-from-an-element" }, { - "source_path": "docs/framework/wpf/data/how-to-get-the-binding-object-from-a-bound-target-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-get-the-binding-object-from-a-bound-target-property" + "source_path": "docs/framework/wpf/controls/how-to-remove-an-adorner-from-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-remove-an-adorner-from-an-element" }, { - "source_path": "docs/framework/wpf/data/how-to-get-the-default-view-of-a-data-collection.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-get-the-default-view-of-a-data-collection" + "source_path": "docs/framework/wpf/controls/how-to-resize-a-canvas-by-using-a-thumb.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-a-canvas-by-using-a-thumb" }, { - "source_path": "docs/framework/wpf/data/how-to-implement-a-compositecollection.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-a-compositecollection" + "source_path": "docs/framework/wpf/controls/how-to-resize-columns-with-a-gridsplitter.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-columns-with-a-gridsplitter" }, { - "source_path": "docs/framework/wpf/data/how-to-implement-binding-validation.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-binding-validation" + "source_path": "docs/framework/wpf/controls/how-to-resize-rows-with-a-gridsplitter.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-resize-rows-with-a-gridsplitter" }, { - "source_path": "docs/framework/wpf/data/how-to-implement-prioritybinding.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-prioritybinding" + "source_path": "docs/framework/wpf/controls/how-to-retrieve-a-text-selection.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-retrieve-a-text-selection" }, { - "source_path": "docs/framework/wpf/data/how-to-implement-property-change-notification.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-property-change-notification" + "source_path": "docs/framework/wpf/controls/how-to-rotate-an-image.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-rotate-an-image" }, { - "source_path": "docs/framework/wpf/data/how-to-implement-validation-logic-on-custom-objects.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-validation-logic-on-custom-objects" + "source_path": "docs/framework/wpf/controls/how-to-save-load-and-print-richtextbox-content.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-save-load-and-print-richtextbox-content" }, { - "source_path": "docs/framework/wpf/data/how-to-make-data-available-for-binding-in-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-make-data-available-for-binding-in-xaml" + "source_path": "docs/framework/wpf/controls/how-to-scroll-content-by-using-the-iscrollinfo-interface.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-scroll-content-by-using-the-iscrollinfo-interface" }, { - "source_path": "docs/framework/wpf/data/how-to-navigate-through-the-objects-in-a-data-collectionview.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-navigate-through-the-objects-in-a-data-collectionview" + "source_path": "docs/framework/wpf/controls/how-to-set-focus-in-a-textbox-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-focus-in-a-textbox-control" }, { - "source_path": "docs/framework/wpf/data/how-to-produce-a-value-based-on-a-list-of-bound-items.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-produce-a-value-based-on-a-list-of-bound-items" + "source_path": "docs/framework/wpf/controls/how-to-set-the-height-properties-of-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-height-properties-of-an-element" }, { - "source_path": "docs/framework/wpf/data/how-to-set-up-notification-of-binding-updates.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-set-up-notification-of-binding-updates" + "source_path": "docs/framework/wpf/controls/how-to-set-the-text-content-of-a-textbox-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-text-content-of-a-textbox-control" }, { - "source_path": "docs/framework/wpf/data/how-to-sort-and-group-data-using-a-view-in-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-sort-and-group-data-using-a-view-in-xaml" + "source_path": "docs/framework/wpf/controls/how-to-set-the-width-properties-of-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-set-the-width-properties-of-an-element" }, { - "source_path": "docs/framework/wpf/data/how-to-sort-data-in-a-view.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-sort-data-in-a-view" + "source_path": "docs/framework/wpf/controls/how-to-share-sizing-properties-between-grids.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-share-sizing-properties-between-grids" }, { - "source_path": "docs/framework/wpf/data/how-to-specify-the-binding-source.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-specify-the-binding-source" + "source_path": "docs/framework/wpf/controls/how-to-sort-a-gridview-column-when-a-header-is-clicked.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-sort-a-gridview-column-when-a-header-is-clicked" }, { - "source_path": "docs/framework/wpf/data/how-to-specify-the-direction-of-the-binding.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-specify-the-direction-of-the-binding" + "source_path": "docs/framework/wpf/controls/how-to-specify-a-custom-popup-position.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-specify-a-custom-popup-position" }, { - "source_path": "docs/framework/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-data.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-data" + "source_path": "docs/framework/wpf/controls/how-to-style-a-row-in-a-listview-that-implements-a-gridview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-style-a-row-in-a-listview-that-implements-a-gridview" }, { - "source_path": "docs/framework/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-xml-data.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-xml-data" + "source_path": "docs/framework/wpf/controls/how-to-style-controls-on-a-toolbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-style-controls-on-a-toolbar" }, { - "source_path": "docs/framework/wpf/data/how-to-use-xml-namespaces-in-data-binding.md", - "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-xml-namespaces-in-data-binding" + "source_path": "docs/framework/wpf/controls/how-to-use-a-custom-context-menu-with-a-textbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-a-custom-context-menu-with-a-textbox" }, { - "source_path": "docs/framework/wpf/data/index.md", - "redirect_url": "/dotnet/desktop/wpf/data/index" + "source_path": "docs/framework/wpf/controls/how-to-use-selectedvalue-selectedvaluepath-and-selecteditem.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-selectedvalue-selectedvaluepath-and-selecteditem" }, { - "source_path": "docs/framework/wpf/data/l2dbform-xaml-cs-source-code.md", - "redirect_url": "/dotnet/desktop/wpf/data/l2dbform-xaml-cs-source-code" + "source_path": "docs/framework/wpf/controls/how-to-use-spell-checking-with-a-context-menu.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-spell-checking-with-a-context-menu" }, { - "source_path": "docs/framework/wpf/data/l2dbform-xaml-source-code.md", - "redirect_url": "/dotnet/desktop/wpf/data/l2dbform-xaml-source-code" + "source_path": "docs/framework/wpf/controls/how-to-use-templates-to-style-a-listview-that-uses-gridview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-templates-to-style-a-listview-that-uses-gridview" }, { - "source_path": "docs/framework/wpf/data/linq-to-xml-data-binding-sample.md", - "redirect_url": "/dotnet/desktop/wpf/data/linq-to-xml-data-binding-sample" + "source_path": "docs/framework/wpf/controls/how-to-use-the-attached-properties-of-canvas-to-position-child-elements.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-attached-properties-of-canvas-to-position-child-elements" }, { - "source_path": "docs/framework/wpf/data/linq-to-xml-dynamic-properties.md", - "redirect_url": "/dotnet/desktop/wpf/data/linq-to-xml-dynamic-properties" + "source_path": "docs/framework/wpf/controls/how-to-use-the-betweenshowdelay-property.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-betweenshowdelay-property" }, { - "source_path": "docs/framework/wpf/data/value-xattribute-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/value-xattribute-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-use-the-content-scrolling-methods-of-scrollviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-content-scrolling-methods-of-scrollviewer" }, { - "source_path": "docs/framework/wpf/data/value-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/value-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-use-the-image-element.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-the-image-element" }, { - "source_path": "docs/framework/wpf/data/wpf-data-binding-with-linq-to-xml-overview.md", - "redirect_url": "/dotnet/desktop/wpf/data/wpf-data-binding-with-linq-to-xml-overview" + "source_path": "docs/framework/wpf/controls/how-to-use-triggers-to-style-selected-items-in-a-listview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-use-triggers-to-style-selected-items-in-a-listview" }, { - "source_path": "docs/framework/wpf/data/xml-xelement-dynamic-property.md", - "redirect_url": "/dotnet/desktop/wpf/data/xml-xelement-dynamic-property" + "source_path": "docs/framework/wpf/controls/how-to-wrap-a-border-around-the-content-of-a-canvas.md", + "redirect_url": "/dotnet/desktop/wpf/controls/how-to-wrap-a-border-around-the-content-of-a-canvas" }, { - "source_path": "docs/framework/wpf/getting-started/community-feedback.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/community-feedback" + "source_path": "docs/framework/wpf/controls/image-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/image-how-to-topics" }, { - "source_path": "docs/framework/wpf/getting-started/index.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/index" + "source_path": "docs/framework/wpf/controls/image.md", + "redirect_url": "/dotnet/desktop/wpf/controls/image" }, { - "source_path": "docs/framework/wpf/getting-started/introduction-to-wpf-in-vs.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/introduction-to-wpf-in-vs" + "source_path": "docs/framework/wpf/controls/index.md", + "redirect_url": "/dotnet/desktop/wpf/controls/index" }, { - "source_path": "docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/walkthrough-my-first-wpf-desktop-application" + "source_path": "docs/framework/wpf/controls/label-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/label-styles-and-templates" }, { - "source_path": "docs/framework/wpf/getting-started/whats-new.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/whats-new" + "source_path": "docs/framework/wpf/controls/label.md", + "redirect_url": "/dotnet/desktop/wpf/controls/label" }, { - "source_path": "docs/framework/wpf/getting-started/wpf-walkthroughs.md", - "redirect_url": "/dotnet/desktop/wpf/getting-started/wpf-walkthroughs" + "source_path": "docs/framework/wpf/controls/listbox-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listbox-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/3-d-graphics-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-how-to-topics" + "source_path": "docs/framework/wpf/controls/listbox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listbox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/3-d-graphics-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-overview" + "source_path": "docs/framework/wpf/controls/listbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listbox" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/3-d-transformations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-transformations-overview" + "source_path": "docs/framework/wpf/controls/listview-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listview-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animate-a-3-d-rotation-quaternionanimationusingkeyframes.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animate-a-3-d-rotation-quaternionanimationusingkeyframes" + "source_path": "docs/framework/wpf/controls/listview-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listview-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animate-an-object-along-a-path-matrix-animation-with-offset.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animate-an-object-along-a-path-matrix-animation-with-offset" + "source_path": "docs/framework/wpf/controls/listview-overviews.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listview-overviews" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animation-and-timing-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-and-timing-how-to-topics" + "source_path": "docs/framework/wpf/controls/listview-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listview-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animation-and-timing-system-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-and-timing-system-overview" + "source_path": "docs/framework/wpf/controls/listview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/listview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animation-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-overview" + "source_path": "docs/framework/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections.md", + "redirect_url": "/dotnet/desktop/wpf/controls/manipulate-columns-and-rows-by-using-columndefinitionscollections" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/animation-tips-and-tricks.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-tips-and-tricks" + "source_path": "docs/framework/wpf/controls/menu-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/menu-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/audio-and-video-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/audio-and-video-how-to-topics" + "source_path": "docs/framework/wpf/controls/menu-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/menu-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/bitmap-effects-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/bitmap-effects-overview" + "source_path": "docs/framework/wpf/controls/menu.md", + "redirect_url": "/dotnet/desktop/wpf/controls/menu" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/bitmap-effects.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/bitmap-effects" + "source_path": "docs/framework/wpf/controls/navigationwindow-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/navigationwindow-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/brush-transformation-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brush-transformation-overview" + "source_path": "docs/framework/wpf/controls/panel-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/panel-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/brushes-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brushes-how-to-topics" + "source_path": "docs/framework/wpf/controls/panel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/panel" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/brushes.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brushes" + "source_path": "docs/framework/wpf/controls/panels-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/panels-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/change-the-speed-of-a-clock.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/change-the-speed-of-a-clock" + "source_path": "docs/framework/wpf/controls/passwordbox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/clocks-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/clocks-how-to-topics" + "source_path": "docs/framework/wpf/controls/passwordbox-syles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox-styles-and-templates", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/custom-animations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/custom-animations-overview" + "source_path": "docs/framework/wpf/controls/passwordbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/passwordbox" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/drawing-objects-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawing-objects-overview" + "source_path": "docs/framework/wpf/controls/popup-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/popup-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/drawings-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawings-how-to-topics" + "source_path": "docs/framework/wpf/controls/popup-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/popup-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/drawings.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawings" + "source_path": "docs/framework/wpf/controls/popup-placement-behavior.md", + "redirect_url": "/dotnet/desktop/wpf/controls/popup-placement-behavior" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/easing-functions.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/easing-functions" + "source_path": "docs/framework/wpf/controls/popup.md", + "redirect_url": "/dotnet/desktop/wpf/controls/popup" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/extend-glass-frame-into-a-wpf-application.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/extend-glass-frame-into-a-wpf-application" + "source_path": "docs/framework/wpf/controls/position-the-cursor-at-the-beginning-or-end-of-text.md", + "redirect_url": "/dotnet/desktop/wpf/controls/position-the-cursor-at-the-beginning-or-end-of-text" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/from-to-by-animations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/from-to-by-animations-overview" + "source_path": "docs/framework/wpf/controls/printdialog.md", + "redirect_url": "/dotnet/desktop/wpf/controls/printdialog" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/geometries-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometries-how-to-topics" + "source_path": "docs/framework/wpf/controls/progressbar-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/progressbar-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/geometries.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometries" + "source_path": "docs/framework/wpf/controls/progressbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/progressbar" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/geometry-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometry-overview" + "source_path": "docs/framework/wpf/controls/radiobutton-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/radiobutton-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/graphics-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics-how-to-topics" + "source_path": "docs/framework/wpf/controls/radiobutton.md", + "redirect_url": "/dotnet/desktop/wpf/controls/radiobutton" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/graphics-rendering-registry-settings.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics-rendering-registry-settings" + "source_path": "docs/framework/wpf/controls/repeatbutton-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/graphics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics" + "source_path": "docs/framework/wpf/controls/repeatbutton-syles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton-styles-and-templates", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/hit-testing-in-the-visual-layer.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/hit-testing-in-the-visual-layer" + "source_path": "docs/framework/wpf/controls/repeatbutton.md", + "redirect_url": "/dotnet/desktop/wpf/controls/repeatbutton" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-accelerate-or-decelerate-an-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-accelerate-or-decelerate-an-animation" + "source_path": "docs/framework/wpf/controls/richtextbox-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-accumulate-animation-values-during-repeat-cycles.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-accumulate-animation-values-during-repeat-cycles" + "source_path": "docs/framework/wpf/controls/richtextbox-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-add-an-animation-output-value-to-an-animation-starting-value.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-add-an-animation-output-value-to-an-animation-starting-value" + "source_path": "docs/framework/wpf/controls/richtextbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/richtextbox" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-3-d-translations.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-3-d-translations" + "source_path": "docs/framework/wpf/controls/scrollbar-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollbar-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-key-frames" + "source_path": "docs/framework/wpf/controls/scrollbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollbar" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-quaternions.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-quaternions" + "source_path": "docs/framework/wpf/controls/scrollviewer-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-rotation3danimation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-rotation3danimation" + "source_path": "docs/framework/wpf/controls/scrollviewer-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-storyboards.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-storyboards" + "source_path": "docs/framework/wpf/controls/scrollviewer-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-boolean-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-boolean-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/scrollviewer.md", + "redirect_url": "/dotnet/desktop/wpf/controls/scrollviewer" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-double-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-double-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/separator.md", + "redirect_url": "/dotnet/desktop/wpf/controls/separator" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-matrix-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-matrix-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/sizing-options-in-the-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/sizing-options-in-the-datagrid-control" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-point-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-point-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/slider-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/slider-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-by-using-a-storyboard.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-by-using-a-storyboard" + "source_path": "docs/framework/wpf/controls/slider.md", + "redirect_url": "/dotnet/desktop/wpf/controls/slider" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-by-using-an-animationclock.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-by-using-an-animationclock" + "source_path": "docs/framework/wpf/controls/stackpanel-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/stackpanel-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-without-using-a-storyboard.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-without-using-a-storyboard" + "source_path": "docs/framework/wpf/controls/stackpanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/stackpanel" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-rectangle-geometry-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-rectangle-geometry-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/statusbar-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/statusbar-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-rectangle.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-rectangle" + "source_path": "docs/framework/wpf/controls/statusbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/statusbar" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-string-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-string-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-ellipsegeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-ellipsegeometry" + "source_path": "docs/framework/wpf/controls/styling-and-templating.md", + "redirect_url": "/dotnet/desktop-wpf/fundamentals/styles-templates-overview", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-double-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-double-animation" + "source_path": "docs/framework/wpf/controls/tabcontrol-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tabcontrol-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-matrix-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-matrix-animation" + "source_path": "docs/framework/wpf/controls/tabcontrol.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tabcontrol" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-point-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-point-animation" + "source_path": "docs/framework/wpf/controls/textblock-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textblock-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/textblock.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textblock" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-in-a-3d-scene.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-in-a-3d-scene" + "source_path": "docs/framework/wpf/controls/textbox-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textbox-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-using-key-frames" + "source_path": "docs/framework/wpf/controls/textbox-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textbox-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-color-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-color-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/textbox-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textbox-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-in-a-controltemplate.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-in-a-controltemplate" + "source_path": "docs/framework/wpf/controls/textbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/textbox" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-in-a-style.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-in-a-style" + "source_path": "docs/framework/wpf/controls/thumb-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/thumb-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-material-properties-in-a-3-d-scene.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-material-properties-in-a-3-d-scene" + "source_path": "docs/framework/wpf/controls/thumb-syles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/thumb-styles-and-templates", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-size-changes-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-size-changes-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/togglebutton-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/togglebutton-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-color-or-opacity-of-a-solidcolorbrush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-color-or-opacity-of-a-solidcolorbrush" + "source_path": "docs/framework/wpf/controls/togglebutton-syles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/togglebutton-styles-and-templates", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-opacity-of-an-element-or-brush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-opacity-of-an-element-or-brush" + "source_path": "docs/framework/wpf/controls/toolbar-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/toolbar-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-position-of-an-object-by-using-pointanimation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-position-of-an-object-by-using-pointanimation" + "source_path": "docs/framework/wpf/controls/toolbar-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/toolbar-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-position-or-color-of-a-gradient-stop.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-position-or-color-of-a-gradient-stop" + "source_path": "docs/framework/wpf/controls/toolbar.md", + "redirect_url": "/dotnet/desktop/wpf/controls/toolbar" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-size-of-an-arcsegment.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-size-of-an-arcsegment" + "source_path": "docs/framework/wpf/controls/tooltip-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-thickness-of-a-border-by-using-key-frames.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-thickness-of-a-border-by-using-key-frames" + "source_path": "docs/framework/wpf/controls/tooltip-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-drawing-to-a-3-d-model.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-drawing-to-a-3-d-model" - }, + "source_path": "docs/framework/wpf/controls/tooltip-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tooltip-styles-and-templates" + }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-guidelineset-to-a-drawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-guidelineset-to-a-drawing" + "source_path": "docs/framework/wpf/controls/tooltip.md", + "redirect_url": "/dotnet/desktop/wpf/controls/tooltip" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-transform-to-a-bitmapimage.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-transform-to-a-bitmapimage" + "source_path": "docs/framework/wpf/controls/treeview-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/controls/treeview-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-transform-to-an-element-when-an-event-occurs.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-transform-to-an-element-when-an-event-occurs" + "source_path": "docs/framework/wpf/controls/treeview-overview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/treeview-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-emissive-material-to-a-3-d-object.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-emissive-material-to-a-3-d-object" + "source_path": "docs/framework/wpf/controls/treeview-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/treeview-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-material-to-the-front-and-back-of-a-3-d-object.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-material-to-the-front-and-back-of-a-3-d-object" + "source_path": "docs/framework/wpf/controls/treeview.md", + "redirect_url": "/dotnet/desktop/wpf/controls/treeview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-multiple-transformations-to-a-3-d-model.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-multiple-transformations-to-a-3-d-model" + "source_path": "docs/framework/wpf/controls/ui-automation-of-a-wpf-custom-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/ui-automation-of-a-wpf-custom-control" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-multiple-transforms-to-an-object.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-multiple-transforms-to-an-object" + "source_path": "docs/framework/wpf/controls/viewbox.md", + "redirect_url": "/dotnet/desktop/wpf/controls/viewbox" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-chain-bitmapsource-objects-together.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-chain-bitmapsource-objects-together" + "source_path": "docs/framework/wpf/controls/walkthrough-create-a-button-by-using-microsoft-expression-blend.md", + "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-create-a-button-by-using-microsoft-expression-blend" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-mediaelement-by-using-a-storyboard.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-mediaelement-by-using-a-storyboard" + "source_path": "docs/framework/wpf/controls/walkthrough-create-a-button-by-using-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-create-a-button-by-using-xaml" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-mediaelement-play-pause-stop-volume-and-speed.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-mediaelement-play-pause-stop-volume-and-speed" + "source_path": "docs/framework/wpf/controls/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control.md", + "redirect_url": "/dotnet/desktop/wpf/controls/walkthrough-display-data-from-a-sql-server-database-in-a-datagrid-control" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-storyboard-after-it-starts.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-storyboard-after-it-starts" + "source_path": "docs/framework/wpf/controls/walkthroughs-create-a-custom-animated-button.md", + "redirect_url": "/dotnet/desktop/wpf/controls/walkthroughs-create-a-custom-animated-button" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-an-animation-using-from-to-and-by.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-an-animation-using-from-to-and-by" + "source_path": "docs/framework/wpf/controls/window-styles-and-templates.md", + "redirect_url": "/dotnet/desktop/wpf/controls/window-styles-and-templates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-key-frame-animation-timing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-key-frame-animation-timing" + "source_path": "docs/framework/wpf/controls/wpf-content-model.md", + "redirect_url": "/dotnet/desktop/wpf/controls/wpf-content-model" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-the-fill-of-a-composite-shape.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-the-fill-of-a-composite-shape" + "source_path": "docs/framework/wpf/controls/wrappanel.md", + "redirect_url": "/dotnet/desktop/wpf/controls/wrappanel" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-a-different-pixelformat.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-a-different-pixelformat" + "source_path": "docs/framework/wpf/data/attribute-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/attribute-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-an-indexed-pixel-format.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-an-indexed-pixel-format" + "source_path": "docs/framework/wpf/data/binding-declarations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/data/binding-declarations-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-3-d-scene.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene" + "source_path": "docs/framework/wpf/data/binding-sources-overview.md", + "redirect_url": "/dotnet/desktop/wpf/data/binding-sources-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-bitmap-from-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-bitmap-from-a-visual" + "source_path": "docs/framework/wpf/data/data-binding-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/data/data-binding-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-combined-geometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-combined-geometry" + "source_path": "docs/framework/wpf/data/data-binding-overview.md", + "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-composite-drawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-composite-drawing" + "source_path": "docs/framework/wpf/data/data-binding-wpf.md", + "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-composite-shape.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-composite-shape" + "source_path": "docs/framework/wpf/data/data-templating-overview.md", + "redirect_url": "/dotnet/desktop/wpf/data/data-templating-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-cubic-bezier-curve.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-cubic-bezier-curve" + "source_path": "docs/framework/wpf/data/descendants-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/descendants-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-geometrydrawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-geometrydrawing" + "source_path": "docs/framework/wpf/data/element-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/element-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-line-using-a-linegeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-line-using-a-linegeometry" + "source_path": "docs/framework/wpf/data/elements-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/elements-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-linesegment-in-a-pathgeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-linesegment-in-a-pathgeometry" + "source_path": "docs/framework/wpf/data/how-to-bind-the-properties-of-two-controls.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-the-properties-of-two-controls" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-new-bitmapsource.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-new-bitmapsource" + "source_path": "docs/framework/wpf/data/how-to-bind-to-a-collection-and-display-information-based-on-selection.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-a-collection-and-display-information-based-on-selection" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-quadratic-bezier-curve.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-quadratic-bezier-curve" + "source_path": "docs/framework/wpf/data/how-to-bind-to-a-method.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-a-method" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-reflection.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-reflection" + "source_path": "docs/framework/wpf/data/how-to-bind-to-a-web-service.md", + "redirect_url": "/dotnet/desktop-wpf/data/data-binding-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-shape-by-using-a-pathgeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-shape-by-using-a-pathgeometry" + "source_path": "docs/framework/wpf/data/how-to-bind-to-an-ado-net-data-source.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-an-ado-net-data-source" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-shape-using-a-streamgeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-shape-using-a-streamgeometry" + "source_path": "docs/framework/wpf/data/how-to-bind-to-an-enumeration.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-an-enumeration" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-an-elliptical-arc.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-an-elliptical-arc" + "source_path": "docs/framework/wpf/data/how-to-bind-to-the-results-of-a-linq-query.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-the-results-of-a-linq-query" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-different-tile-patterns-with-a-tilebrush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-different-tile-patterns-with-a-tilebrush" + "source_path": "docs/framework/wpf/data/how-to-bind-to-xdocument-xelement-or-linq-for-xml-query-results.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-xdocument-xelement-or-linq-for-xml-query-results" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-multiple-subpaths-within-a-pathgeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-multiple-subpaths-within-a-pathgeometry" + "source_path": "docs/framework/wpf/data/how-to-bind-to-xml-data-using-an-xmldataprovider-and-xpath-queries.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-bind-to-xml-data-using-an-xmldataprovider-and-xpath-queries" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-name-scope.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-name-scope" + "source_path": "docs/framework/wpf/data/how-to-clear-bindings.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-clear-bindings" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-pen.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-pen" + "source_path": "docs/framework/wpf/data/how-to-control-when-the-textbox-text-updates-the-source.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-control-when-the-textbox-text-updates-the-source" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-rectangle-using-a-rectanglegeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-rectangle-using-a-rectanglegeometry" + "source_path": "docs/framework/wpf/data/how-to-convert-bound-data.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-convert-bound-data" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-closed-shape-by-using-the-polygon-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-closed-shape-by-using-the-polygon-element" + "source_path": "docs/framework/wpf/data/how-to-create-a-binding-in-code.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-a-binding-in-code" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-line.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-line" + "source_path": "docs/framework/wpf/data/how-to-create-a-simple-binding.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-a-simple-binding" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-polyline-by-using-the-polyline-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-polyline-by-using-the-polyline-element" + "source_path": "docs/framework/wpf/data/how-to-create-and-bind-to-an-observablecollection.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-create-and-bind-to-an-observablecollection" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-rectangle.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-rectangle" + "source_path": "docs/framework/wpf/data/how-to-filter-data-in-a-view.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-filter-data-in-a-view" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-an-ellipse-or-a-circle.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-an-ellipse-or-a-circle" + "source_path": "docs/framework/wpf/data/how-to-find-datatemplate-generated-elements.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-find-datatemplate-generated-elements" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-an-image-using-imagedrawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-an-image-using-imagedrawing" + "source_path": "docs/framework/wpf/data/how-to-get-the-binding-object-from-a-bound-target-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-get-the-binding-object-from-a-bound-target-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-a-visual-to-an-image-file.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-a-visual-to-an-image-file" + "source_path": "docs/framework/wpf/data/how-to-get-the-default-view-of-a-data-collection.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-get-the-default-view-of-a-data-collection" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-bmp-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-bmp-image" + "source_path": "docs/framework/wpf/data/how-to-implement-a-compositecollection.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-a-compositecollection" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-gif-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-gif-image" + "source_path": "docs/framework/wpf/data/how-to-implement-binding-validation.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-binding-validation" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-jpeg-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-jpeg-image" + "source_path": "docs/framework/wpf/data/how-to-implement-prioritybinding.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-prioritybinding" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-png-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-png-image" + "source_path": "docs/framework/wpf/data/how-to-implement-property-change-notification.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-property-change-notification" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-tiff-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-tiff-image" + "source_path": "docs/framework/wpf/data/how-to-implement-validation-logic-on-custom-objects.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-implement-validation-logic-on-custom-objects" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-wdp-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-wdp-image" + "source_path": "docs/framework/wpf/data/how-to-make-data-available-for-binding-in-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-make-data-available-for-binding-in-xaml" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-enumerate-drawing-content-of-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-enumerate-drawing-content-of-a-visual" + "source_path": "docs/framework/wpf/data/how-to-navigate-through-the-objects-in-a-data-collectionview.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-navigate-through-the-objects-in-a-data-collectionview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-get-the-offset-of-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-get-the-offset-of-a-visual" + "source_path": "docs/framework/wpf/data/how-to-produce-a-value-based-on-a-list-of-bound-items.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-produce-a-value-based-on-a-list-of-bound-items" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-geometry-in-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-geometry-in-a-visual" + "source_path": "docs/framework/wpf/data/how-to-set-up-notification-of-binding-updates.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-set-up-notification-of-binding-updates" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-in-a-viewport3d.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-in-a-viewport3d" + "source_path": "docs/framework/wpf/data/how-to-sort-and-group-data-using-a-view-in-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-sort-and-group-data-using-a-view-in-xaml" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-using-a-win32-host-container.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-using-a-win32-host-container" + "source_path": "docs/framework/wpf/data/how-to-sort-data-in-a-view.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-sort-data-in-a-view" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-using-geometry-as-a-parameter.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-using-geometry-as-a-parameter" + "source_path": "docs/framework/wpf/data/how-to-specify-the-binding-source.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-specify-the-binding-source" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-improve-rendering-performance-by-caching-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-improve-rendering-performance-by-caching-an-element" + "source_path": "docs/framework/wpf/data/how-to-specify-the-direction-of-the-binding.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-specify-the-direction-of-the-binding" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-interactively-control-a-clock.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-interactively-control-a-clock" + "source_path": "docs/framework/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-data.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-data" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-load-an-image-as-a-thumbnail.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-load-an-image-as-a-thumbnail" + "source_path": "docs/framework/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-xml-data.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-the-master-detail-pattern-with-hierarchical-xml-data" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-make-an-element-spin-in-place.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-make-an-element-spin-in-place" + "source_path": "docs/framework/wpf/data/how-to-use-xml-namespaces-in-data-binding.md", + "redirect_url": "/dotnet/desktop/wpf/data/how-to-use-xml-namespaces-in-data-binding" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-modify-the-cap-at-the-end-of-a-line-or-segment.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-modify-the-cap-at-the-end-of-a-line-or-segment" + "source_path": "docs/framework/wpf/data/index.md", + "redirect_url": "/dotnet/desktop/wpf/data/index" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-drawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-drawing" + "source_path": "docs/framework/wpf/data/l2dbform-xaml-cs-source-code.md", + "redirect_url": "/dotnet/desktop/wpf/data/l2dbform-xaml-cs-source-code" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-linear-gradient.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-linear-gradient" + "source_path": "docs/framework/wpf/data/l2dbform-xaml-source-code.md", + "redirect_url": "/dotnet/desktop/wpf/data/l2dbform-xaml-source-code" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-gradient.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-gradient" + "source_path": "docs/framework/wpf/data/linq-to-xml-data-binding-sample.md", + "redirect_url": "/dotnet/desktop/wpf/data/linq-to-xml-data-binding-sample" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-solid-color.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-solid-color" + "source_path": "docs/framework/wpf/data/linq-to-xml-dynamic-properties.md", + "redirect_url": "/dotnet/desktop/wpf/data/linq-to-xml-dynamic-properties" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-system-brush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-system-brush" + "source_path": "docs/framework/wpf/data/value-xattribute-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/value-xattribute-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-video.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-video" + "source_path": "docs/framework/wpf/data/value-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/value-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-visual.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-visual" + "source_path": "docs/framework/wpf/data/wpf-data-binding-with-linq-to-xml-overview.md", + "redirect_url": "/dotnet/desktop/wpf/data/wpf-data-binding-with-linq-to-xml-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-an-image.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-an-image" + "source_path": "docs/framework/wpf/data/xml-xelement-dynamic-property.md", + "redirect_url": "/dotnet/desktop/wpf/data/xml-xelement-dynamic-property" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-play-media-using-a-videodrawing.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-play-media-using-a-videodrawing" + "source_path": "docs/framework/wpf/getting-started/community-feedback.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/community-feedback" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-play-media-with-animations.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-play-media-with-animations" + "source_path": "docs/framework/wpf/getting-started/index.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/index" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-preserve-the-aspect-ratio-of-an-image-used-as-a-background.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-preserve-the-aspect-ratio-of-an-image-used-as-a-background" + "source_path": "docs/framework/wpf/getting-started/introduction-to-wpf-in-vs.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/introduction-to-wpf-in-vs" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-read-metadata-from-a-bitmap.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-read-metadata-from-a-bitmap" + "source_path": "docs/framework/wpf/getting-started/walkthrough-my-first-wpf-desktop-application.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/walkthrough-my-first-wpf-desktop-application" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-receive-notification-when-clock-state-changes.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-receive-notification-when-clock-state-changes" + "source_path": "docs/framework/wpf/getting-started/whats-new.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/whats-new" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-render-on-a-per-frame-interval-using-compositiontarget.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-render-on-a-per-frame-interval-using-compositiontarget" + "source_path": "docs/framework/wpf/getting-started/wpf-walkthroughs.md", + "redirect_url": "/dotnet/desktop/wpf/getting-started/wpf-walkthroughs" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-repeat-an-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-repeat-an-animation" + "source_path": "docs/framework/wpf/graphics-multimedia/3-d-graphics-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-repeat-media-playback.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-repeat-media-playback" + "source_path": "docs/framework/wpf/graphics-multimedia/3-d-graphics-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-graphics-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path-matrix-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path-matrix-animation" + "source_path": "docs/framework/wpf/graphics-multimedia/3-d-transformations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/3-d-transformations-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path" + "source_path": "docs/framework/wpf/graphics-multimedia/animate-a-3-d-rotation-quaternionanimationusingkeyframes.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animate-a-3-d-rotation-quaternionanimationusingkeyframes" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object" + "source_path": "docs/framework/wpf/graphics-multimedia/animate-an-object-along-a-path-matrix-animation-with-offset.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animate-an-object-along-a-path-matrix-animation-with-offset" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-round-the-corners-of-a-rectanglegeometry.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-round-the-corners-of-a-rectanglegeometry" + "source_path": "docs/framework/wpf/graphics-multimedia/animation-and-timing-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-and-timing-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-scale-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-scale-an-element" + "source_path": "docs/framework/wpf/graphics-multimedia/animation-and-timing-system-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-and-timing-system-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-clock-synchronously.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-clock-synchronously" + "source_path": "docs/framework/wpf/graphics-multimedia/animation-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-storyboard-synchronously.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-storyboard-synchronously" + "source_path": "docs/framework/wpf/graphics-multimedia/animation-tips-and-tricks.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/animation-tips-and-tricks" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-storyboard.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-storyboard" + "source_path": "docs/framework/wpf/graphics-multimedia/audio-and-video-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/audio-and-video-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-a-duration-for-an-animation.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-a-duration-for-an-animation" + "source_path": "docs/framework/wpf/graphics-multimedia/bitmap-effects-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/bitmap-effects-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-a-property-after-animating-it-with-a-storyboard.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-a-property-after-animating-it-with-a-storyboard" + "source_path": "docs/framework/wpf/graphics-multimedia/bitmap-effects.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/bitmap-effects" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-the-horizontal-and-vertical-alignment-of-a-tilebrush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-the-horizontal-and-vertical-alignment-of-a-tilebrush" + "source_path": "docs/framework/wpf/graphics-multimedia/brush-transformation-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brush-transformation-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-the-tile-size-for-a-tilebrush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-the-tile-size-for-a-tilebrush" + "source_path": "docs/framework/wpf/graphics-multimedia/brushes-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brushes-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-simplify-animations-by-using-child-timelines.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-simplify-animations-by-using-child-timelines" + "source_path": "docs/framework/wpf/graphics-multimedia/brushes.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/brushes" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-skew-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-skew-an-element" + "source_path": "docs/framework/wpf/graphics-multimedia/change-the-speed-of-a-clock.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/change-the-speed-of-a-clock" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-handoffbehavior-between-storyboard-animations.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-handoffbehavior-between-storyboard-animations" + "source_path": "docs/framework/wpf/graphics-multimedia/clocks-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/clocks-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-the-origin-of-a-transform-by-using-relative-values.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-the-origin-of-a-transform-by-using-relative-values" + "source_path": "docs/framework/wpf/graphics-multimedia/custom-animations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/custom-animations-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-whether-a-timeline-automatically-reverses.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-whether-a-timeline-automatically-reverses" + "source_path": "docs/framework/wpf/graphics-multimedia/drawing-objects-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawing-objects-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-test-point4d-structures-for-equality-and-inequality.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-test-point4d-structures-for-equality-and-inequality" + "source_path": "docs/framework/wpf/graphics-multimedia/drawings-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawings-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-a-brush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-a-brush" + "source_path": "docs/framework/wpf/graphics-multimedia/drawings.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/drawings" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-points-and-vectors.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-points-and-vectors" + "source_path": "docs/framework/wpf/graphics-multimedia/easing-functions.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/easing-functions" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-the-scale-of-a-3-d-model.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-the-scale-of-a-3-d-model" + "source_path": "docs/framework/wpf/graphics-multimedia/extend-glass-frame-into-a-wpf-application.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/extend-glass-frame-into-a-wpf-application" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-translate-an-element.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-translate-an-element" + "source_path": "docs/framework/wpf/graphics-multimedia/from-to-by-animations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/from-to-by-animations-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-trigger-an-animation-when-a-property-value-changes.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-trigger-an-animation-when-a-property-value-changes" + "source_path": "docs/framework/wpf/graphics-multimedia/geometries-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometries-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-trigger-media-playback-with-a-user-event.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-trigger-media-playback-with-a-user-event" + "source_path": "docs/framework/wpf/graphics-multimedia/geometries.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometries" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-bitmapimage.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-bitmapimage" + "source_path": "docs/framework/wpf/graphics-multimedia/geometry-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/geometry-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-cached-element-as-a-brush.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-cached-element-as-a-brush" + "source_path": "docs/framework/wpf/graphics-multimedia/graphics-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics-how-to-topics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-drawing-as-an-image-source.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-drawing-as-an-image-source" + "source_path": "docs/framework/wpf/graphics-multimedia/graphics-rendering-registry-settings.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics-rendering-registry-settings" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-matrixtransform-to-create-custom-transforms.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-matrixtransform-to-create-custom-transforms" + "source_path": "docs/framework/wpf/graphics-multimedia/graphics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/graphics" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-event-triggers-to-control-a-storyboard-after-it-starts.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-event-triggers-to-control-a-storyboard-after-it-starts" + "source_path": "docs/framework/wpf/graphics-multimedia/hit-testing-in-the-visual-layer.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/hit-testing-in-the-visual-layer" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-system-colors-in-a-gradient.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-system-colors-in-a-gradient" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-accelerate-or-decelerate-an-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-accelerate-or-decelerate-an-animation" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-transforms-on-a-mediaelement.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-transforms-on-a-mediaelement" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-accumulate-animation-values-during-repeat-cycles.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-accumulate-animation-values-during-repeat-cycles" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/how-to-write-metadata-to-a-bitmap.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-write-metadata-to-a-bitmap" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-add-an-animation-output-value-to-an-animation-starting-value.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-add-an-animation-output-value-to-an-animation-starting-value" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/images.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/images" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-3-d-translations.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-3-d-translations" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/imaging-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/imaging-how-to-topics" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/imaging-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/imaging-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-quaternions.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-quaternions" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/index.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/index" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-rotation3danimation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-rotation3danimation" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/key-frame-animation-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/key-frame-animation-how-to-topics" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-storyboards.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-3-d-rotation-using-storyboards" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/key-frame-animations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/key-frame-animations-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-boolean-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-boolean-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/maximize-wpf-3d-performance.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/maximize-wpf-3d-performance" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-double-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-double-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/multimedia-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/multimedia-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-matrix-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-matrix-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/opacity-masks-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/opacity-masks-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-point-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-point-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/painting-with-images-drawings-and-visuals.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/painting-with-images-drawings-and-visuals" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-by-using-a-storyboard.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-by-using-a-storyboard" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/painting-with-solid-colors-and-gradients-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/painting-with-solid-colors-and-gradients-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-by-using-an-animationclock.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-by-using-an-animationclock" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/path-animation-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-animation-how-to-topics" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-property-without-using-a-storyboard.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-property-without-using-a-storyboard" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/path-animations-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-animations-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-rectangle-geometry-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-rectangle-geometry-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/path-markup-syntax.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-markup-syntax" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-rectangle.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-rectangle" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/property-animation-techniques-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/property-animation-techniques-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-a-string-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-a-string-by-using-key-frames" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/shapes-and-basic-drawing-in-wpf-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes-and-basic-drawing-in-wpf-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-ellipsegeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-ellipsegeometry" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/shapes-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes-how-to-topics" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-double-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-double-animation" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/shapes.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-matrix-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-matrix-animation" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/specify-the-fillbehavior-for-a-timeline.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/specify-the-fillbehavior-for-a-timeline" + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-point-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-along-a-path-point-animation" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-an-object-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-an-object-by-using-key-frames" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-in-a-3d-scene.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-in-a-3d-scene" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-camera-position-and-direction-using-key-frames" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-color-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-color-by-using-key-frames" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-in-a-controltemplate.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-in-a-controltemplate" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-in-a-style.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-in-a-style" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-material-properties-in-a-3-d-scene.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-material-properties-in-a-3-d-scene" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-size-changes-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-size-changes-by-using-key-frames" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-color-or-opacity-of-a-solidcolorbrush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-color-or-opacity-of-a-solidcolorbrush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-opacity-of-an-element-or-brush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-opacity-of-an-element-or-brush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-position-of-an-object-by-using-pointanimation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-position-of-an-object-by-using-pointanimation" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-position-or-color-of-a-gradient-stop.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-position-or-color-of-a-gradient-stop" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-size-of-an-arcsegment.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-size-of-an-arcsegment" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-animate-the-thickness-of-a-border-by-using-key-frames.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-animate-the-thickness-of-a-border-by-using-key-frames" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-drawing-to-a-3-d-model.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-drawing-to-a-3-d-model" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-guidelineset-to-a-drawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-guidelineset-to-a-drawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-transform-to-a-bitmapimage.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-transform-to-a-bitmapimage" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-a-transform-to-an-element-when-an-event-occurs.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-a-transform-to-an-element-when-an-event-occurs" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-emissive-material-to-a-3-d-object.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-emissive-material-to-a-3-d-object" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-material-to-the-front-and-back-of-a-3-d-object.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-material-to-the-front-and-back-of-a-3-d-object" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-multiple-transformations-to-a-3-d-model.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-multiple-transformations-to-a-3-d-model" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-apply-multiple-transforms-to-an-object.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-apply-multiple-transforms-to-an-object" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-chain-bitmapsource-objects-together.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-chain-bitmapsource-objects-together" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-mediaelement-by-using-a-storyboard.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-mediaelement-by-using-a-storyboard" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-mediaelement-play-pause-stop-volume-and-speed.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-mediaelement-play-pause-stop-volume-and-speed" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-a-storyboard-after-it-starts.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-a-storyboard-after-it-starts" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-an-animation-using-from-to-and-by.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-an-animation-using-from-to-and-by" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-key-frame-animation-timing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-key-frame-animation-timing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-control-the-fill-of-a-composite-shape.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-control-the-fill-of-a-composite-shape" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-a-different-pixelformat.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-a-different-pixelformat" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-an-indexed-pixel-format.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-convert-a-bitmapsource-to-an-indexed-pixel-format" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-3-d-scene.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-3-d-scene" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-bitmap-from-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-bitmap-from-a-visual" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-combined-geometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-combined-geometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-composite-drawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-composite-drawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-composite-shape.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-composite-shape" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-cubic-bezier-curve.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-cubic-bezier-curve" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-geometrydrawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-geometrydrawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-line-using-a-linegeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-line-using-a-linegeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-linesegment-in-a-pathgeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-linesegment-in-a-pathgeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-new-bitmapsource.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-new-bitmapsource" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-quadratic-bezier-curve.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-quadratic-bezier-curve" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-reflection.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-reflection" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-shape-by-using-a-pathgeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-shape-by-using-a-pathgeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-a-shape-using-a-streamgeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-a-shape-using-a-streamgeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-an-elliptical-arc.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-an-elliptical-arc" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-different-tile-patterns-with-a-tilebrush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-different-tile-patterns-with-a-tilebrush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-create-multiple-subpaths-within-a-pathgeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-create-multiple-subpaths-within-a-pathgeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-name-scope.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-name-scope" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-pen.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-pen" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-define-a-rectangle-using-a-rectanglegeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-define-a-rectangle-using-a-rectanglegeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-closed-shape-by-using-the-polygon-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-closed-shape-by-using-the-polygon-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-line.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-line" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-polyline-by-using-the-polyline-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-polyline-by-using-the-polyline-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-a-rectangle.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-a-rectangle" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-an-ellipse-or-a-circle.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-an-ellipse-or-a-circle" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-draw-an-image-using-imagedrawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-draw-an-image-using-imagedrawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-a-visual-to-an-image-file.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-a-visual-to-an-image-file" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-bmp-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-bmp-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-gif-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-gif-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-jpeg-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-jpeg-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-png-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-png-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-tiff-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-tiff-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-encode-and-decode-a-wdp-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-encode-and-decode-a-wdp-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-enumerate-drawing-content-of-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-enumerate-drawing-content-of-a-visual" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-get-the-offset-of-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-get-the-offset-of-a-visual" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-geometry-in-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-geometry-in-a-visual" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-in-a-viewport3d.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-in-a-viewport3d" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-using-a-win32-host-container.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-using-a-win32-host-container" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-hit-test-using-geometry-as-a-parameter.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-hit-test-using-geometry-as-a-parameter" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-improve-rendering-performance-by-caching-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-improve-rendering-performance-by-caching-an-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-interactively-control-a-clock.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-interactively-control-a-clock" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-load-an-image-as-a-thumbnail.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-load-an-image-as-a-thumbnail" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-make-an-element-spin-in-place.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-make-an-element-spin-in-place" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-modify-the-cap-at-the-end-of-a-line-or-segment.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-modify-the-cap-at-the-end-of-a-line-or-segment" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-drawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-drawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-linear-gradient.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-linear-gradient" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-gradient.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-gradient" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-solid-color.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-solid-color" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-system-brush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-system-brush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-video.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-video" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-visual.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-a-visual" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-an-image.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-paint-an-area-with-an-image" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-play-media-using-a-videodrawing.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-play-media-using-a-videodrawing" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-play-media-with-animations.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-play-media-with-animations" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-preserve-the-aspect-ratio-of-an-image-used-as-a-background.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-preserve-the-aspect-ratio-of-an-image-used-as-a-background" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-read-metadata-from-a-bitmap.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-read-metadata-from-a-bitmap" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-receive-notification-when-clock-state-changes.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-receive-notification-when-clock-state-changes" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-render-on-a-per-frame-interval-using-compositiontarget.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-render-on-a-per-frame-interval-using-compositiontarget" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-repeat-an-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-repeat-an-animation" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-repeat-media-playback.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-repeat-media-playback" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path-matrix-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path-matrix-animation" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object-by-using-a-geometric-path" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-rotate-an-object.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-rotate-an-object" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-round-the-corners-of-a-rectanglegeometry.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-round-the-corners-of-a-rectanglegeometry" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-scale-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-scale-an-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-clock-synchronously.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-clock-synchronously" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-storyboard-synchronously.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-storyboard-synchronously" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-seek-a-storyboard.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-seek-a-storyboard" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-a-duration-for-an-animation.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-a-duration-for-an-animation" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-a-property-after-animating-it-with-a-storyboard.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-a-property-after-animating-it-with-a-storyboard" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-the-horizontal-and-vertical-alignment-of-a-tilebrush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-the-horizontal-and-vertical-alignment-of-a-tilebrush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-set-the-tile-size-for-a-tilebrush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-set-the-tile-size-for-a-tilebrush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-simplify-animations-by-using-child-timelines.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-simplify-animations-by-using-child-timelines" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-skew-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-skew-an-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-handoffbehavior-between-storyboard-animations.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-handoffbehavior-between-storyboard-animations" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-the-origin-of-a-transform-by-using-relative-values.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-the-origin-of-a-transform-by-using-relative-values" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-specify-whether-a-timeline-automatically-reverses.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-specify-whether-a-timeline-automatically-reverses" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-test-point4d-structures-for-equality-and-inequality.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-test-point4d-structures-for-equality-and-inequality" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-a-brush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-a-brush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-points-and-vectors.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-points-and-vectors" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-transform-the-scale-of-a-3-d-model.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-transform-the-scale-of-a-3-d-model" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-translate-an-element.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-translate-an-element" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-trigger-an-animation-when-a-property-value-changes.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-trigger-an-animation-when-a-property-value-changes" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-trigger-media-playback-with-a-user-event.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-trigger-media-playback-with-a-user-event" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-bitmapimage.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-bitmapimage" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-cached-element-as-a-brush.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-cached-element-as-a-brush" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-drawing-as-an-image-source.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-drawing-as-an-image-source" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-a-matrixtransform-to-create-custom-transforms.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-a-matrixtransform-to-create-custom-transforms" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-event-triggers-to-control-a-storyboard-after-it-starts.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-event-triggers-to-control-a-storyboard-after-it-starts" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-system-colors-in-a-gradient.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-system-colors-in-a-gradient" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-use-transforms-on-a-mediaelement.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-use-transforms-on-a-mediaelement" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/how-to-write-metadata-to-a-bitmap.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/how-to-write-metadata-to-a-bitmap" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/images.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/images" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/imaging-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/imaging-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/imaging-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/imaging-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/index.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/index" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/key-frame-animation-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/key-frame-animation-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/key-frame-animations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/key-frame-animations-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/maximize-wpf-3d-performance.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/maximize-wpf-3d-performance" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/multimedia-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/multimedia-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/opacity-masks-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/opacity-masks-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/painting-with-images-drawings-and-visuals.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/painting-with-images-drawings-and-visuals" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/painting-with-solid-colors-and-gradients-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/painting-with-solid-colors-and-gradients-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/path-animation-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-animation-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/path-animations-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-animations-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/path-markup-syntax.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/path-markup-syntax" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/property-animation-techniques-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/property-animation-techniques-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/shapes-and-basic-drawing-in-wpf-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes-and-basic-drawing-in-wpf-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/shapes-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/shapes.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/shapes" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/specify-the-fillbehavior-for-a-timeline.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/specify-the-fillbehavior-for-a-timeline" }, { "source_path": "docs/framework/wpf/graphics-multimedia/storyboards-overview.md", "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/storyboards-overview" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/tilebrush-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/tilebrush-overview" + "source_path": "docs/framework/wpf/graphics-multimedia/tilebrush-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/tilebrush-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/timing-behaviors-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/timing-behaviors-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/timing-events-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/timing-events-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/transformations-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transformations-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/transformations.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transformations" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/transforms-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transforms-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/tutorial-hosting-visual-objects-in-a-win32-application.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/tutorial-hosting-visual-objects-in-a-win32-application" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/using-drawingvisual-objects.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/using-drawingvisual-objects" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/visual-layer-programming-how-to-topics.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/visual-layer-programming-how-to-topics" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/visual-layer-programming.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/visual-layer-programming" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/wpf-brushes-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/wpf-brushes-overview" + }, + { + "source_path": "docs/framework/wpf/graphics-multimedia/wpf-graphics-rendering-overview.md", + "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/wpf-graphics-rendering-overview" + }, + { + "source_path": "docs/framework/wpf/index.md", + "redirect_url": "/dotnet/desktop/wpf/index" + }, + { + "source_path": "docs/framework/wpf/introduction-to-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/introduction-to-wpf" + }, + { + "source_path": "docs/framework/wpf/security-wpf.md", + "redirect_url": "/dotnet/desktop/wpf/security-wpf" + }, + { + "source_path": "docs/framework/wpf/wpf-partial-trust-security.md", + "redirect_url": "/dotnet/desktop/wpf/wpf-partial-trust-security" + }, + { + "source_path": "docs/framework/wpf/wpf-samples.md", + "redirect_url": "/dotnet/desktop/wpf/wpf-samples" + }, + { + "source_path": "docs/framework/wpf/wpf-security-strategy-platform-security.md", + "redirect_url": "/dotnet/desktop/wpf/wpf-security-strategy-platform-security" + }, + { + "source_path": "docs/framework/wpf/wpf-security-strategy-security-engineering.md", + "redirect_url": "/dotnet/desktop/wpf/wpf-security-strategy-security-engineering" + }, + { + "source_path": "docs/framework/xaml-services/{}-escape-sequence-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/escape-sequence-markup-extension" + }, + { + "source_path": "docs/framework/xaml-services/built-in-types-for-common-xaml-language-primitives.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/types-for-primitives", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/collections-and-collection-types-for-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/collections-and-types", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/default-xaml-schema-context-and-wpf-xaml-schema-context.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/default-schema-context", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/defining-custom-types-for-use-with-net-framework-xaml-services.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/define-custom-types", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/escape-sequence-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/escape-sequence-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/generics-in-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/generics", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/index.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/index", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/markup-extensions-for-xaml-overview.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/markup-extensions-overview", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/service-contexts-available-to-type-converters-and-markup-extensions.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/service-contexts-with-type-converters-and-markup-extensions", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/type-converters-and-markup-extensions-for-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/type-converters-and-markup-extensions", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/type-converters-for-xaml-overview.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/type-converters-overview", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/types-migrated-from-wpf-to-system-xaml.md", + "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/understanding-xaml-node-stream-structures-and-concepts.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/understanding-xaml-node-stream-structures-and-concepts", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/whitespace-processing-in-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/white-space-processing", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-arguments-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xarguments-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-array-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xarray-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-class-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xclass-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-classmodifier-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xclassmodifier-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-code-intrinsic-xaml-type.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xcode-intrinsic-xaml-type", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-factorymethod-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xfactorymethod-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-fieldmodifier-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xfieldmodifier-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-key-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xkey-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-member-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xmember-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-members-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xmembers-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-name-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xname-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-null-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xnull-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-property-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xproperty-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-reference-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xreference-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-shared-attribute.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xshared-attribute", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-static-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xstatic-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-subclass-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xsubclass-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-type-markup-extension.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xtype-markup-extension", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-typearguments-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xtypearguments-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-uid-directive.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xuid-directive", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/x-xdata-intrinsic-xaml-type.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xdata-intrinsic-xaml-type", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xaml-2009-language-features.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xaml-2009-language-features", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xaml-namespace-x-language-features.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/namespace-language-features", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xaml-namespaces-for-net-framework-xaml-services.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/namespaces", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xaml-related-clr-attributes-for-custom-types-and-libraries.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/clr-attributes-with-custom-types-and-libraries", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xaml-security-considerations.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/security-considerations", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xamlname-grammar.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xamlname-grammar", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xamlservices-class-and-basic-xaml-reading-or-writing.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/basic-reading-writing", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xml-character-entities-and-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-character-entities", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xml-lang-handling-in-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-language-handling", + "redirect_document_id": true + }, + { + "source_path": "docs/framework/xaml-services/xml-space-handling-in-xaml.md", + "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-space-handling", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/async.md", + "redirect_url": "/dotnet/fsharp/tutorials/asynchronous-and-concurrent-programming/async" + }, + { + "source_path": "docs/fsharp/getting-started-netcore.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line" + }, + { + "source_path": "docs/fsharp/introduction-to-functional-programming/functions-as-first-class-values.md", + "redirect_url": "/dotnet/fsharp/introduction-to-functional-programming/first-class-functions", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/language-reference/code-formatting-guidelines.md", + "redirect_url": "/dotnet/fsharp/style-guide/formatting" + }, + { + "source_path": "docs/fsharp/language-reference/lazy-computations.md", + "redirect_url": "/dotnet/fsharp/language-reference/lazy-expressions", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/language-reference/primitive-types.md", + "redirect_url": "/dotnet/fsharp/language-reference/basic-types", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/language-reference/signatures.md", + "redirect_url": "/dotnet/fsharp/language-reference/signature-files" + }, + { + "source_path": "docs/fsharp/tutorials/asynchronous-and-concurrent-programming/index.md", + "redirect_url": "/dotnet/fsharp/tutorials/asynchronous-and-concurrent-programming/async" + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/getting-started-command-line.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/getting-started-cross-platform-tooling.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line" + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/getting-started-visual-studio-for-mac.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-with-visual-studio-for-mac", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/getting-started-visual-studio.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-visual-studio", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/getting-started-vscode.md", + "redirect_url": "/dotnet/fsharp/get-started/get-started-vscode", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/tutorials/getting-started/index.md", + "redirect_url": "/dotnet/fsharp/get-started/index", + "redirect_document_id": true + }, + { + "source_path": "docs/fsharp/tutorials/index.md", + "redirect_url": "/dotnet/fsharp/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-sql-database-entities.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-sql-database.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-web-service.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/accessing-an-odata-service.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/generating-fsharp-types-from-dbml.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/tutorials/type-providers/generating-fsharp-types-from-edmx.md", + "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + }, + { + "source_path": "docs/fsharp/using-fsharp-in-visual-studio/configuring-projects.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + }, + { + "source_path": "docs/fsharp/using-fsharp-in-visual-studio/index.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + }, + { + "source_path": "docs/fsharp/using-fsharp-in-visual-studio/targeting-older-versions-of-net.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-target-older-dotnet-versions" + }, + { + "source_path": "docs/fsharp/using-fsharp-in-visual-studio/visual-fsharp-development-environment-features.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + }, + { + "source_path": "docs/fsharp/using-fsharp-on-azure/using-fsharp-on-azure-service-fabric.md", + "redirect_url": "/dotnet/fsharp/using-fsharp-on-azure/index" + }, + { + "source_path": "docs/fsharp/whats-new/index.md", + "redirect_url": "/dotnet/fsharp/whats-new/fsharp-47", + "ms.custom": "updateeachrelease" + }, + { + "source_path": "docs/machine-learning/automl-overview.md", + "redirect_url": "/dotnet/machine-learning/automate-training-with-model-builder" + }, + { + "source_path": "docs/machine-learning/basic-concepts-model-training-in-mldotnet.md", + "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/consuming-model-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/save-load-machine-learning-models-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/determine-global-feature-importance-in-model.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/explain-machine-learning-model-permutation-feature-importance-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/load-data-from-mult-column-csv-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/load-data-from-multiple-files-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/load-data-from-text-file-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/load-non-file-training-data-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/normalizers-preprocess-data-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/single-predict-model-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/machine-learning-model-predictions-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/train-cross-validation-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/train-machine-learning-model-cross-validation-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/train-model-categorical-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/train-model-textual-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/train-regression-model-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/train-machine-learning-model-ml-net", + "redirect_document_id": true + }, + { + "source_path": "docs/machine-learning/how-to-guides/use-gams-for-model-explainability.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/explain-machine-learning-model-permutation-feature-importance-ml-net" + }, + { + "source_path": "docs/machine-learning/how-to-guides/verify-model-quality-ml-net.md", + "redirect_url": "/dotnet/machine-learning/how-to-guides/" + }, + { + "source_path": "docs/machine-learning/resources/basics.md", + "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" + }, + { + "source_path": "docs/machine-learning/resources/what-is-mldotnet.md", + "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/timing-behaviors-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/timing-behaviors-overview" + "source_path": "docs/machine-learning/tutorials/ml-cli.md", + "redirect_url": "/dotnet/machine-learning/tutorials/sentiment-analysis-cli", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/timing-events-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/timing-events-overview" + "source_path": "docs/machine-learning/tutorials/movie-recommmendation.md", + "redirect_url": "/dotnet/machine-learning/tutorials/movie-recommendation", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/transformations-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transformations-how-to-topics" + "source_path": "docs/machine-learning/tutorials/taxi-fare.md", + "redirect_url": "/dotnet/machine-learning/tutorials/predict-prices", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/graphics-multimedia/transformations.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transformations" + "source_path": "docs/machine-learning/what-is-machine-learning.md", + "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/transforms-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/transforms-overview" + "source_path": "docs/scenarios/index.md", + "redirect_url": "/dotnet/core/tutorials/" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/tutorial-hosting-visual-objects-in-a-win32-application.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/tutorial-hosting-visual-objects-in-a-win32-application" + "source_path": "docs/scenarios/solution-authoring/index.md", + "redirect_url": "/dotnet/core/tutorials/" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/using-drawingvisual-objects.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/using-drawingvisual-objects" + "source_path": "docs/scenarios/solution-authoring/target-dotnetcore-with-msbuild.md", + "redirect_url": "/dotnet/core/tools/cli-msbuild-architecture" + }, + { + "source_path": "docs/spark/tutorials/ml-sentment-analysis.md", + "redirect_url": "/dotnet/spark/tutorials/ml-sentiment-analysis" + }, + { + "source_path": "docs/standard/about.md", + "redirect_url": "/dotnet/standard/index" + }, + { + "source_path": "docs/standard/application-essentials.md", + "redirect_url": "/dotnet/standard/index" + }, + { + "source_path": "docs/standard/assembly-format.md", + "redirect_url": "/dotnet/standard/assembly/file-format", + "redirect_document_id": true + }, + { + "source_path": "docs/standard/assembly/friend-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/friend" + }, + { + "source_path": "docs/standard/assembly/program.md", + "redirect_url": "/dotnet/standard/assembly/index" + }, + { + "source_path": "docs/standard/assembly/unloadability-howto.md", + "redirect_url": "/dotnet/standard/assembly/unloadability" + }, + { + "source_path": "docs/standard/asynchronous-programming-patterns/multithreaded-programming-with-the-event-based-asynchronous-pattern.md", + "redirect_url": "/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-eap" + }, + { + "source_path": "docs/standard/base-types/alternation.md", + "redirect_url": "/dotnet/standard/base-types/alternation-constructs-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/anchors.md", + "redirect_url": "/dotnet/standard/base-types/anchors-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/backreference.md", + "redirect_url": "/dotnet/standard/base-types/backreference-constructs-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/backtracking.md", + "redirect_url": "/dotnet/standard/base-types/backtracking-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/changing-formats.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-example-changing-date-formats" + }, + { + "source_path": "docs/standard/base-types/classes.md", + "redirect_url": "/dotnet/standard/base-types/character-classes-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/compilation.md", + "redirect_url": "/dotnet/standard/base-types/compilation-and-reuse-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/composite-format.md", + "redirect_url": "/dotnet/standard/base-types/composite-formatting" + }, + { + "source_path": "docs/standard/base-types/custom-datetime.md", + "redirect_url": "/dotnet/standard/base-types/custom-date-and-time-format-strings" + }, + { + "source_path": "docs/standard/base-types/custom-numeric.md", + "redirect_url": "/dotnet/standard/base-types/custom-numeric-format-strings" + }, + { + "source_path": "docs/standard/base-types/custom-timespan.md", + "redirect_url": "/dotnet/standard/base-types/custom-timespan-format-strings" + }, + { + "source_path": "docs/standard/base-types/define-custom.md", + "redirect_url": "/dotnet/standard/base-types/how-to-define-and-use-custom-numeric-format-providers" + }, + { + "source_path": "docs/standard/base-types/display-dates.md", + "redirect_url": "/dotnet/standard/base-types/how-to-display-dates-in-non-gregorian-calendars" + }, + { + "source_path": "docs/standard/base-types/display-milliseconds.md", + "redirect_url": "/dotnet/standard/base-types/how-to-display-milliseconds-in-date-and-time-values" + }, + { + "source_path": "docs/standard/base-types/enumeration-format.md", + "redirect_url": "/dotnet/standard/base-types/enumeration-format-strings" + }, + { + "source_path": "docs/standard/base-types/escapes.md", + "redirect_url": "/dotnet/standard/base-types/character-escapes-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/extract-day.md", + "redirect_url": "/dotnet/standard/base-types/how-to-extract-the-day-of-the-week-from-a-specific-date" + }, + { + "source_path": "docs/standard/base-types/extract-protocol.md", + "redirect_url": "/dotnet/standard/base-types/how-to-extract-a-protocol-and-port-number-from-a-url" + }, + { + "source_path": "docs/standard/base-types/grouping.md", + "redirect_url": "/dotnet/standard/base-types/grouping-constructs-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/how-to-convert-numeric-user-input-in-web-controls-to-numbers.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb762964(v=vs.100)" + }, + { + "source_path": "docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb882561(v=vs.100)" + }, + { + "source_path": "docs/standard/base-types/index.md", + "redirect_url": "/dotnet/standard/base-types/common-type-system" + }, + { + "source_path": "docs/standard/base-types/manipulating-strings.md", + "redirect_url": "/dotnet/standard/base-types/best-practices-strings" + }, + { + "source_path": "docs/standard/base-types/miscellaneous.md", + "redirect_url": "/dotnet/standard/base-types/miscellaneous-constructs-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/object-model.md", + "redirect_url": "/dotnet/standard/base-types/the-regular-expression-object-model" + }, + { + "source_path": "docs/standard/base-types/options.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-options" + }, + { + "source_path": "docs/standard/base-types/pad-number.md", + "redirect_url": "/dotnet/standard/base-types/how-to-pad-a-number-with-leading-zeros" + }, + { + "source_path": "docs/standard/base-types/performing-formatting-operations.md", + "redirect_url": "/dotnet/standard/base-types/how-to-pad-a-number-with-leading-zeros" + }, + { + "source_path": "docs/standard/base-types/quantifiers.md", + "redirect_url": "/dotnet/standard/base-types/quantifiers-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/quick-ref.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-language-quick-reference" + }, + { + "source_path": "docs/standard/base-types/regex-behavior.md", + "redirect_url": "/dotnet/standard/base-types/details-of-regular-expression-behavior" + }, + { + "source_path": "docs/standard/base-types/regex-examples.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + }, + { + "source_path": "docs/standard/base-types/regular-expression-examples.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + }, + { + "source_path": "docs/standard/base-types/roundtrip.md", + "redirect_url": "/dotnet/standard/base-types/how-to-round-trip-date-and-time-values" + }, + { + "source_path": "docs/standard/base-types/scanning.md", + "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + }, + { + "source_path": "docs/standard/base-types/standard-datetime.md", + "redirect_url": "/dotnet/standard/base-types/standard-date-and-time-format-strings" + }, + { + "source_path": "docs/standard/base-types/standard-numeric.md", + "redirect_url": "/dotnet/standard/base-types/standard-numeric-format-strings" + }, + { + "source_path": "docs/standard/base-types/standard-timespan.md", + "redirect_url": "/dotnet/standard/base-types/standard-timespan-format-strings" + }, + { + "source_path": "docs/standard/base-types/strip-characters.md", + "redirect_url": "/dotnet/standard/base-types/how-to-strip-invalid-characters-from-a-string" + }, + { + "source_path": "docs/standard/base-types/substitutions.md", + "redirect_url": "/dotnet/standard/base-types/substitutions-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/thread-safety.md", + "redirect_url": "/dotnet/standard/base-types/thread-safety-in-regular-expressions" + }, + { + "source_path": "docs/standard/base-types/verify-format.md", + "redirect_url": "/dotnet/standard/base-types/how-to-verify-that-strings-are-in-valid-email-format" + }, + { + "source_path": "docs/standard/collections/threadsafe/blockingcollection-overview.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/blockingcollection-overview" + }, + { + "source_path": "docs/standard/collections/threadsafe/how-to-add-and-remove-items.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-and-remove-items" + }, + { + "source_path": "docs/standard/collections/threadsafe/how-to-add-and-take-items.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-and-take-items" + }, + { + "source_path": "docs/standard/collections/threadsafe/how-to-add-bounding-and-blocking.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-bounding-and-blocking" + }, + { + "source_path": "docs/standard/collections/threadsafe/how-to-create-an-object-pool.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-create-an-object-pool" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/visual-layer-programming-how-to-topics.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/visual-layer-programming-how-to-topics" + "source_path": "docs/standard/collections/threadsafe/how-to-use-arrays-of-blockingcollections.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-use-arrays-of-blockingcollections" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/visual-layer-programming.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/visual-layer-programming" + "source_path": "docs/standard/collections/threadsafe/how-to-use-foreach-to-remove.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-use-foreach-to-remove" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/wpf-brushes-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/wpf-brushes-overview" + "source_path": "docs/standard/collections/threadsafe/index.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/" }, { - "source_path": "docs/framework/wpf/graphics-multimedia/wpf-graphics-rendering-overview.md", - "redirect_url": "/dotnet/desktop/wpf/graphics-multimedia/wpf-graphics-rendering-overview" + "source_path": "docs/standard/collections/threadsafe/when-to-use-a-thread-safe-collection.md", + "redirect_url": "/dotnet/standard/collections/thread-safe/when-to-use-a-thread-safe-collection" }, { - "source_path": "docs/framework/wpf/index.md", - "redirect_url": "/dotnet/desktop/wpf/index" + "source_path": "docs/standard/concepts.md", + "redirect_url": "/dotnet/standard/" }, { - "source_path": "docs/framework/wpf/introduction-to-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/introduction-to-wpf" + "source_path": "docs/standard/cross-platform/windowsruntimestreamextensions-asrandomaccessstream-method.md", + "redirect_url": "/dotnet/api/System.IO.WindowsRuntimeStreamExtensions.AsRandomAccessStream" }, { - "source_path": "docs/framework/wpf/security-wpf.md", - "redirect_url": "/dotnet/desktop/wpf/security-wpf" + "source_path": "docs/standard/data/index.md", + "redirect_url": "/dotnet/standard/data/xml/index" }, { - "source_path": "docs/framework/wpf/wpf-partial-trust-security.md", - "redirect_url": "/dotnet/desktop/wpf/wpf-partial-trust-security" + "source_path": "docs/standard/design-guidelines/choosing-between-anonymous-and-tuple.md", + "redirect_url": "/dotnet/standard/base-types/choosing-between-anonymous-and-tuple" }, { - "source_path": "docs/framework/wpf/wpf-samples.md", - "redirect_url": "/dotnet/desktop/wpf/wpf-samples" + "source_path": "docs/standard/design-guidelines/dispose-pattern.md", + "redirect_url": "/dotnet/standard/garbage-collection/implementing-dispose" }, { - "source_path": "docs/framework/wpf/wpf-security-strategy-platform-security.md", - "redirect_url": "/dotnet/desktop/wpf/wpf-security-strategy-platform-security" + "source_path": "docs/standard/exceptions.md", + "redirect_url": "/dotnet/standard/exceptions/", + "redirect_document_id": true }, { - "source_path": "docs/framework/wpf/wpf-security-strategy-security-engineering.md", - "redirect_url": "/dotnet/desktop/wpf/wpf-security-strategy-security-engineering" + "source_path": "docs/standard/exceptions/exception-handling-fundamentals.md", + "redirect_url": "/dotnet/standard/exceptions/" }, { - "source_path": "docs/framework/xaml-services/{}-escape-sequence-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/escape-sequence-markup-extension" + "source_path": "docs/standard/exceptions/exception-hierarchy.md", + "redirect_url": "/dotnet/standard/exceptions/" }, { - "source_path": "docs/framework/xaml-services/built-in-types-for-common-xaml-language-primitives.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/types-for-primitives", - "redirect_document_id": true + "source_path": "docs/standard/garbage-collection/gc.md", + "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" }, { - "source_path": "docs/framework/xaml-services/collections-and-collection-types-for-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/collections-and-types", - "redirect_document_id": true + "source_path": "docs/standard/garbage-collection/memory-management-and-gc.md", + "redirect_url": "/dotnet/standard/garbage-collection/index" }, { - "source_path": "docs/framework/xaml-services/default-xaml-schema-context-and-wpf-xaml-schema-context.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/default-schema-context", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/fundamentals.md", + "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" }, { - "source_path": "docs/framework/xaml-services/defining-custom-types-for-use-with-net-framework-xaml-services.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/define-custom-types", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/gc.md", + "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" }, { - "source_path": "docs/framework/xaml-services/escape-sequence-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/escape-sequence-markup-extension", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/implementing-dispose.md", + "redirect_url": "/dotnet/standard/garbage-collection/implementing-dispose" }, { - "source_path": "docs/framework/xaml-services/generics-in-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/generics", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/index.md", + "redirect_url": "/dotnet/standard/garbage-collection/" }, { - "source_path": "docs/framework/xaml-services/index.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/index", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/induced.md", + "redirect_url": "/dotnet/standard/garbage-collection/induced" }, { - "source_path": "docs/framework/xaml-services/markup-extensions-for-xaml-overview.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/markup-extensions-overview", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/latency.md", + "redirect_url": "/dotnet/standard/garbage-collection/latency" }, { - "source_path": "docs/framework/xaml-services/service-contexts-available-to-type-converters-and-markup-extensions.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/service-contexts-with-type-converters-and-markup-extensions", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/unmanaged.md", + "redirect_url": "/dotnet/standard/garbage-collection/unmanaged" }, { - "source_path": "docs/framework/xaml-services/type-converters-and-markup-extensions-for-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/type-converters-and-markup-extensions", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/using-objects.md", + "redirect_url": "/dotnet/standard/garbage-collection/using-objects" }, { - "source_path": "docs/framework/xaml-services/type-converters-for-xaml-overview.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/type-converters-overview", - "redirect_document_id": true + "source_path": "docs/standard/garbagecollection/weak-references.md", + "redirect_url": "/dotnet/standard/garbage-collection/weak-references" }, { - "source_path": "docs/framework/xaml-services/types-migrated-from-wpf-to-system-xaml.md", - "redirect_url": "/dotnet/desktop/wpf/advanced/types-migrated-from-wpf-to-system", + "source_path": "docs/standard/getting-started.md", + "redirect_url": "/dotnet/standard/get-started", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/understanding-xaml-node-stream-structures-and-concepts.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/understanding-xaml-node-stream-structures-and-concepts", - "redirect_document_id": true + "source_path": "docs/standard/guidance-architecture.md", + "redirect_url": "/dotnet/architecture/index" }, { - "source_path": "docs/framework/xaml-services/whitespace-processing-in-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/white-space-processing", - "redirect_document_id": true + "source_path": "docs/standard/index.yml", + "redirect_url": "/dotnet/fundamentals/" }, { - "source_path": "docs/framework/xaml-services/x-arguments-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xarguments-directive", + "source_path": "docs/standard/library.md", + "redirect_url": "/dotnet/standard/net-standard", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-array-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xarray-markup-extension", + "source_path": "docs/standard/native-interop.md", + "redirect_url": "/dotnet/standard/native-interop/index", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-class-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xclass-directive", + "source_path": "docs/standard/native-interop/customize-parameter-marshalling.md", + "redirect_url": "/dotnet/standard/native-interop/customize-parameter-marshaling", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-classmodifier-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xclassmodifier-directive", + "source_path": "docs/standard/native-interop/customize-struct-marshalling.md", + "redirect_url": "/dotnet/standard/native-interop/customize-struct-marshaling", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-code-intrinsic-xaml-type.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xcode-intrinsic-xaml-type", + "source_path": "docs/standard/native-interop/type-marshalling.md", + "redirect_url": "/dotnet/standard/native-interop/type-marshaling", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-factorymethod-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xfactorymethod-directive", + "source_path": "docs/standard/parallel-programming/how-to-write-a-parallel-foreach-loop-with-thread-local-variables.md", + "redirect_url": "/dotnet/standard/parallel-programming/how-to-write-a-parallel-foreach-loop-with-partition-local-variables", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-fieldmodifier-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xfieldmodifier-directive", + "source_path": "docs/standard/parallel-programming/parallel-linq-plinq.md", + "redirect_url": "/dotnet/standard/parallel-programming/introduction-to-plinq", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-key-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xkey-directive", + "source_path": "docs/standard/portability-analyzer.md", + "redirect_url": "/dotnet/standard/analyzers/portability-analyzer", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/x-member-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xmember-directive", - "redirect_document_id": true + "source_path": "docs/standard/security/creating-a-cryptographic-scheme.md", + "redirect_url": "/dotnet/standard/security/cryptographic-services" }, { - "source_path": "docs/framework/xaml-services/x-members-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xmembers-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/add-element-for-xmlschemaimporterextensions.md", + "redirect_url": "/dotnet/standard/serialization/add-element-for-schemaimporterextensions" }, { - "source_path": "docs/framework/xaml-services/x-name-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xname-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/custom-serialization-order-with-xmlserializer.md", + "redirect_url": "/dotnet/standard/serialization/xml-and-soap-serialization" }, { - "source_path": "docs/framework/xaml-services/x-null-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xnull-markup-extension", - "redirect_document_id": true + "source_path": "docs/standard/serialization/marshal-by-value.md", + "redirect_url": "/dotnet/standard/serialization/serialization-concepts" }, { - "source_path": "docs/framework/xaml-services/x-property-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xproperty-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/persistent-storage.md", + "redirect_url": "/dotnet/standard/serialization/serialization-concepts" }, { - "source_path": "docs/framework/xaml-services/x-reference-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xreference-markup-extension", - "redirect_document_id": true + "source_path": "docs/standard/serialization/samples-binary.md", + "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" }, { - "source_path": "docs/framework/xaml-services/x-shared-attribute.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xshared-attribute", - "redirect_document_id": true + "source_path": "docs/standard/serialization/samples-xml.md", + "redirect_url": "/dotnet/standard/serialization/xml-and-soap-serialization" }, { - "source_path": "docs/framework/xaml-services/x-static-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xstatic-markup-extension", - "redirect_document_id": true + "source_path": "docs/standard/serialization/schemaimporterextension-technology-sample.md", + "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" }, { - "source_path": "docs/framework/xaml-services/x-subclass-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xsubclass-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/serialization-how-to-topics.md", + "redirect_url": "/dotnet/standard/serialization/how-to-serialize-an-object" }, { - "source_path": "docs/framework/xaml-services/x-type-markup-extension.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xtype-markup-extension", - "redirect_document_id": true + "source_path": "docs/standard/serialization/serialization-samples.md", + "redirect_url": "/dotnet/standard/serialization/index" }, { - "source_path": "docs/framework/xaml-services/x-typearguments-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xtypearguments-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/serialization-tools.md", + "redirect_url": "/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe" }, { - "source_path": "docs/framework/xaml-services/x-uid-directive.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xuid-directive", - "redirect_document_id": true + "source_path": "docs/standard/serialization/version-tolerant-serialization-technology-sample.md", + "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" }, { - "source_path": "docs/framework/xaml-services/x-xdata-intrinsic-xaml-type.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xdata-intrinsic-xaml-type", - "redirect_document_id": true + "source_path": "docs/standard/serialization/web-services-generics-serialization-technology-sample.md", + "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" }, { - "source_path": "docs/framework/xaml-services/xaml-2009-language-features.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xaml-2009-language-features", - "redirect_document_id": true + "source_path": "docs/standard/serialization/web-services-ixmlserializable-technology-sample.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/h2byscsb(v=vs.100)" }, { - "source_path": "docs/framework/xaml-services/xaml-namespace-x-language-features.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/namespace-language-features", - "redirect_document_id": true + "source_path": "docs/standard/threading/autoresetevent.md", + "redirect_url": "/dotnet/api/system.threading.autoresetevent" }, { - "source_path": "docs/framework/xaml-services/xaml-namespaces-for-net-framework-xaml-services.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/namespaces", - "redirect_document_id": true + "source_path": "docs/standard/threading/eventwaithandle-autoresetevent-countdownevent-manualresetevent.md", + "redirect_url": "/dotnet/standard/threading/overview-of-synchronization-primitives#thread-interaction-or-signaling" }, { - "source_path": "docs/framework/xaml-services/xaml-related-clr-attributes-for-custom-types-and-libraries.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/clr-attributes-with-custom-types-and-libraries", - "redirect_document_id": true + "source_path": "docs/standard/threading/interlocked-operations.md", + "redirect_url": "/dotnet/api/system.threading.interlocked" }, { - "source_path": "docs/framework/xaml-services/xaml-security-considerations.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/security-considerations", - "redirect_document_id": true + "source_path": "docs/standard/threading/managed-thread-states.md", + "redirect_url": "/dotnet/api/system.threading.threadstate" }, { - "source_path": "docs/framework/xaml-services/xamlname-grammar.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xamlname-grammar", - "redirect_document_id": true + "source_path": "docs/standard/threading/manualresetevent-and-manualreseteventslim.md", + "redirect_url": "/dotnet/api/system.threading.manualresetevent" }, { - "source_path": "docs/framework/xaml-services/xamlservices-class-and-basic-xaml-reading-or-writing.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/basic-reading-writing", - "redirect_document_id": true + "source_path": "docs/standard/threading/reader-writer-locks.md", + "redirect_url": "/dotnet/api/system.threading.readerwriterlockslim" }, { - "source_path": "docs/framework/xaml-services/xml-character-entities-and-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-character-entities", - "redirect_document_id": true + "source_path": "docs/standard/threading/thread-suspend-garbage-collection-and-safe-points.md", + "redirect_url": "/dotnet/api/system.threading.thread.suspend" }, { - "source_path": "docs/framework/xaml-services/xml-lang-handling-in-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-language-handling", + "source_path": "docs/standard/using-linq.md", + "redirect_url": "/dotnet/standard/linq/", "redirect_document_id": true }, { - "source_path": "docs/framework/xaml-services/xml-space-handling-in-xaml.md", - "redirect_url": "/dotnet/desktop-wpf/xaml-services/xml-space-handling", - "redirect_document_id": true + "source_path": "docs/tutorials/getting-started-with-csharp/microservices.md", + "redirect_url": "/dotnet/core/docker/" }, { - "source_path": "docs/fsharp/async.md", - "redirect_url": "/dotnet/fsharp/tutorials/asynchronous-and-concurrent-programming/async" + "source_path": "docs/tutorials/getting-started-with-csharp/working-with-linq.md", + "redirect_url": "/dotnet/csharp/tutorials/working-with-linq" }, { - "source_path": "docs/fsharp/getting-started-netcore.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line" + "source_path": "docs/tutorials/index.md", + "redirect_url": "/dotnet/samples-and-tutorials/" }, { - "source_path": "docs/fsharp/introduction-to-functional-programming/functions-as-first-class-values.md", - "redirect_url": "/dotnet/fsharp/introduction-to-functional-programming/first-class-functions", + "source_path": "docs/visual-basic/developing-apps/customizing-extending-my/customizing-projects-and-extending-my.md", + "redirect_url": "/dotnet/visual-basic/developing-apps/customizing-extending-my/index", "redirect_document_id": true }, { - "source_path": "docs/fsharp/language-reference/code-formatting-guidelines.md", - "redirect_url": "/dotnet/fsharp/style-guide/formatting" + "source_path": "docs/visual-basic/developing-apps/debugging.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/debugger/debugger-basics" }, { - "source_path": "docs/fsharp/language-reference/lazy-computations.md", - "redirect_url": "/dotnet/fsharp/language-reference/lazy-expressions", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/adding-printable-reports-to-visual-studio-applications.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233804(v=vs.100)" }, { - "source_path": "docs/fsharp/language-reference/primitive-types.md", - "redirect_url": "/dotnet/fsharp/language-reference/basic-types", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/deploying-applications-that-reference-the-printform-component.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882689(v=vs.100)" }, { - "source_path": "docs/fsharp/language-reference/signatures.md", - "redirect_url": "/dotnet/fsharp/language-reference/signature-files" + "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-a-form-by-using-the-printform-component.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629268(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/asynchronous-and-concurrent-programming/index.md", - "redirect_url": "/dotnet/fsharp/tutorials/asynchronous-and-concurrent-programming/async" + "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-a-scrollable-form.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb690944(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/getting-started-command-line.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-client-and-non-client-areas-of-a-form.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629243(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/getting-started-cross-platform-tooling.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-command-line" + "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-the-client-area-of-a-form.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629256(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/getting-started-visual-studio-for-mac.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-with-visual-studio-for-mac", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/index.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882691(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/getting-started-visual-studio.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-visual-studio", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/printform-component.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb690938(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/getting-started-vscode.md", - "redirect_url": "/dotnet/fsharp/get-started/get-started-vscode", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/printing/printing-and-reporting.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882691(v=vs.100)" }, { - "source_path": "docs/fsharp/tutorials/getting-started/index.md", - "redirect_url": "/dotnet/fsharp/get-started/index", + "source_path": "docs/visual-basic/developing-apps/programming/app-settings/accessing-application-settings.md", + "redirect_url": "/dotnet/visual-basic/developing-apps/programming/app-settings/index", "redirect_document_id": true }, { - "source_path": "docs/fsharp/tutorials/index.md", - "redirect_url": "/dotnet/fsharp/index" + "source_path": "docs/visual-basic/developing-apps/programming/computer-resources/computer-resources.md", + "redirect_url": "/dotnet/visual-basic/developing-apps/programming/computer-resources/index", + "redirect_document_id": true }, { - "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-sql-database-entities.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/programming/drives-directories-files/processing.md", + "redirect_url": "/dotnet/visual-basic/developing-apps/programming/drives-directories-files/index", + "redirect_document_id": true }, { - "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-sql-database.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/using-ide/help-for-event-handlers.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/using-intellisense" }, { - "source_path": "docs/fsharp/tutorials/type-providers/accessing-a-web-service.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/using-ide/how-to-compile-and-run-a-project.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/compiling-and-building-in-visual-studio" }, { - "source_path": "docs/fsharp/tutorials/type-providers/accessing-an-odata-service.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/using-ide/intellisense-code-snippets.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/code-snippets" }, { - "source_path": "docs/fsharp/tutorials/type-providers/generating-fsharp-types-from-dbml.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/using-ide/refactoring-and-rename-dialog-box.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/vb-ide/refactoring-vb" }, { - "source_path": "docs/fsharp/tutorials/type-providers/generating-fsharp-types-from-edmx.md", - "redirect_url": "/dotnet/fsharp/tutorials/type-providers/index" + "source_path": "docs/visual-basic/developing-apps/using-ide/settings.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/reference/general-user-interface-elements-visual-studio" }, { - "source_path": "docs/fsharp/using-fsharp-in-visual-studio/configuring-projects.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + "source_path": "docs/visual-basic/developing-apps/using-ide/using-the-visual-basic-development-environment.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/ide/visual-studio-ide" }, { - "source_path": "docs/fsharp/using-fsharp-in-visual-studio/index.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + "source_path": "docs/visual-basic/developing-apps/windows-forms/datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488279(v=vs.120)" }, { - "source_path": "docs/fsharp/using-fsharp-in-visual-studio/targeting-older-versions-of-net.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-target-older-dotnet-versions" + "source_path": "docs/visual-basic/developing-apps/windows-forms/deploying-applications-that-reference-power-packs-controls-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488314(v=vs.120)" }, { - "source_path": "docs/fsharp/using-fsharp-in-visual-studio/visual-fsharp-development-environment-features.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/fsharp-visual-studio" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-change-the-appearance-of-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488194(v=vs.120)" }, { - "source_path": "docs/fsharp/using-fsharp-on-azure/using-fsharp-on-azure-service-fabric.md", - "redirect_url": "/dotnet/fsharp/using-fsharp-on-azure/index" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-change-the-layout-of-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488199(v=vs.120)" }, { - "source_path": "docs/fsharp/whats-new/index.md", - "redirect_url": "/dotnet/fsharp/whats-new/fsharp-47", - "ms.custom": "updateeachrelease" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-create-a-master-detail-form-by-using-two-datarepeater-controls.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488313(v=vs.120)" }, { - "source_path": "docs/machine-learning/automl-overview.md", - "redirect_url": "/dotnet/machine-learning/automate-training-with-model-builder" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-disable-adding-and-deleting-datarepeater-items-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488185(v=vs.120)" }, { - "source_path": "docs/machine-learning/basic-concepts-model-training-in-mldotnet.md", - "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-bound-data-in-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488274(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/consuming-model-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/save-load-machine-learning-models-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-item-headers-in-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488200(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/determine-global-feature-importance-in-model.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/explain-machine-learning-model-permutation-feature-importance-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-unbound-controls-in-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488315(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/load-data-from-mult-column-csv-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-draw-lines-with-the-lineshape-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488281(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/load-data-from-multiple-files-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-draw-shapes-with-the-ovalshape-and-rectangleshape-controls.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488183(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/load-data-from-text-file-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-enable-tabbing-between-shapes-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488184(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/load-non-file-training-data-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/load-data-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-search-data-in-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488282(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/normalizers-preprocess-data-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/introduction-to-the-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488280(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/single-predict-model-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/machine-learning-model-predictions-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/introduction-to-the-line-and-shape-controls-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488275(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/train-cross-validation-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/train-machine-learning-model-cross-validation-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/line-and-shape-controls-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488190(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/train-model-categorical-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/power-packs-controls.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488277(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/train-model-textual-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/prepare-data-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/troubleshooting-the-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488312(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/train-regression-model-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/train-machine-learning-model-ml-net", - "redirect_document_id": true + "source_path": "docs/visual-basic/developing-apps/windows-forms/virtual-mode-in-the-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488276(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/use-gams-for-model-explainability.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/explain-machine-learning-model-permutation-feature-importance-ml-net" + "source_path": "docs/visual-basic/developing-apps/windows-forms/walkthrough-displaying-data-in-a-datarepeater-control-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488278(v=vs.120)" }, { - "source_path": "docs/machine-learning/how-to-guides/verify-model-quality-ml-net.md", - "redirect_url": "/dotnet/machine-learning/how-to-guides/" + "source_path": "docs/visual-basic/developing-apps/windows-forms/windows-forms-application-basics.md", + "redirect_url": "/dotnet/visual-basic/developing-apps/windows-forms/index", + "redirect_document_id": true }, { - "source_path": "docs/machine-learning/resources/basics.md", - "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" + "source_path": "docs/visual-basic/getting-started/breaking-changes-in-visual-studio-2015.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/porting/porting-migrating-and-upgrading-visual-studio-projects?view=vs-2015" }, { - "source_path": "docs/machine-learning/resources/what-is-mldotnet.md", - "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" + "source_path": "docs/visual-basic/getting-started/breaking-changes-in-visual-studio.md", + "redirect_url": "https://docs.microsoft.com/visualstudio/porting/porting-migrating-and-upgrading-visual-studio-projects?view=vs-2015" }, { - "source_path": "docs/machine-learning/tutorials/ml-cli.md", - "redirect_url": "/dotnet/machine-learning/tutorials/sentiment-analysis-cli", - "redirect_document_id": true + "source_path": "docs/visual-basic/getting-started/whats-new.md", + "redirect_url": "/dotnet/visual-basic/whats-new/" }, { - "source_path": "docs/machine-learning/tutorials/movie-recommmendation.md", - "redirect_url": "/dotnet/machine-learning/tutorials/movie-recommendation", + "source_path": "docs/visual-basic/language-reference/data-types/data-type-summary.md", + "redirect_url": "/dotnet/visual-basic/language-reference/data-types/index", "redirect_document_id": true }, { - "source_path": "docs/machine-learning/tutorials/taxi-fare.md", - "redirect_url": "/dotnet/machine-learning/tutorials/predict-prices", + "source_path": "docs/visual-basic/language-reference/directives/directives.md", + "redirect_url": "/dotnet/visual-basic/language-reference/directives/index", "redirect_document_id": true }, { - "source_path": "docs/machine-learning/what-is-machine-learning.md", - "redirect_url": "/dotnet/machine-learning/how-does-mldotnet-work" + "source_path": "docs/visual-basic/language-reference/error-messages/a-reference-was-created-to-embedded-interop-assembly-assembly1.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc40059" }, { - "source_path": "docs/scenarios/index.md", - "redirect_url": "/dotnet/core/tutorials/" + "source_path": "docs/visual-basic/language-reference/error-messages/access-of-shared-member-through-an-instance-qualifying-expression.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc42025" }, { - "source_path": "docs/scenarios/solution-authoring/index.md", - "redirect_url": "/dotnet/core/tutorials/" + "source_path": "docs/visual-basic/language-reference/error-messages/addressof-operand-must-be-the-name-of-a-method-without-parentheses.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30577" }, { - "source_path": "docs/scenarios/solution-authoring/target-dotnetcore-with-msbuild.md", - "redirect_url": "/dotnet/core/tools/cli-msbuild-architecture" + "source_path": "docs/visual-basic/language-reference/error-messages/anonymous-type-member-name-can-be-inferred-only-from-a-simple-or-qualified-name.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc36556" }, { - "source_path": "docs/spark/tutorials/ml-sentment-analysis.md", - "redirect_url": "/dotnet/spark/tutorials/ml-sentiment-analysis" + "source_path": "docs/visual-basic/language-reference/error-messages/array-bounds-cannot-appear-in-type-specifiers.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30638" }, { - "source_path": "docs/standard/about.md", - "redirect_url": "/dotnet/standard/index" + "source_path": "docs/visual-basic/language-reference/error-messages/array-declared-as-for-loop-control-variable-cannot-be-declared.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc32039" }, { - "source_path": "docs/standard/application-essentials.md", - "redirect_url": "/dotnet/standard/index" + "source_path": "docs/visual-basic/language-reference/error-messages/array-subscript-expression-missing.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30306" }, { - "source_path": "docs/standard/assembly-format.md", - "redirect_url": "/dotnet/standard/assembly/file-format", - "redirect_document_id": true + "source_path": "docs/visual-basic/language-reference/error-messages/arrays-declared-as-structure-members-cannot-be-declared-with-an-initial-size.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc31043" }, - { - "source_path": "docs/standard/assembly/friend-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/friend" + { + "source_path": "docs/visual-basic/language-reference/error-messages/as-any-is-not-supported-in-declare-statements.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30828" }, { - "source_path": "docs/standard/assembly/program.md", - "redirect_url": "/dotnet/standard/assembly/index" + "source_path": "docs/visual-basic/language-reference/error-messages/because-this-call-is-not-awaited-the-current-method-continues-to-run.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc42358" }, { - "source_path": "docs/standard/assembly/unloadability-howto.md", - "redirect_url": "/dotnet/standard/assembly/unloadability" + "source_path": "docs/visual-basic/language-reference/error-messages/can-t-open-filename-for-writing.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc2012" }, { - "source_path": "docs/standard/asynchronous-programming-patterns/multithreaded-programming-with-the-event-based-asynchronous-pattern.md", - "redirect_url": "/dotnet/standard/asynchronous-programming-patterns/event-based-asynchronous-pattern-eap" + "source_path": "docs/visual-basic/language-reference/error-messages/cannot-convert-anonymous-type-to-expression-tree.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc36548" }, { - "source_path": "docs/standard/base-types/alternation.md", - "redirect_url": "/dotnet/standard/base-types/alternation-constructs-in-regular-expressions" + "source_path": "docs/visual-basic/language-reference/error-messages/cannot-refer-to-an-instance-member-of-a-class.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30369" }, { - "source_path": "docs/standard/base-types/anchors.md", - "redirect_url": "/dotnet/standard/base-types/anchors-in-regular-expressions" + "source_path": "docs/visual-basic/language-reference/error-messages/cannot-refer-to-name-because-it-is-member-of-value-typed-field-name-of-class.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30310" }, { - "source_path": "docs/standard/base-types/backreference.md", - "redirect_url": "/dotnet/standard/base-types/backreference-constructs-in-regular-expressions" + "source_path": "docs/visual-basic/language-reference/error-messages/class-classname-cannot-be-found.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc31098" }, { - "source_path": "docs/standard/base-types/backtracking.md", - "redirect_url": "/dotnet/standard/base-types/backtracking-in-regular-expressions" + "source_path": "docs/visual-basic/language-reference/queries/queries.md", + "redirect_url": "/dotnet/visual-basic/language-reference/queries/index", + "redirect_document_id": true }, { - "source_path": "docs/standard/base-types/changing-formats.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-example-changing-date-formats" + "source_path": "docs/visual-basic/language-reference/xml-axis/xml-axis-properties.md", + "redirect_url": "/dotnet/visual-basic/language-reference/xml-axis/index", + "redirect_document_id": true }, { - "source_path": "docs/standard/base-types/classes.md", - "redirect_url": "/dotnet/standard/base-types/character-classes-in-regular-expressions" + "source_path": "docs/visual-basic/language-reference/xmldoc/recommended-xml-tags-for-documentation-comments.md", + "redirect_url": "/dotnet/visual-basic/language-reference/xmldoc/index", + "redirect_document_id": true }, { - "source_path": "docs/standard/base-types/compilation.md", - "redirect_url": "/dotnet/standard/base-types/compilation-and-reuse-in-regular-expressions" + "source_path": "docs/visual-basic/misc/a-class-used-in-the-expression-is-not-loaded-during-debugging-session.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/composite-format.md", - "redirect_url": "/dotnet/standard/base-types/composite-formatting" + "source_path": "docs/visual-basic/misc/attribute-structlayout-can-not-be-applied-to-a-generic-type.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/custom-datetime.md", - "redirect_url": "/dotnet/standard/base-types/custom-date-and-time-format-strings" + "source_path": "docs/visual-basic/misc/bc2029.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/custom-numeric.md", - "redirect_url": "/dotnet/standard/base-types/custom-numeric-format-strings" + "source_path": "docs/visual-basic/misc/bc2031.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/custom-timespan.md", - "redirect_url": "/dotnet/standard/base-types/custom-timespan-format-strings" + "source_path": "docs/visual-basic/misc/bc2035.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/define-custom.md", - "redirect_url": "/dotnet/standard/base-types/how-to-define-and-use-custom-numeric-format-providers" + "source_path": "docs/visual-basic/misc/bc30963.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/display-dates.md", - "redirect_url": "/dotnet/standard/base-types/how-to-display-dates-in-non-gregorian-calendars" + "source_path": "docs/visual-basic/misc/bc30964.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/display-milliseconds.md", - "redirect_url": "/dotnet/standard/base-types/how-to-display-milliseconds-in-date-and-time-values" + "source_path": "docs/visual-basic/misc/bc30965.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/enumeration-format.md", - "redirect_url": "/dotnet/standard/base-types/enumeration-format-strings" + "source_path": "docs/visual-basic/misc/bc30966.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/escapes.md", - "redirect_url": "/dotnet/standard/base-types/character-escapes-in-regular-expressions" + "source_path": "docs/visual-basic/misc/bc30972.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/extract-day.md", - "redirect_url": "/dotnet/standard/base-types/how-to-extract-the-day-of-the-week-from-a-specific-date" + "source_path": "docs/visual-basic/misc/bc30973.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/extract-protocol.md", - "redirect_url": "/dotnet/standard/base-types/how-to-extract-a-protocol-and-port-number-from-a-url" + "source_path": "docs/visual-basic/misc/bc35000.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/grouping.md", - "redirect_url": "/dotnet/standard/base-types/grouping-constructs-in-regular-expressions" + "source_path": "docs/visual-basic/misc/bc35001.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/how-to-convert-numeric-user-input-in-web-controls-to-numbers.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb762964(v=vs.100)" + "source_path": "docs/visual-basic/misc/bc35002.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/how-to-display-localized-date-and-time-information-to-web-users.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/bb882561(v=vs.100)" + "source_path": "docs/visual-basic/misc/bc42327.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/index.md", - "redirect_url": "/dotnet/standard/base-types/common-type-system" + "source_path": "docs/visual-basic/misc/comment-statements-cannot-be-evaluated.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/manipulating-strings.md", - "redirect_url": "/dotnet/standard/base-types/best-practices-strings" + "source_path": "docs/visual-basic/misc/for-loop-control-variable-already-in-use-by-an-enclosing-for-loop.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/miscellaneous.md", - "redirect_url": "/dotnet/standard/base-types/miscellaneous-constructs-in-regular-expressions" + "source_path": "docs/visual-basic/misc/next-control-variable-does-not-match-for-loop-control-variable.md", + "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" }, { - "source_path": "docs/standard/base-types/object-model.md", - "redirect_url": "/dotnet/standard/base-types/the-regular-expression-object-model" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/friend-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/friend" }, { - "source_path": "docs/standard/base-types/options.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-options" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-and-use-assemblies-using-the-command-line.md", + "redirect_url": "/dotnet/standard/assembly/index" }, { - "source_path": "docs/standard/base-types/pad-number.md", - "redirect_url": "/dotnet/standard/base-types/how-to-pad-a-number-with-leading-zeros" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-signed-friend-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/create-signed-friend" }, { - "source_path": "docs/standard/base-types/performing-formatting-operations.md", - "redirect_url": "/dotnet/standard/base-types/how-to-pad-a-number-with-leading-zeros" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-unsigned-friend-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/create-unsigned-friend" }, { - "source_path": "docs/standard/base-types/quantifiers.md", - "redirect_url": "/dotnet/standard/base-types/quantifiers-in-regular-expressions" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-determine-if-a-file-is-an-assembly.md", + "redirect_url": "/dotnet/standard/assembly/identify" }, { - "source_path": "docs/standard/base-types/quick-ref.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-language-quick-reference" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-load-and-unload-assemblies.md", + "redirect_url": "/dotnet/standard/assembly/load-unload" }, { - "source_path": "docs/standard/base-types/regex-behavior.md", - "redirect_url": "/dotnet/standard/base-types/details-of-regular-expression-behavior" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-share-an-assembly-with-other-applications.md", + "redirect_url": "/dotnet/framework/app-domains/how-to-share-an-assembly-with-other-applications" }, { - "source_path": "docs/standard/base-types/regex-examples.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/index.md", + "redirect_url": "/dotnet/standard/assembly" }, { - "source_path": "docs/standard/base-types/regular-expression-examples.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/walkthrough-embedding-type-information-from-microsoft-office-assemblies-in-vs.md", + "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/ee317478(v%3dvs.120)" }, { - "source_path": "docs/standard/base-types/roundtrip.md", - "redirect_url": "/dotnet/standard/base-types/how-to-round-trip-date-and-time-values" + "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/walkthrough-embedding-types-from-managed-assemblies-in-vs.md", + "redirect_url": "/dotnet/standard/assembly/embed-types-visual-studio" }, { - "source_path": "docs/standard/base-types/scanning.md", - "redirect_url": "/dotnet/standard/base-types/regular-expression-example-scanning-for-hrefs" + "source_path": "docs/visual-basic/programming-guide/concepts/covariance-contravariance/covariance-and-contravariance.md", + "redirect_url": "/dotnet/visual-basic/programming-guide/concepts/covariance-contravariance/index", + "redirect_document_id": true }, { - "source_path": "docs/standard/base-types/standard-datetime.md", - "redirect_url": "/dotnet/standard/base-types/standard-date-and-time-format-strings" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/add-elements-attributes-nodes-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/standard-numeric.md", - "redirect_url": "/dotnet/standard/base-types/standard-numeric-format-strings" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/advanced-linq-to-xml-programming.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-annotations", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/standard-timespan.md", - "redirect_url": "/dotnet/standard/base-types/standard-timespan-format-strings" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/advanced-query-techniques-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/join-two-collections", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/strip-characters.md", - "redirect_url": "/dotnet/standard/base-types/how-to-strip-invalid-characters-from-a-string" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/applicability-of-functional-transformation.md", + "redirect_url": "/dotnet/standard/linq/applicability-functional-transformation", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/substitutions.md", - "redirect_url": "/dotnet/standard/base-types/substitutions-in-regular-expressions" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/atomized-xname-xnamespace-objects", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/thread-safety.md", - "redirect_url": "/dotnet/standard/base-types/thread-safety-in-regular-expressions" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-element-specific-attribute", + "redirect_document_id": false }, { - "source_path": "docs/standard/base-types/verify-format.md", - "redirect_url": "/dotnet/standard/base-types/how-to-verify-that-strings-are-in-valid-email-format" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/comparison-xpath-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/blockingcollection-overview.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/blockingcollection-overview" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md", + "redirect_url": "/dotnet/standard/linq/concepts-terminology-functional-transformation", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-add-and-remove-items.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-and-remove-items" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/create-source-office-open-xml-document", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-add-and-take-items.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-and-take-items" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/creating-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/xml-literals", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-add-bounding-and-blocking.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-add-bounding-and-blocking" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/deferred-execution-lazy-evaluation", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-create-an-object-pool.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-create-an-object-pool" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/deferred-execution-example.md", + "redirect_url": "/dotnet/standard/linq/deferred-execution-example", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-use-arrays-of-blockingcollections.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-use-arrays-of-blockingcollections" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/details-of-office-open-xml-wordprocessingml-documents.md", + "redirect_url": "/dotnet/standard/linq/wordprocessingml-document-styles", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/how-to-use-foreach-to-remove.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/how-to-use-foreach-to-remove" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md", + "redirect_url": "/dotnet/standard/linq/example-outputs-office-open-xml-document-parts", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/index.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/finding-text-in-word-documents.md", + "redirect_url": "/dotnet/standard/linq/find-text-word-documents", + "redirect_document_id": false }, { - "source_path": "docs/standard/collections/threadsafe/when-to-use-a-thread-safe-collection.md", - "redirect_url": "/dotnet/standard/collections/thread-safe/when-to-use-a-thread-safe-collection" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/finding-the-default-paragraph-style.md", + "redirect_url": "/dotnet/standard/linq/find-default-paragraph-style", + "redirect_document_id": false }, { - "source_path": "docs/standard/concepts.md", - "redirect_url": "/dotnet/standard/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/functional-construction-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-construction", + "redirect_document_id": false }, { - "source_path": "docs/standard/cross-platform/windowsruntimestreamextensions-asrandomaccessstream-method.md", - "redirect_url": "/dotnet/api/System.IO.WindowsRuntimeStreamExtensions.AsRandomAccessStream" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-imperative-programming", + "redirect_document_id": false }, { - "source_path": "docs/standard/data/index.md", - "redirect_url": "/dotnet/standard/data/xml/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/functional-transformation-of-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-transformation-xml", + "redirect_document_id": false }, { - "source_path": "docs/standard/design-guidelines/choosing-between-anonymous-and-tuple.md", - "redirect_url": "/dotnet/standard/base-types/choosing-between-anonymous-and-tuple" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming", + "redirect_document_id": false }, { - "source_path": "docs/standard/design-guidelines/dispose-pattern.md", - "redirect_url": "/dotnet/standard/garbage-collection/implementing-dispose" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/getting-started-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/standard/exceptions.md", - "redirect_url": "/dotnet/standard/exceptions/", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md", + "redirect_url": "/dotnet/standard/linq/build-linq-xml-examples", + "redirect_document_id": false }, { - "source_path": "docs/standard/exceptions/exception-handling-fundamentals.md", - "redirect_url": "/dotnet/standard/exceptions/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md", + "redirect_url": "/dotnet/standard/linq/calculate-intermediate-values", + "redirect_document_id": false }, { - "source_path": "docs/standard/exceptions/exception-hierarchy.md", - "redirect_url": "/dotnet/standard/exceptions/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-catch-parsing-errors.md", + "redirect_url": "/dotnet/standard/linq/catch-parsing-errors", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbage-collection/gc.md", - "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/chain-axis-method-calls", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbage-collection/memory-management-and-gc.md", - "redirect_url": "/dotnet/standard/garbage-collection/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/change-namespace-entire-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/fundamentals.md", - "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/control-namespace-prefixes", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/gc.md", - "redirect_url": "/dotnet/standard/garbage-collection/fundamentals" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md", + "redirect_url": "/dotnet/standard/linq/control-type-projection", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/implementing-dispose.md", - "redirect_url": "/dotnet/standard/garbage-collection/implementing-dispose" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces.md", + "redirect_url": "/dotnet/standard/linq/create-document-namespaces-visual-basic", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/index.md", - "redirect_url": "/dotnet/standard/garbage-collection/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md", + "redirect_url": "/dotnet/standard/linq/create-tree-xmlreader", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/induced.md", - "redirect_url": "/dotnet/standard/garbage-collection/induced" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md", + "redirect_url": "/dotnet/standard/linq/create-hierarchy-grouping", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/latency.md", - "redirect_url": "/dotnet/standard/garbage-collection/latency" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md", + "redirect_url": "/dotnet/standard/linq/debug-empty-query-results-sets", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/unmanaged.md", - "redirect_url": "/dotnet/standard/garbage-collection/unmanaged" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/filter-attribute", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/using-objects.md", - "redirect_url": "/dotnet/standard/garbage-collection/using-objects" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md", + "redirect_url": "/dotnet/standard/linq/filter-optional-element", + "redirect_document_id": false }, { - "source_path": "docs/standard/garbagecollection/weak-references.md", - "redirect_url": "/dotnet/standard/garbage-collection/weak-references" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/filter-element-names", + "redirect_document_id": false }, { - "source_path": "docs/standard/getting-started.md", - "redirect_url": "/dotnet/standard/get-started", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-child-element", + "redirect_document_id": false }, { - "source_path": "docs/standard/guidance-architecture.md", - "redirect_url": "/dotnet/architecture/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-list-child-elements", + "redirect_document_id": false }, { - "source_path": "docs/standard/index.yml", - "redirect_url": "/dotnet/fundamentals/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md", + "redirect_url": "/dotnet/standard/linq/find-single-descendant-descendants-method", + "redirect_document_id": false }, { - "source_path": "docs/standard/library.md", - "redirect_url": "/dotnet/standard/net-standard", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath.md", + "redirect_url": "/dotnet/standard/linq/find-union-two-location-paths", + "redirect_document_id": false }, { - "source_path": "docs/standard/native-interop.md", - "redirect_url": "/dotnet/standard/native-interop/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/find-all-nodes-namespace", + "redirect_document_id": false }, { - "source_path": "docs/standard/native-interop/customize-parameter-marshalling.md", - "redirect_url": "/dotnet/standard/native-interop/customize-parameter-marshaling", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-attribute-parent", + "redirect_document_id": false }, { - "source_path": "docs/standard/native-interop/customize-struct-marshalling.md", - "redirect_url": "/dotnet/standard/native-interop/customize-struct-marshaling", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md", + "redirect_url": "/dotnet/standard/linq/find-element-specific-attribute", + "redirect_document_id": false }, { - "source_path": "docs/standard/native-interop/type-marshalling.md", - "redirect_url": "/dotnet/standard/native-interop/type-marshaling", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md", + "redirect_url": "/dotnet/standard/linq/find-element-specific-child-element", + "redirect_document_id": false }, { - "source_path": "docs/standard/parallel-programming/how-to-write-a-parallel-foreach-loop-with-thread-local-variables.md", - "redirect_url": "/dotnet/standard/parallel-programming/how-to-write-a-parallel-foreach-loop-with-partition-local-variables", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name.md", + "redirect_url": "/dotnet/standard/linq/find-attributes-siblings-specific-name", + "redirect_document_id": false }, { - "source_path": "docs/standard/parallel-programming/parallel-linq-plinq.md", - "redirect_url": "/dotnet/standard/parallel-programming/introduction-to-plinq", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position.md", + "redirect_url": "/dotnet/standard/linq/find-child-elements-based-position", + "redirect_document_id": false }, { - "source_path": "docs/standard/portability-analyzer.md", - "redirect_url": "/dotnet/standard/analyzers/portability-analyzer", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-descendant-elements", + "redirect_document_id": false }, { - "source_path": "docs/standard/security/creating-a-cryptographic-scheme.md", - "redirect_url": "/dotnet/standard/security/cryptographic-services" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-descendants-child-element", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/add-element-for-xmlschemaimporterextensions.md", - "redirect_url": "/dotnet/standard/serialization/add-element-for-schemaimporterextensions" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md", + "redirect_url": "/dotnet/standard/linq/find-descendants-specific-element-name", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/custom-serialization-order-with-xmlserializer.md", - "redirect_url": "/dotnet/standard/serialization/xml-and-soap-serialization" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/find-elements-namespace", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/marshal-by-value.md", - "redirect_url": "/dotnet/standard/serialization/serialization-concepts" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute.md", + "redirect_url": "/dotnet/standard/linq/find-elements-specific-attribute", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/persistent-storage.md", - "redirect_url": "/dotnet/standard/serialization/serialization-concepts" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-preceding-siblings", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/samples-binary.md", - "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-related-elements", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/samples-xml.md", - "redirect_url": "/dotnet/standard/serialization/xml-and-soap-serialization" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-sibling-nodes", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/schemaimporterextension-technology-sample.md", - "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-immediate-preceding-sibling", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/serialization-how-to-topics.md", - "redirect_url": "/dotnet/standard/serialization/how-to-serialize-an-object" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/find-root-element", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/serialization-samples.md", - "redirect_url": "/dotnet/standard/serialization/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md", + "redirect_url": "/dotnet/standard/linq/generate-text-files-xml", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/serialization-tools.md", - "redirect_url": "/dotnet/standard/serialization/xml-serializer-generator-tool-sgen-exe" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md", + "redirect_url": "/dotnet/standard/linq/generate-xml-csv-files", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/version-tolerant-serialization-technology-sample.md", - "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/join-two-collections", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/web-services-generics-serialization-technology-sample.md", - "redirect_url": "/dotnet/standard/serialization/basic-serialization-technology-sample" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md", + "redirect_url": "/dotnet/standard/linq/list-all-nodes-tree", + "redirect_document_id": false }, { - "source_path": "docs/standard/serialization/web-services-ixmlserializable-technology-sample.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/dotnet/netframework-4.0/h2byscsb(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md", + "redirect_url": "/dotnet/standard/linq/load-xml-file", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/autoresetevent.md", - "redirect_url": "/dotnet/api/system.threading.autoresetevent" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/modify-office-open-xml-document", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/eventwaithandle-autoresetevent-countdownevent-manualresetevent.md", - "redirect_url": "/dotnet/standard/threading/overview-of-synchronization-primitives#thread-interaction-or-signaling" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-parse-a-string.md", + "redirect_url": "/dotnet/standard/linq/parse-string", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/interlocked-operations.md", - "redirect_url": "/dotnet/api/system.threading.interlocked" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md", + "redirect_url": "/dotnet/standard/linq/perform-streaming-transform-large-xml-documents", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/managed-thread-states.md", - "redirect_url": "/dotnet/api/system.threading.threadstate" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md", + "redirect_url": "/dotnet/standard/linq/populate-xml-tree-file-system", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/manualresetevent-and-manualreseteventslim.md", - "redirect_url": "/dotnet/api/system.threading.manualresetevent" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/populate-xml-tree-xmlwriter", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/reader-writer-locks.md", - "redirect_url": "/dotnet/api/system.threading.readerwriterlockslim" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/project-new-type", + "redirect_document_id": false }, { - "source_path": "docs/standard/threading/thread-suspend-garbage-collection-and-safe-points.md", - "redirect_url": "/dotnet/api/system.threading.thread.suspend" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md", + "redirect_url": "/dotnet/standard/linq/project-anonymous-type", + "redirect_document_id": false }, { - "source_path": "docs/tutorials/getting-started-with-csharp/microservices.md", - "redirect_url": "/dotnet/core/docker/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-object-graph.md", + "redirect_url": "/dotnet/standard/linq/project-object-graph", + "redirect_document_id": false }, { - "source_path": "docs/tutorials/getting-started-with-csharp/working-with-linq.md", - "redirect_url": "/dotnet/csharp/tutorials/working-with-linq" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md", + "redirect_url": "/dotnet/standard/linq/query-linq-xml-xpath", + "redirect_document_id": false }, { - "source_path": "docs/tutorials/index.md", - "redirect_url": "/dotnet/samples-and-tutorials/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md", + "redirect_url": "/dotnet/standard/linq/read-write-encoded-document", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/customizing-extending-my/customizing-projects-and-extending-my.md", - "redirect_url": "/dotnet/visual-basic/developing-apps/customizing-extending-my/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-collection-attributes", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/debugging.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/debugger/debugger-basics" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-collection-elements", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/adding-printable-reports-to-visual-studio-applications.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/ms233804(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-single-attribute", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/deploying-applications-that-reference-the-printform-component.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882689(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-single-child-element", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-a-form-by-using-the-printform-component.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629268(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md", + "redirect_url": "/dotnet/standard/linq/retrieve-paragraphs-office-open-xml-document", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-a-scrollable-form.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb690944(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md", + "redirect_url": "/dotnet/standard/linq/retrieve-shallow-value-element", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-client-and-non-client-areas-of-a-form.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629243(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-value-attribute", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/how-to-print-the-client-area-of-a-form.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb629256(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/retrieve-value-element", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/index.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882691(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md", + "redirect_url": "/dotnet/standard/linq/serialize-datacontractserializer", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/printform-component.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb690938(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md", + "redirect_url": "/dotnet/standard/linq/serialize-xmlserializer", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/printing/printing-and-reporting.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2010/bb882691(v=vs.100)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md", + "redirect_url": "/dotnet/standard/linq/sort-elements-multiple-keys", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/programming/app-settings/accessing-application-settings.md", - "redirect_url": "/dotnet/visual-basic/developing-apps/programming/app-settings/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements.md", + "redirect_url": "/dotnet/standard/linq/sort-elements", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/programming/computer-resources/computer-resources.md", - "redirect_url": "/dotnet/visual-basic/developing-apps/programming/computer-resources/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md", + "redirect_url": "/dotnet/standard/linq/stream-xml-fragments-xmlreader", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/programming/drives-directories-files/processing.md", - "redirect_url": "/dotnet/visual-basic/developing-apps/programming/drives-directories-files/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md", + "redirect_url": "/dotnet/standard/linq/stream-xml-fragments-access-header-information", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/help-for-event-handlers.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/using-intellisense" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/transform-shape-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/how-to-compile-and-run-a-project.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/compiling-and-building-in-visual-studio" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md", + "redirect_url": "/dotnet/standard/linq/use-annotations-transform-linq-xml-trees-xslt-style", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/intellisense-code-snippets.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/code-snippets" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/validate-xsd", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/refactoring-and-rename-dialog-box.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/vb-ide/refactoring-vb" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/work-dictionaries-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/settings.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/reference/general-user-interface-elements-visual-studio" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md", + "redirect_url": "/dotnet/standard/linq/write-linq-xml-axis-method", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/using-ide/using-the-visual-basic-development-environment.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/ide/visual-studio-ide" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md", + "redirect_url": "/dotnet/standard/linq/write-query-finds-elements-based-context", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488279(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md", + "redirect_url": "/dotnet/standard/linq/write-queries-xml-namespaces", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/deploying-applications-that-reference-power-packs-controls-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488314(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md", + "redirect_url": "/dotnet/standard/linq/write-queries-complex-filtering", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-change-the-appearance-of-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488194(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction.md", + "redirect_url": "/dotnet/standard/linq/in-memory-xml-tree-modification-vs-functional-construction", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-change-the-layout-of-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488199(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md", + "redirect_url": "/dotnet/standard/linq/introduction-pure-functional-transformations", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-create-a-master-detail-form-by-using-two-datarepeater-controls.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488313(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/introduction-to-xml-literals.md", + "redirect_url": "/dotnet/standard/linq/xml-literals", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-disable-adding-and-deleting-datarepeater-items-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488185(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/language-integrated-axes.md", + "redirect_url": "/dotnet/standard/linq/language-integrated-axes", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-bound-data-in-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488274(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-annotations.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-annotations", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-item-headers-in-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488200(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-axes-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-display-unbound-controls-in-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488315(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-axes-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-draw-lines-with-the-lineshape-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488281(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-classes-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-draw-shapes-with-the-ovalshape-and-rectangleshape-controls.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488183(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-events.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-events", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-enable-tabbing-between-shapes-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488184(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md", + "redirect_url": "/dotnet/standard/linq/comparison-xpath-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/how-to-search-data-in-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488282(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-overview.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/introduction-to-the-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488280(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/introduction-to-the-line-and-shape-controls-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488275(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-security.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-security", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/line-and-shape-controls-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488190(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-dom.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-vs-dom", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/power-packs-controls.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488277(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-vs-xml-technologies", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/troubleshooting-the-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488312(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/linq-xml-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/virtual-mode-in-the-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488276(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/maintaining-name-value-pairs.md", + "redirect_url": "/dotnet/standard/linq/maintain-name-value-pairs", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/walkthrough-displaying-data-in-a-datarepeater-control-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/cc488278(v=vs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/mixed-declarative-imperative-code-bugs", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/developing-apps/windows-forms/windows-forms-application-basics.md", - "redirect_url": "/dotnet/visual-basic/developing-apps/windows-forms/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/modify-elements-attributes-nodes-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/getting-started/breaking-changes-in-visual-studio-2015.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/porting/porting-migrating-and-upgrading-visual-studio-projects?view=vs-2015" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/in-memory-xml-tree-modification-vs-functional-construction", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/getting-started/breaking-changes-in-visual-studio.md", - "redirect_url": "https://docs.microsoft.com/visualstudio/porting/porting-migrating-and-upgrading-visual-studio-projects?view=vs-2015" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/namespaces-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/namespaces-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/getting-started/whats-new.md", - "redirect_url": "/dotnet/visual-basic/whats-new/" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/namespaces-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/data-types/data-type-summary.md", - "redirect_url": "/dotnet/visual-basic/language-reference/data-types/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/parsing-xml.md", + "redirect_url": "/dotnet/standard/linq/parse-string", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/directives/directives.md", - "redirect_url": "/dotnet/visual-basic/language-reference/directives/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/performance-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/performance-chained-queries", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/a-reference-was-created-to-embedded-interop-assembly-assembly1.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc40059" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/performance-chained-queries", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/access-of-shared-member-through-an-instance-qualifying-expression.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc42025" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/pre-atomization-xname-objects", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/addressof-operand-must-be-the-name-of-a-method-without-parentheses.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30577" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml.md", + "redirect_url": "/dotnet/standard/linq/preserve-white-space-loading-parsing-xml", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/anonymous-type-member-name-can-be-inferred-only-from-a-simple-or-qualified-name.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc36556" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-serializing.md", + "redirect_url": "/dotnet/standard/linq/preserve-white-space-serializing", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/array-bounds-cannot-appear-in-type-specifiers.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30638" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/programming-guide-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/functional-vs-procedural-programming", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/array-declared-as-for-loop-control-variable-cannot-be-declared.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc32039" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/programming-with-nodes.md", + "redirect_url": "/dotnet/standard/linq/program-nodes", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/array-subscript-expression-missing.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30306" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md", + "redirect_url": "/dotnet/standard/linq/project-xml-different-shape", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/arrays-declared-as-structure-members-cannot-be-declared-with-an-initial-size.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc31043" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/work-dictionaries-linq-xml", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/as-any-is-not-supported-in-declare-statements.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30828" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md", + "redirect_url": "/dotnet/standard/linq/introduction-pure-functional-transformations", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/because-this-call-is-not-awaited-the-current-method-continues-to-run.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc42358" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md", + "redirect_url": "/dotnet/standard/linq/query-xdocument-vs-query-xelement", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/can-t-open-filename-for-writing.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc2012" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/querying-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/query-xml-trees-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/cannot-convert-anonymous-type-to-expression-tree.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc36548" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/refactoring-into-pure-functions.md", + "redirect_url": "/dotnet/standard/linq/refactor-pure-functions", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/cannot-refer-to-an-instance-member-of-a-class.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30369" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/refactoring-using-a-pure-function.md", + "redirect_url": "/dotnet/standard/linq/refactor-pure-function", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/cannot-refer-to-name-because-it-is-member-of-value-typed-field-name-of-class.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc30310" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/refactoring-using-an-extension-method.md", + "redirect_url": "/dotnet/standard/linq/refactor-extension-method", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/error-messages/class-classname-cannot-be-found.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/bc31098" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/reference-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/reference", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/queries/queries.md", - "redirect_url": "/dotnet/visual-basic/language-reference/queries/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/remove-elements-attributes-nodes-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/xml-axis/xml-axis-properties.md", - "redirect_url": "/dotnet/visual-basic/language-reference/xml-axis/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md", + "redirect_url": "/dotnet/standard/linq/retrieve-paragraphs-styles", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/language-reference/xmldoc/recommended-xml-tags-for-documentation-comments.md", - "redirect_url": "/dotnet/visual-basic/language-reference/xmldoc/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md", + "redirect_url": "/dotnet/standard/linq/retrieve-text-paragraphs", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/a-class-used-in-the-expression-is-not-loaded-during-debugging-session.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/attribute-structlayout-can-not-be-applied-to-a-generic-type.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-books", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc2029.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-consolidated-purchase-orders", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc2031.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-customers-orders-namespace", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc2035.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-customers-orders", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30963.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-multiple-purchase-orders-namespace", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30964.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-multiple-purchase-orders", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30965.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-numerical-data-namespace", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30966.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-numerical-data", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30972.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-test-configuration-namespace", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc30973.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-test-configuration", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc35000.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order-namespace", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc35001.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/sample-xml-file-typical-purchase-order", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc35002.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders.md", + "redirect_url": "/dotnet/standard/linq/sample-xsd-file-customers-orders", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/bc42327.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/scope-of-default-namespaces.md", + "redirect_url": "/dotnet/standard/linq/scope-default-namespaces", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/comment-statements-cannot-be-evaluated.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/serializing-object-graphs-that-contain-xelement-objects.md", + "redirect_url": "/dotnet/standard/linq/serialize-xmlserializer", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/for-loop-control-variable-already-in-use-by-an-enclosing-for-loop.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md", + "redirect_url": "/dotnet/standard/linq/serialize-xmlreader-invoke-xslt", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/misc/next-control-variable-does-not-match-for-loop-control-variable.md", - "redirect_url": "/dotnet/visual-basic/language-reference/error-messages/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md", + "redirect_url": "/dotnet/standard/linq/serialize-files-textwriters-xmlwriters", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/friend-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/friend" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md", + "redirect_url": "/dotnet/standard/linq/serialize-xml-declaration", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-and-use-assemblies-using-the-command-line.md", - "redirect_url": "/dotnet/standard/assembly/index" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/serializing-xml-trees.md", + "redirect_url": "/dotnet/standard/linq/preserve-white-space-serializing", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-signed-friend-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/create-signed-friend" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md", + "redirect_url": "/dotnet/standard/linq/xml-shape-wordprocessingml-documents", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-create-unsigned-friend-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/create-unsigned-friend" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/statically-compiled-queries", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-determine-if-a-file-is-an-assembly.md", - "redirect_url": "/dotnet/standard/assembly/identify" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md", + "redirect_url": "/dotnet/standard/linq/style-part-wordprocessingml-document", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-load-and-unload-assemblies.md", - "redirect_url": "/dotnet/standard/assembly/load-unload" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md", + "redirect_url": "/dotnet/standard/linq/xml-shape-wordprocessingml-documents", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/how-to-share-an-assembly-with-other-applications.md", - "redirect_url": "/dotnet/framework/app-domains/how-to-share-an-assembly-with-other-applications" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md", + "redirect_url": "/dotnet/standard/linq/use-xslt-transform-xml-tree", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/index.md", - "redirect_url": "/dotnet/standard/assembly" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects.md", + "redirect_url": "/dotnet/standard/linq/valid-content-xelement-xdocument-objects", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/walkthrough-embedding-type-information-from-microsoft-office-assemblies-in-vs.md", - "redirect_url": "https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2013/ee317478(v%3dvs.120)" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md", + "redirect_url": "/dotnet/standard/linq/wordprocessingml-document-styles", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/assemblies-gac/walkthrough-embedding-types-from-managed-assemblies-in-vs.md", - "redirect_url": "/dotnet/standard/assembly/embed-types-visual-studio" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/working-with-global-namespaces-linq-to-xml.md", + "redirect_url": "/dotnet/standard/linq/work-global-namespaces", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/covariance-contravariance/covariance-and-contravariance.md", - "redirect_url": "/dotnet/visual-basic/programming-guide/concepts/covariance-contravariance/index", - "redirect_document_id": true + "source_path": "docs/visual-basic/programming-guide/concepts/linq/working-with-xml-namespaces.md", + "redirect_url": "/dotnet/standard/linq/namespaces-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md", - "redirect_url": "/dotnet/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/xattribute-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xattribute-class-overview", + "redirect_document_id": false }, { - "source_path": "docs/visual-basic/programming-guide/concepts/linq/namespaces-linq-to-xml.md", - "redirect_url": "/dotnet/visual-basic/programming-guide/concepts/linq/namespaces-overview-linq-to-xml" + "source_path": "docs/visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xdocument-class-overview", + "redirect_document_id": false + }, + { + "source_path": "docs/visual-basic/programming-guide/concepts/linq/xelement-class-overview.md", + "redirect_url": "/dotnet/standard/linq/xelement-class-overview", + "redirect_document_id": false }, { "source_path": "docs/visual-basic/programming-guide/concepts/threading/how-to-use-a-thread-pool.md", @@ -11113,4 +12684,4 @@ "redirect_url": "https://docs.microsoft.com/samples/browse/?languages=vb" } ] -} +} \ No newline at end of file diff --git a/docs/breadcrumb/toc.yml b/docs/breadcrumb/toc.yml index c53f36aef32a9..52cf50378651a 100644 --- a/docs/breadcrumb/toc.yml +++ b/docs/breadcrumb/toc.yml @@ -76,6 +76,9 @@ items: - name: Globalization and localization tocHref: /dotnet/standard/globalization-localization/ topicHref: /dotnet/standard/globalization-localization/index + - name: LINQ + tocHref: /dotnet/standard/linq/ + topicHref: /dotnet/standard/linq/index - name: Security in .NET tocHref: /dotnet/standard/security/ topicHref: /dotnet/standard/security/index @@ -596,4 +599,4 @@ items: items: - name: Azure for .NET developers tocHref: /dotnet/azure/ - topicHref: /dotnet/azure/index + topicHref: /dotnet/azure/index \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md b/docs/csharp/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md deleted file mode 100644 index f03bd5364aae2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "Adding Elements, Attributes, and Nodes to an XML Tree (C#)" -description: Learn about methods to add content like elements, attributes, comments, processing instructions, and text to an existing XML tree. -ms.date: 07/20/2015 -ms.assetid: db911e4f-40aa-499a-9500-a9763bb6df56 ---- -# Adding Elements, Attributes, and Nodes to an XML Tree (C#) -You can add content (elements, attributes, comments, processing instructions, text, and CDATA) to an existing XML tree. - -## Methods for Adding Content - The following methods add child content to an or an : - -|Method|Description| -|------------|-----------------| -||Adds content at the end of the child content of the .| -||Adds content at the beginning of the child content of the .| - - The following methods add content as sibling nodes of an . The most common node to which you add sibling content is , although you can add valid sibling content to other types of nodes such as or . - -|Method|Description| -|------------|-----------------| -||Adds content after the .| -||Adds content before the .| - -## Example - -### Description - The following example creates two XML trees, and then modifies one of the trees. - -### Code - -```csharp -XElement srcTree = new XElement("Root", - new XElement("Element1", 1), - new XElement("Element2", 2), - new XElement("Element3", 3), - new XElement("Element4", 4), - new XElement("Element5", 5) -); -XElement xmlTree = new XElement("Root", - new XElement("Child1", 1), - new XElement("Child2", 2), - new XElement("Child3", 3), - new XElement("Child4", 4), - new XElement("Child5", 5) -); -xmlTree.Add(new XElement("NewChild", "new content")); -xmlTree.Add( - from el in srcTree.Elements() - where (int)el > 3 - select el -); -// Even though Child9 does not exist in srcTree, the following statement will not -// throw an exception, and nothing will be added to xmlTree. -xmlTree.Add(srcTree.Element("Child9")); -Console.WriteLine(xmlTree); -``` - -### Comments - This code produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - new content - 4 - 5 - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/applicability-of-functional-transformation.md b/docs/csharp/programming-guide/concepts/linq/applicability-of-functional-transformation.md deleted file mode 100644 index 9ae3653025b31..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/applicability-of-functional-transformation.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Applicability of Functional Transformation (C#)" -desciption: Learn about functional transformation. See how this approach to LINQ and other processes where the focus is on transforming data from one form to another. -ms.date: 07/20/2015 -ms.assetid: c78107bd-b006-4574-a3d4-bbf808388ff3 ---- -# Applicability of Functional Transformation (C#) -Pure functional transformations are applicable in a wide variety of situations. - - The functional transformation approach is ideally suited for querying and manipulating structured data; therefore it fits well with LINQ technologies. However, functional transformation has a much wider applicability than use with LINQ. Any process where the main focus is on transforming data from one form to another should probably be considered as a candidate for functional transformation. - - This approach is applicable to many problems that might not appear at first glance to be a candidate. Used in conjunction with or separately from LINQ, functional transformation should be considered for the following areas: - -- XML-based documents. Well-formed data of any XML dialect can be easily manipulated through functional transformation. For more information, see [Functional Transformation of XML (C#)](./functional-transformation-of-xml.md). - -- Other structured file formats. From Windows.ini files to plain text documents, most files have some structure that lends itself to analysis and transformation. - -- Data streaming protocols. Encoding data into and decoding data from communication protocols can often be represented by a simple functional transform. - -- RDBMS and OODBMS data. Relational and object-oriented databases, just like XML, are widely-used structured data sources. - -- Mathematic, statistic, and science solutions. These fields tend to manipulate large data sets to assist the user in visualizing, estimating, or actually solving non-trivial problems. - - As described in [Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md), using pure functions is an example of functional programming. In additional to their immediate benefits, using pure functions provides valuable experience in thinking about problems from a functional transformation perspective. This approach can also have major impact on program and class design. This is especially true when a problem lends itself to a data transformation solution as described above. - - Although they are beyond the scope of this tutorial, designs that are influenced by the functional transformation perspective tend to center on processes more than on objects as actors, and the resulting solution tends to be implemented as series of large-scale transformations, rather than individual object state changes. - - Again, remember that C# supports both imperative and functional approaches, so the best design for your application might incorporate elements of both. - -## See also - -- [Introduction to Pure Functional Transformations (C#)](./introduction-to-pure-functional-transformations.md) -- [Functional Transformation of XML (C#)](./functional-transformation-of-xml.md) -- [Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md) diff --git a/docs/csharp/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md deleted file mode 100644 index bdcecb7934d7a..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: "Atomized XName and XNamespace Objects (LINQ to XML) (C#)" -description: Learn about atomized XName and XNamespace objects and how they provide performance benefits for queries. -ms.date: 07/20/2015 -ms.assetid: a5b21433-b49d-415c-b00e-bcbfb0d267d7 ---- -# Atomized XName and XNamespace Objects (LINQ to XML) (C#) - and objects are *atomized*; that is, if they contain the same qualified name, they refer to the same object. This yields performance benefits for queries: When you compare two atomized names for equality, the underlying intermediate language only has to determine whether the two references point to the same object. The underlying code does not have to do string comparisons, which would be time consuming. - -## Atomization Semantics - Atomization means that if two objects have the same local name, and they are in the same namespace, they share the same instance. In the same way, if two objects have the same namespace URI, they share the same instance. - - For a class to enable atomized objects, the constructor for the class must be private, not public. This is because if the constructor were public, you could create a non-atomized object. The and classes implement an implicit conversion operator to convert a string into an or . This is how you get an instance of these objects. You cannot get an instance by using a constructor, because the constructor is inaccessible. - - and also implement the equality and inequality operators, to determine whether the two objects being compared are references to the same instance. - -## Example - The following code creates some objects and demonstrates that identical names share the same instance. - -```csharp -XElement r1 = new XElement("Root", "data1"); -XElement r2 = XElement.Parse("data2"); - -if ((object)r1.Name == (object)r2.Name) - Console.WriteLine("r1 and r2 have names that refer to the same instance."); -else - Console.WriteLine("Different"); - -XName n = "Root"; - -if ((object)n == (object)r1.Name) - Console.WriteLine("The name of r1 and the name in 'n' refer to the same instance."); -else - Console.WriteLine("Different"); -``` - - This example produces the following output: - -```output -r1 and r2 have names that refer to the same instance. -The name of r1 and the name in 'n' refer to the same instance. -``` - - As mentioned earlier, the benefit of atomized objects is that when you use one of the axis methods that take an as a parameter, the axis method only has to determine that two names reference the same instance to select the desired elements. - - The following example passes an to the method call, which then has better performance because of the atomization pattern. - -```csharp -XElement root = new XElement("Root", - new XElement("C1", 1), - new XElement("Z1", - new XElement("C1", 2), - new XElement("C1", 1) - ) -); - -var query = from e in root.Descendants("C1") - where (int)e == 1 - select e; - -foreach (var z in query) - Console.WriteLine(z); -``` - - This example produces the following output: - -```xml -1 -1 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/chaining-queries-example.md b/docs/csharp/programming-guide/concepts/linq/chaining-queries-example.md deleted file mode 100644 index e569d768e88f4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/chaining-queries-example.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "Chaining Queries Example (C#)" -description: This example shows what happens when you chain together two queries that both use deferred execution and lazy evaluation in C#. -ms.date: 07/20/2015 -ms.assetid: abbca162-d95e-43af-b92c-e46e6aa2540e ---- -# Chaining Queries Example (C#) -This example builds on the previous example and shows what happens when you chain together two queries that both use deferred execution and lazy evaluation. - -## Example - In this example, another extension method is introduced, `AppendString`, which appends a specified string onto every string in the source collection, and then yields the new strings. - -```csharp -public static class LocalExtensions -{ - public static IEnumerable - ConvertCollectionToUpperCase(this IEnumerable source) - { - foreach (string str in source) - { - Console.WriteLine("ToUpper: source >{0}<", str); - yield return str.ToUpper(); - } - } - - public static IEnumerable - AppendString(this IEnumerable source, string stringToAppend) - { - foreach (string str in source) - { - Console.WriteLine("AppendString: source >{0}<", str); - yield return str + stringToAppend; - } - } -} - -class Program -{ - static void Main(string[] args) - { - string[] stringArray = { "abc", "def", "ghi" }; - - IEnumerable q1 = - from s in stringArray.ConvertCollectionToUpperCase() - select s; - - IEnumerable q2 = - from s in q1.AppendString("!!!") - select s; - - foreach (string str in q2) - { - Console.WriteLine("Main: str >{0}<", str); - Console.WriteLine(); - } - } -} -``` - - This example produces the following output: - -```output -ToUpper: source >abc< -AppendString: source >ABC< -Main: str >ABC!!!< - -ToUpper: source >def< -AppendString: source >DEF< -Main: str >DEF!!!< - -ToUpper: source >ghi< -AppendString: source >GHI< -Main: str >GHI!!!< -``` - - In this example, you can see that each extension method operates one at a time for each item in the source collection. - - What should be clear from this example is that even though we have chained together queries that yield collections, no intermediate collections are materialized. Instead, each item is passed from one lazy method to the next. This results in a much smaller memory footprint than an approach that would first take one array of strings, then create a second array of strings that have been converted to uppercase, and finally create a third array of strings where each string has the exclamation points appended to it. - - The next topic in this tutorial illustrates intermediate materialization: - -- [Intermediate Materialization (C#)](./intermediate-materialization.md) - -## See also - -- [Tutorial: Chaining Queries Together (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/chaining-standard-query-operators-together.md b/docs/csharp/programming-guide/concepts/linq/chaining-standard-query-operators-together.md deleted file mode 100644 index 964a5cfd4ce10..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/chaining-standard-query-operators-together.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: "Chaining Standard Query Operators Together (C#)" -description: This example shows how standard query operators can also be chained together in C#. The query does not materialize intermediate results. -ms.date: 07/20/2015 -ms.assetid: 66f2b0a9-2c23-4735-988e-bbc9dfb55c7b ---- -# Chaining Standard Query Operators Together (C#) -This is the final topic in the [Tutorial: Chaining Queries Together (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) tutorial. - - The standard query operators can also be chained together. For example, you can interject the operator, and it also operates in a lazy fashion. No intermediate results are materialized by it. - -## Example - In this example, the method is called before calling `ConvertCollectionToUpperCase`. The method operates in almost exactly the same way as the lazy methods used in previous examples in this tutorial, `ConvertCollectionToUpperCase` and `AppendString`. - - One difference is that in this case, the method iterates through its source collection, determines that the first item does not pass the predicate, and then gets the next item, which does pass. It then yields the second item. - - However, the basic idea is the same: Intermediate collections are not materialized unless they have to be. - - When query expressions are used, they are converted to calls to the standard query operators, and the same principles apply. - - All of the examples in this section that are querying Office Open XML documents use the same principle. Deferred execution and lazy evaluation are some of the fundamental concepts that you must understand to use LINQ (and LINQ to XML) effectively. - -```csharp -public static class LocalExtensions -{ - public static IEnumerable - ConvertCollectionToUpperCase(this IEnumerable source) - { - foreach (string str in source) - { - Console.WriteLine("ToUpper: source >{0}<", str); - yield return str.ToUpper(); - } - } - - public static IEnumerable - AppendString(this IEnumerable source, string stringToAppend) - { - foreach (string str in source) - { - Console.WriteLine("AppendString: source >{0}<", str); - yield return str + stringToAppend; - } - } -} - -class Program -{ - static void Main(string[] args) - { - string[] stringArray = { "abc", "def", "ghi" }; - - IEnumerable q1 = - from s in stringArray.ConvertCollectionToUpperCase() - where s.CompareTo("D") >= 0 - select s; - - IEnumerable q2 = - from s in q1.AppendString("!!!") - select s; - - foreach (string str in q2) - { - Console.WriteLine("Main: str >{0}<", str); - Console.WriteLine(); - } - } -} -``` - - This example produces the following output: - -```output -ToUpper: source >abc< -ToUpper: source >def< -AppendString: source >DEF< -Main: str >DEF!!!< - -ToUpper: source >ghi< -AppendString: source >GHI< -Main: str >GHI!!!< -``` diff --git a/docs/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md deleted file mode 100644 index f761e664ad321..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: "Comparison of XPath and LINQ to XML" -description: Learn about the similarities and differences in functionality between XPath and LINQ to XML in C#. You can use both to query an XML tree. -ms.date: 07/20/2015 -dev_langs: - - "csharp" - - "vb" -ms.assetid: 87d361b1-daa9-4fd4-a53a-cbfa40111ad3 ---- -# Comparison of XPath and LINQ to XML -XPath and LINQ to XML offer some similar functionality. Both can be used to query an XML tree, returning such results as a collection of elements, a collection of attributes, a collection of nodes, or the value of an element or attribute. However, there are also some differences. - -## Differences Between XPath and LINQ to XML - XPath does not allow projection of new types. It can only return collections of nodes from the tree, whereas LINQ to XML can execute a query and project an object graph or an XML tree in a new shape. LINQ to XML queries encompass much more functionality and are much more powerful than XPath expressions. - - XPath expressions exist in isolation within a string. The C# compiler cannot help parse the XPath expression at compile time. By contrast, LINQ to XML queries are parsed and compiled by the C# compiler. The compiler is able to catch many query errors. - - XPath results are not strongly typed. In a number of circumstances, the result of evaluating an XPath expression is an object, and it is up to the developer to determine the proper type and cast the result as necessary. By contrast, the projections from a LINQ to XML query are strongly typed. - -## Result Ordering - The XPath 1.0 Recommendation states that a collection that is the result of evaluating an XPath expression is unordered. - - However, when iterating through a collection returned by a LINQ to XML XPath axis method, the nodes in the collection are returned in document order. This is the case even when accessing the XPath axes where predicates are expressed in terms of reverse document order, such as `preceding` and `preceding-sibling`. - - By contrast, most of the LINQ to XML axes return collections in document order, but two of them, and , return collections in reverse document order. The following table enumerates the axes, and indicates collection order for each: - -|LINQ to XML axis|Ordering| -|----------------------|--------------| -|XContainer.DescendantNodes|Document order| -|XContainer.Descendants|Document order| -|XContainer.Elements|Document order| -|XContainer.Nodes|Document order| -|XContainer.NodesAfterSelf|Document order| -|XContainer.NodesBeforeSelf|Document order| -|XElement.AncestorsAndSelf|Reverse document order| -|XElement.Attributes|Document order| -|XElement.DescendantNodesAndSelf|Document order| -|XElement.DescendantsAndSelf|Document order| -|XNode.Ancestors|Reverse document order| -|XNode.ElementsAfterSelf|Document order| -|XNode.ElementsBeforeSelf|Document order| -|XNode.NodesAfterSelf|Document order| -|XNode.NodesBeforeSelf|Document order| - -## Positional Predicates - Within an XPath expression, positional predicates are expressed in terms of document order for many axes, but are expressed in reverse document order for reverse axes, which are `preceding`, `preceding-sibling`, `ancestor`, and `ancestor-or-self`. For example, the XPath expression `preceding-sibling::*[1]` returns the immediately preceding sibling. This is the case even though the final result set is presented in document order. - - By contrast, all positional predicates in LINQ to XML are always expressed in terms of the order of the axis. For example, `anElement.ElementsBeforeSelf().ElementAt(0)` returns the first child element of the parent of the queried element, not the immediate preceding sibling. Another example: `anElement.Ancestors().ElementAt(0)` returns the parent element. - - If you wanted to find the immediately preceding element in LINQ to XML, you would write the following expression: - -```csharp -ElementsBeforeSelf().Last() -``` - -```vb -ElementsBeforeSelf().Last() -``` - -## Performance Differences - XPath queries that use the XPath functionality in LINQ to XML will not perform as well as LINQ to XML queries. - -## Comparison of Composition - Composition of a LINQ to XML query is somewhat parallel to composition of an XPath expression, although very different in syntax. - - For example, if you have an element in a variable named `customers`, and you want to find a grandchild element named `CompanyName` under all child elements named `Customer`, you would write an XPath expression as follows: - -```csharp -customers.XPathSelectElements("./Customer/CompanyName") -``` - -```vb -customers.XPathSelectElements("./Customer/CompanyName") -``` - - The equivalent LINQ to XML query is: - -```csharp -customers.Elements("Customer").Elements("CompanyName") -``` - -```vb -customers.Elements("Customer").Elements("CompanyName") -``` - - There are similar parallels for each of the XPath axes. - -|XPath axis|LINQ to XML axis| -|----------------|----------------------| -|child (the default axis)|| -|Parent (..)|| -|attribute axis (@)|

or

| -|ancestor axis|| -|ancestor-or-self axis|| -|descendant axis (//)|

or

| -|descendant-or-self|

or

| -|following-sibling|

or

| -|preceding-sibling|

or

| -|following|No direct equivalent.| -|preceding|No direct equivalent.| - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md b/docs/csharp/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md deleted file mode 100644 index 3ee0f73e759f6..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: "Concepts and Terminology (Functional Transformation) (C#)" -description: Functional programming capabilities make it easier to transform XML. Learn about concepts and terminology of pure functional transformations in C#. -ms.date: 07/20/2015 -ms.assetid: 03defb3a-7e17-4ab1-8efa-4dd66621e860 ---- -# Concepts and Terminology (Functional Transformation) (C#) - -This topic introduces the concepts and terminology of pure functional transformations. The functional transformation approach to transforming data yields code that is often quicker to program, more expressive, and easier to debug and maintain than more traditional, imperative programming. - -Note that the topics in this section are not intended to fully explain functional programming. Instead, these topics identify some of the functional programming capabilities that make it easier to transform XML from one shape to another. - -## What Is Pure Functional Transformation? - -In *pure functional transformation*, a set of functions, called *pure functions*, define how to transform a set of structured data from its original form into another form. The word "pure" indicates that the functions are *composable*, which requires that they are: - -- *Self-contained*, so that they can be freely ordered and rearranged without entanglement or interdependencies with the rest of the program. Pure transformations have no knowledge of or effect upon their environment. That is, the functions used in the transformation have no *side effects*. - -- *Stateless*, so that executing the same function or specific set of functions on the same input will always result in the same output. Pure transformations have no memory of their prior use. - -> [!IMPORTANT] -> In the rest of this tutorial, the term "pure function" is used in a general sense to indicate a programming approach, and not a specific language feature. -> -> Note that pure functions must be implemented as methods in C#. -> -> Also, you should not confuse pure functions with pure virtual methods in C++. The latter indicates that the containing class is abstract and that no method body is supplied. - -### Functional Programming - -*Functional programming* is a programming approach that directly supports pure functional transformation. - -Historically, general-purpose functional programming languages, such as ML, Scheme, Haskell, and F#, have been primarily of interest to the academic community. Although it has always been possible to write pure functional transformations in C#, the difficulty of doing so has not made it an attractive option to most programmers. In recent versions of C#, however, new language constructs such as lambda expressions and type inference make it functional programming much easier and more productive. - -For more information about functional programming, see [Functional Programming vs. Imperative Programming (C#)](./functional-programming-vs-imperative-programming.md). - -#### Domain-Specific FP Languages - -Although general functional programming languages have not been widely adopted, specific domain-specific functional programming languages have had better success. For example, Cascading Style Sheets (CSS) are used to determine the look and feel of many Web pages, and Extensible Stylesheet Language Transformations (XSLT) style sheets are used extensively in XML data manipulation. For more information about XSLT, see [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md). - -## Terminology - -The following table defines some terms related to functional transformations. - -higher-order (first-class) function \ -A function that can be treated as a programmatic object. For example, a higher-order function can be passed to or returned from other functions. In C#c, delegates and lambda expressions are language features that support higher-order functions. To write a higher-order function, you declare one or more arguments to take delegates, and you often use lambda expressions when calling it. Many of the standard query operators are higher-order functions. - -For more information, see [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md). - -lambda expression \ -Essentially, an inline anonymous function that can be used wherever a delegate type is expected. This is a simplified definition of lambda expressions, but it is adequate for the purposes of this tutorial. - -For more information about, see [Lambda Expressions](../../../language-reference/operators/lambda-expressions.md). - -collection \ -A structured set of data, usually of a uniform type. To be compatible with LINQ, a collection must implement the interface or the interface (or one of their generic counterparts, or ). - -tuple (anonymous types) \ -A mathematical concept, a tuple is a finite sequence of objects, each of a specific type. A tuple is also known as an ordered list. Anonymous types are a language implementation of this concept, which enable an unnamed class type to be declared and an object of that type to be instantiated at the same time. - -For more information, see [Anonymous Types](../../classes-and-structs/anonymous-types.md). - -type inference (implicit typing) \ -The ability of a compiler to determine the type of a variable in the absence of an explicit type declaration. - -For more information, see [Implicitly Typed Local Variables](../../classes-and-structs/implicitly-typed-local-variables.md). - -deferred execution and lazy evaluation \ -The delaying of evaluation of an expression until its resolved value is actually required. Deferred execution is supported in collections. - -For more information, see [Introduction to LINQ Queries (C#)](./introduction-to-linq-queries.md) and [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -These language features will be used in code samples throughout this section. - -## See also - -- [Introduction to Pure Functional Transformations (C#)](./introduction-to-pure-functional-transformations.md) -- [Functional Programming vs. Imperative Programming (C#)](./functional-programming-vs-imperative-programming.md) diff --git a/docs/csharp/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md b/docs/csharp/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md deleted file mode 100644 index 07762825e0279..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Creating the Source Office Open XML Document (C#)" -description: Create an Office Open XML WordprocessingML document to use with C# tutorials. This article requires Microsoft Office. -ms.date: 07/20/2015 -ms.assetid: 653c8cdb-73be-4dc2-927f-924cfb4ed9ed ---- -# Creating the Source Office Open XML Document (C#) - -This topic shows how to create the Office Open XML WordprocessingML document that the other examples in this tutorial use. If you follow these instructions, your output will match the output provided in each example. - -However, the examples in this tutorial will work with any valid WordprocessingML document. - -To create the document that this tutorial uses, you must either have Microsoft Office 2007 or later installed, or you must have Microsoft Office 2003 with the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. - -## Creating the WordprocessingML Document - -#### To create the WordprocessingML document - -1. Create a new Microsoft Word document. - -2. Paste the following text into the new document: - - ```text - Parsing WordprocessingML with LINQ to XML - - The following example prints to the console. - - using System; - - class Program { - public static void Main(string[] args) { - Console.WriteLine("Hello World"); - } - } - - This example produces the following output: - - Hello World - ``` - -3. Format the first line with the style "Heading 1". - -4. Select the lines that contain the C# code. The first line starts with the `using` keyword. The last line is the last closing brace. Format the lines with the courier font. Format them with a new style, and name the new style "Code". - -5. Finally, select the entire line that contains the output, and format it with the `Code` style. - -6. Save the document, and name it SampleDoc.docx. - - > [!NOTE] - > If you are using Microsoft Word 2003, select **Word 2007 Document** in the **Save as Type** drop-down list. diff --git a/docs/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2.md b/docs/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2.md deleted file mode 100644 index 4a761a693808b..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -title: "Creating XML Trees in C# (LINQ to XML)" -description: Learn about creating XML trees in C#, including constructing elements and using XElement constructors. -ms.date: 08/31/2018 -ms.assetid: cc74234a-0bac-4327-9c8c-5a2ead15b595 ---- -# Creating XML trees in C# (LINQ to XML) -This section provides information about creating XML trees in C#. - - For information about using the results of LINQ queries as the content for an , see [Functional Construction (LINQ to XML) (C#)](./functional-construction-linq-to-xml.md). - -## Constructing elements - The signatures of the and constructors let you pass the contents of the element or attribute as arguments to the constructor. Because one of the constructors takes a variable number of arguments, you can pass any number of child elements. Of course, each of those child elements can contain their own child elements. For any element, you can add any number of attributes. - - When adding (including ) or objects, if the new content has no parent, the objects are simply attached to the XML tree. If the new content already is parented, and is part of another XML tree, the new content is cloned, and the newly cloned content is attached to the XML tree. The last example in this topic demonstrates this. - - To create a `contacts`, you could use the following code: - -```csharp -XElement contacts = - new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144"), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) - ); -``` - - If indented properly, the code to construct objects closely resembles the structure of the underlying XML. - -## XElement constructors - The class uses the following constructors for functional construction. Note that there are some other constructors for , but because they are not used for functional construction they are not listed here. - -|Constructor|Description| -|-----------------|-----------------| -|`XElement(XName name, object content)`|Creates an . The `name` parameter specifies the name of the element; `content` specifies the content of the element.| -|`XElement(XName name)`|Creates an with its initialized to the specified name.| -|`XElement(XName name, params object[] content)`|Creates an with its initialized to the specified name. The attributes and/or child elements are created from the contents of the parameter list.| - - The `content` parameter is extremely flexible. It supports any type of object that is a valid child of an . The following rules apply to different types of objects passed in this parameter: - -- A string is added as text content. - -- An is added as a child element. - -- An is added as an attribute. - -- An , , or is added as child content. - -- An is enumerated, and these rules are applied recursively to the results. - -- For any other type, its `ToString` method is called and the result is added as text content. - -### Creating an XElement with content - You can create an that contains simple content with a single method call. To do this, specify the content as the second parameter, as follows: - -```csharp -XElement n = new XElement("Customer", "Adventure Works"); -Console.WriteLine(n); -``` - - This example produces the following output: - -```xml -Adventure Works -``` - - You can pass any type of object as the content. For example, the following code creates an element that contains a floating point number as content: - -```csharp -XElement n = new XElement("Cost", 324.50); -Console.WriteLine(n); -``` - - This example produces the following output: - -```xml -324.5 -``` - - The floating point number is boxed and passed in to the constructor. The boxed number is converted to a string and used as the content of the element. - -### Creating an XElement with a child element - If you pass an instance of the class for the content argument, the constructor creates an element with a child element: - -```csharp -XElement shippingUnit = new XElement("ShippingUnit", - new XElement("Cost", 324.50) -); -Console.WriteLine(shippingUnit); -``` - - This example produces the following output: - -```xml - - 324.5 - -``` - -### Creating an XElement with multiple child elements - You can pass in a number of objects for the content. Each of the objects is included as a child element. - -```csharp -XElement address = new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") -); -Console.WriteLine(address); -``` - - This example produces the following output: - -```xml -
- 123 Main St - Mercer Island - WA - 68042 -
-``` - - By extending the above example, you can create an entire XML tree, as follows: - -```csharp -XElement contacts = - new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144"), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) - ); -Console.WriteLine(contacts); -``` - - This example produces the following output: - -```xml - - - Patrick Hines - 206-555-0144 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` - -### Creating an XElement with an XAttribute - If you pass an instance of the class for the content argument, the constructor creates an element with an attribute: - -```csharp -XElement phone = new XElement("Phone", - new XAttribute("Type", "Home"), - "555-555-5555"); -Console.WriteLine(phone); -``` - - This example produces the following output: - -```xml -555-555-5555 -``` - -### Creating an empty element - To create an empty , you do not pass any content to the constructor. The following example creates an empty element: - -```csharp -XElement n = new XElement("Customer"); -Console.WriteLine(n); -``` - - This example produces the following output: - -```xml - -``` - -### Attaching vs. cloning - As mentioned previously, when adding (including ) or objects, if the new content has no parent, the objects are simply attached to the XML tree. If the new content already is parented and is part of another XML tree, the new content is cloned, and the newly cloned content is attached to the XML tree. - -The following example demonstrates the behavior when you add a parented element to a tree, and when you add an element with no parent to a tree. - -```csharp -// Create a tree with a child element. -XElement xmlTree1 = new XElement("Root", - new XElement("Child1", 1) -); - -// Create an element that is not parented. -XElement child2 = new XElement("Child2", 2); - -// Create a tree and add Child1 and Child2 to it. -XElement xmlTree2 = new XElement("Root", - xmlTree1.Element("Child1"), - child2 -); - -// Compare Child1 identity. -Console.WriteLine("Child1 was {0}", - xmlTree1.Element("Child1") == xmlTree2.Element("Child1") ? - "attached" : "cloned"); - -// Compare Child2 identity. -Console.WriteLine("Child2 was {0}", - child2 == xmlTree2.Element("Child2") ? - "attached" : "cloned"); - -// The example displays the following output: -// Child1 was cloned -// Child2 was attached -``` - -## See also - -- [Creating XML Trees (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md deleted file mode 100644 index 90f3120b03c6e..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Deferred Execution and Lazy Evaluation in LINQ to XML (C#)" -description: Query and axis operations can use deferred execution in C#. Learn about requirements and advantages of deferred execution and implementation considerations. -ms.date: 07/20/2015 -ms.assetid: 8683d1b4-b7ec-407b-be12-906ebe958a09 ---- -# Deferred Execution and Lazy Evaluation in LINQ to XML (C#) -Query and axis operations are often implemented to use deferred execution. This topic explains the requirements and advantages of deferred execution, and some implementation considerations. - -## Deferred Execution - Deferred execution means that the evaluation of an expression is delayed until its *realized* value is actually required. Deferred execution can greatly improve performance when you have to manipulate large data collections, especially in programs that contain a series of chained queries or manipulations. In the best case, deferred execution enables only a single iteration through the source collection. - - The LINQ technologies make extensive use of deferred execution in both the members of core classes and in the extension methods in the various LINQ namespaces, such as . - - Deferred execution is supported directly in the C# language by the [yield](../../../language-reference/keywords/yield.md) keyword (in the form of the `yield-return` statement) when used within an iterator block. Such an iterator must return a collection of type or (or a derived type). - -## Eager vs. Lazy Evaluation - When you write a method that implements deferred execution, you also have to decide whether to implement the method using lazy evaluation or eager evaluation. - -- In *lazy evaluation*, a single element of the source collection is processed during each call to the iterator. This is the typical way in which iterators are implemented. - -- In *eager evaluation*, the first call to the iterator will result in the entire collection being processed. A temporary copy of the source collection might also be required. For example, the method has to sort the entire collection before it returns the first element. - - Lazy evaluation usually yields better performance because it distributes overhead processing evenly throughout the evaluation of the collection and minimizes the use of temporary data. Of course, for some operations, there is no other option than to materialize intermediate results. - -## Next Steps - The next topic in this tutorial illustrates deferred execution: - -- [Deferred Execution Example (C#)](./deferred-execution-example.md) - -## See also - -- [Tutorial: Chaining Queries Together (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) -- [Concepts and Terminology (Functional Transformation) (C#)](./concepts-and-terminology-functional-transformation.md) -- [Aggregation Operations (C#)](./aggregation-operations.md) -- [yield](../../../language-reference/keywords/yield.md) diff --git a/docs/csharp/programming-guide/concepts/linq/deferred-execution-example.md b/docs/csharp/programming-guide/concepts/linq/deferred-execution-example.md deleted file mode 100644 index 2404e23366ef3..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/deferred-execution-example.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: "Deferred Execution Example (C#)" -description: See how deferred execution and lazy evaluation affect the execution of your LINQ to XML queries in C#. -ms.date: 07/20/2015 -ms.assetid: 50f4fbac-81fe-4f26-aedf-506e21419b19 ---- -# Deferred Execution Example (C#) -This topic shows how deferred execution and lazy evaluation affect the execution of your LINQ to XML queries. - -## Example - The following example shows the order of execution when using an extension method that uses deferred execution. The example declares an array of three strings. It then iterates through the collection returned by `ConvertCollectionToUpperCase`. - -```csharp -public static class LocalExtensions -{ - public static IEnumerable - ConvertCollectionToUpperCase(this IEnumerable source) - { - foreach (string str in source) - { - Console.WriteLine("ToUpper: source {0}", str); - yield return str.ToUpper(); - } - } -} - -class Program -{ - static void Main(string[] args) - { - string[] stringArray = { "abc", "def", "ghi" }; - - var q = from str in stringArray.ConvertCollectionToUpperCase() - select str; - - foreach (string str in q) - Console.WriteLine("Main: str {0}", str); - } -} -``` - - This example produces the following output: - -```output -ToUpper: source abc -Main: str ABC -ToUpper: source def -Main: str DEF -ToUpper: source ghi -Main: str GHI -``` - - Notice that when iterating through the collection returned by `ConvertCollectionToUpperCase`, each item is retrieved from the source string array and converted to uppercase before the next item is retrieved from the source string array. - - You can see that the entire array of strings is not converted to uppercase before each item in the returned collection is processed in the `foreach` loop in `Main`. - - The next topic in this tutorial illustrates chaining queries together: - -- [Chaining Queries Example (C#)](./chaining-queries-example.md) - -## See also - -- [Tutorial: Chaining Queries Together (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md b/docs/csharp/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md deleted file mode 100644 index 777cbaaadee9a..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: "Example that Outputs Office Open XML Document Parts (C#)" -description: Learn how to open an Office Open XML document and access parts of it with LINQ in C#. This example prints the document part and the style part of a document. -ms.date: 07/20/2015 -ms.assetid: 6cd37055-89b4-42e8-bf27-5a29717e35f3 ---- -# Example that Outputs Office Open XML Document Parts (C#) -This topic shows how to open an Office Open XML document and access parts within it. - -## Example - The following example opens an Office Open XML document, and prints the document part and the style part to the console. - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```csharp -const string fileName = "SampleDoc.docx"; - -const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; -const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; -const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; -XNamespace w = wordmlNamespace; - -using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) -{ - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - XDocument xdoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - Console.WriteLine("TargetUri:{0}", docPackageRelationship.TargetUri); - Console.WriteLine("=================================================================="); - Console.WriteLine(xdoc.Root); - Console.WriteLine(); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - XDocument styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - - Console.WriteLine("TargetUri:{0}", styleRelation.TargetUri); - Console.WriteLine("=================================================================="); - Console.WriteLine(styleDoc.Root); - Console.WriteLine(); - } - } -} -``` diff --git a/docs/csharp/programming-guide/concepts/linq/finding-text-in-word-documents.md b/docs/csharp/programming-guide/concepts/linq/finding-text-in-word-documents.md deleted file mode 100644 index 1ffb60ef41131..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/finding-text-in-word-documents.md +++ /dev/null @@ -1,329 +0,0 @@ ---- -title: "Finding Text in Word Documents (C#)" -description: Learn how to process a WordprocessingML document with LINQ in C#. This example finds all occurrences of a string in the document. -ms.date: 07/20/2015 -ms.assetid: 82f86677-560b-49dc-a089-610409939b2a ---- -# Finding Text in Word Documents (C#) -This topic extends the previous queries to do something useful: find all occurrences of a string in the document. - -## Example - This example processes a WordprocessingML document, to find all the occurrences of a specific piece of text in the document. To do this, we use a query that finds the string "Hello". This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = ParagraphText(para.ParagraphNode) - }; - - // Following is the new query that retrieves all paragraphs - // that have specific text in them. - var helloParagraphs = - from para in paraWithText - where para.Text.Contains("Hello") - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = para.Text - }; - - foreach (var p in helloParagraphs) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); - } -} -``` - - This example produces the following output: - -```output -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code >Hello World< -``` - - You can, of course, modify the search so that it searches for lines with a specific style. The following query finds all blank lines that have the Code style: - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = ParagraphText(para.ParagraphNode) - }; - - // Retrieve all paragraphs that have no text and are styled Code. - var blankCodeParagraphs = - from para in paraWithText - where para.Text == "" && para.StyleName == "Code" - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = para.Text - }; - - foreach (var p in blankCodeParagraphs) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); - } -} -``` - - This example produces the following output: - -```output -StyleName:Code >< -``` - - Of course, this example could be enhanced in a number of ways. For example, we could use regular expressions to search for text, we could iterate through all the Word files in a particular directory, and so on. - - Note that this example performs approximately as well as if it were written as a single query. Because each query is implemented in a lazy, deferred fashion, each query does not yield its results until the query is iterated. For more information about execution and lazy evaluation, see [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -## Next Steps - The next section provides more information about WordprocessingML documents: - -- [Details of Office Open XML WordprocessingML Documents (C#)](./wordprocessingml-document-with-styles.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) -- [Refactoring Using a Pure Function (C#)](./refactoring-using-a-pure-function.md) -- [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/finding-the-default-paragraph-style.md b/docs/csharp/programming-guide/concepts/linq/finding-the-default-paragraph-style.md deleted file mode 100644 index f3bb8785d3486..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/finding-the-default-paragraph-style.md +++ /dev/null @@ -1,84 +0,0 @@ ---- -title: "Finding the Default Paragraph Style (C#)" -description: Learn how to process a WordprocessingML document with LINQ in C#. This example finds the default style of paragraphs in the document. -ms.date: 07/20/2015 -ms.assetid: be102177-8ab0-444a-b671-7023e555ffdb ---- -# Finding the Default Paragraph Style (C#) -The first task in the Manipulating Information in a WordprocessingML Document tutorial is to find the default style of paragraphs in the document. - -## Example - -### Description - The following example opens an Office Open XML WordprocessingML document, finds the document and style parts of the package, and then executes a query that finds the default style name. For information about Office Open XML document packages, and the parts they consist of, see [Details of Office Open XML WordprocessingML Documents (C#)](./wordprocessingml-document-with-styles.md). - - The query finds a node named `w:style` that has an attribute named `w:type` with a value of "paragraph", and also has an attribute named `w:default` with a value of "1". Because there will be only one XML node with these attributes, the query uses the operator to convert a collection to a singleton. It then gets the value of the attribute with the name `w:styleId`. - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -### Code - -```csharp -const string fileName = "SampleDoc.docx"; - -const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; -const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; -const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; -XNamespace w = wordmlNamespace; - -XDocument xDoc = null; -XDocument styleDoc = null; - -using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) -{ - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } -} - -// The following query finds all the paragraphs that have the default style. -string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph"&& - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - -Console.WriteLine("The default style is: {0}", defaultStyle); -``` - -### Comments - This example produces the following output: - -```output -The default style is: Normal -``` - -## Next Steps - In the next example, you'll create a similar query that finds all the paragraphs in a document and their styles: - -- [Retrieving the Paragraphs and Their Styles (C#)](./retrieving-the-paragraphs-and-their-styles.md) diff --git a/docs/csharp/programming-guide/concepts/linq/functional-construction-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/functional-construction-linq-to-xml.md deleted file mode 100644 index 1ced7c1d309db..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/functional-construction-linq-to-xml.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: "Functional Construction (LINQ to XML) (C#)" -description: Learn how the LINQ to XML programming interface enables functional construction, the ability to create an XML tree in a single statement in C#. -ms.date: 07/20/2015 -ms.assetid: 57a82bcf-de03-4f1c-a0c8-9a76e989d542 ---- -# Functional Construction (LINQ to XML) (C#) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides a powerful way to create XML elements called *functional construction*. Functional construction is the ability to create an XML tree in a single statement. - - There are several key features of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] programming interface that enable functional construction: - -- The constructor takes various types of arguments for content. For example, you can pass another object, which becomes a child element. You can pass an object, which becomes an attribute of the element. Or you can pass any other type of object, which is converted to a string and becomes the text content of the element. - -- The constructor takes a `params` array of type , so that you can pass any number of objects to the constructor. This enables you to create an element that has complex content. - -- If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. This is important because it lets you pass the results of a LINQ query to the constructor. - - These features enable you to write code to create an XML tree. The following is an example: - -```csharp -XElement contacts = - new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144"), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) - ); -``` - - These features also enable you to write code that uses the results of LINQ queries when you create an XML tree, as follows: - -```csharp -XElement srcTree = new XElement("Root", - new XElement("Element", 1), - new XElement("Element", 2), - new XElement("Element", 3), - new XElement("Element", 4), - new XElement("Element", 5) -); -XElement xmlTree = new XElement("Root", - new XElement("Child", 1), - new XElement("Child", 2), - from el in srcTree.Elements() - where (int)el > 2 - select el -); -Console.WriteLine(xmlTree); -``` - - This example produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md b/docs/csharp/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md deleted file mode 100644 index e8898207e26aa..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "Functional Programming vs. Imperative Programming (C#)" -description: This article compares functional programming in C# with the procedural approach. Functional programming enforces immutability through pure functions. -ms.date: 07/20/2015 -ms.assetid: 5e35c5a0-c949-422a-873b-fca6b2254f57 ---- -# Functional Programming vs. Imperative Programming (C#) -This topic compares and contrasts functional programming with more traditional imperative (procedural) programming. - -## Functional Programming vs. Imperative Programming - The *functional programming* paradigm was explicitly created to support a pure functional approach to problem solving. Functional programming is a form of *declarative programming*. In contrast, most mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and Java, were designed to primarily support *imperative* (procedural) programming. - - With an imperative approach, a developer writes code that describes in exacting detail the steps that the computer must take to accomplish the goal. This is sometimes referred to as *algorithmic* programming. In contrast, a functional approach involves composing the problem as a set of functions to be executed. You define carefully the input to each function, and what each function returns. The following table describes some of the general differences between these two approaches. - -|Characteristic|Imperative approach|Functional approach| -|--------------------|-------------------------|-------------------------| -|Programmer focus|How to perform tasks (algorithms) and how to track changes in state.|What information is desired and what transformations are required.| -|State changes|Important.|Non-existent.| -|Order of execution|Important.|Low importance.| -|Primary flow control|Loops, conditionals, and function (method) calls.|Function calls, including recursion.| -|Primary manipulation unit|Instances of structures or classes.|Functions as first-class objects and data collections.| - - Although most languages were designed to support a specific programming paradigm, many general languages are flexible enough to support multiple paradigms. For example, most languages that contain function pointers can be used to credibly support functional programming. Furthermore, C# includes explicit language extensions to support functional programming, including lambda expressions and type inference. LINQ technology is a form of declarative, functional programming. - -## Functional Programming Using XSLT - Many XSLT developers are familiar with the pure functional approach. The most effective way to develop an XSLT style sheet is to treat each template as an isolated, composable transformation. The order of execution is completely de-emphasized. XSLT does not allow side effects (with the exception that escaping mechanisms for executing procedural code can introduce side effects that result in functional impurity). However, although XSLT is an effective tool, some of its characteristics are not optimal. For example, expressing programming constructs in XML makes code relatively verbose, and therefore difficult to maintain. Also, the heavy reliance on recursion for flow control can result in code that is hard to read. For more information about XSLT, see [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md). - - However, XSLT has proved the value of using a pure functional approach for transforming XML from one shape to another. Pure functional programming with LINQ to XML is similar in many ways to XSLT. However, the programming constructs introduced by LINQ to XML and C# allow you to write pure functional transformations that are more readable and maintainable than XSLT. - -## Advantages of Pure Functions - The primary reason to implement functional transformations as pure functions is that pure functions are composable: that is, self-contained and stateless. These characteristics bring a number of benefits, including the following: - -- Increased readability and maintainability. This is because each function is designed to accomplish a specific task given its arguments. The function does not rely on any external state. - -- Easier reiterative development. Because the code is easier to refactor, changes to design are often easier to implement. For example, suppose you write a complicated transformation, and then realize that some code is repeated several times in the transformation. If you refactor through a pure method, you can call your pure method at will without worrying about side effects. - -- Easier testing and debugging. Because pure functions can more easily be tested in isolation, you can write test code that calls the pure function with typical values, valid edge cases, and invalid edge cases. - -## Transitioning for OOP Developers - In traditional object-oriented programming (OOP), most developers are accustomed to programming in the imperative/procedural style. To switch to developing in a pure functional style, they have to make a transition in their thinking and their approach to development. - - To solve problems, OOP developers design class hierarchies, focus on proper encapsulation, and think in terms of class contracts. The behavior and state of object types are paramount, and language features, such as classes, interfaces, inheritance, and polymorphism, are provided to address these concerns. - - In contrast, functional programming approaches computational problems as an exercise in the evaluation of pure functional transformations of data collections. Functional programming avoids state and mutable data, and instead emphasizes the application of functions. - - Fortunately, C# doesn't require the full leap to functional programming, because it supports both imperative and functional programming approaches. A developer can choose which approach is most appropriate for a particular scenario. In fact, programs often combine both approaches. - -## See also - -- [Introduction to Pure Functional Transformations (C#)](./introduction-to-pure-functional-transformations.md) -- [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md) -- [Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md) diff --git a/docs/csharp/programming-guide/concepts/linq/functional-transformation-of-xml.md b/docs/csharp/programming-guide/concepts/linq/functional-transformation-of-xml.md deleted file mode 100644 index 2c970aa602197..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/functional-transformation-of-xml.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Functional Transformation of XML (C#)" -description: Learn how to modify XML documents using the pure functional transformation approach in C# and how that differs from a procedural approach. -ms.date: 07/20/2015 -ms.assetid: 0ccb9251-38d7-44e3-9b84-1b5fe25e4b59 ---- -# Functional Transformation of XML (C#) -This topic discusses the pure functional transformation approach to modifying XML documents, and contrasts it with a procedural approach. - -## Modifying an XML Document - One of the most common tasks for an XML programmer is transforming XML from one shape to another. The shape of an XML document is the structure of the document, which includes the following: - -- The hierarchy expressed by the document. - -- The element and attribute names. - -- The data types of the elements and attributes. - - In general, the most effective approach to transforming XML from one shape to another is that of pure functional transformation. In this approach, the primary programmer task is to create a transformation which is applied to the entire XML document (or to one or more strictly defined nodes). Functional transformation is arguably the easiest to code (after a programmer is familiar with the approach), yields the most maintainable code, and is often more compact than alternative approaches. - -### XML Functional Transformational Technologies - Microsoft offers two functional transformation technologies for use on XML documents: XSLT and LINQ to XML. XSLT is supported in the managed namespace and in the native COM implementation of MSXML. Although XSLT is a robust technology for manipulating XML documents, it requires expertise in a specialized domain, namely the XSLT language and its supporting APIs. - - LINQ to XML provides the tools necessary to code pure functional transformations in an expressive and powerful way, within C# or Visual Basic code. For example, many of the examples in the LINQ to XML documentation use a pure functional approach. Also, in the [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) tutorial, we use LINQ to XML in a functional approach to manipulate information in a Microsoft Word document. - - For a more complete comparison of LINQ to XML with other Microsoft XML technologies, see [LINQ to XML vs. Other XML Technologies](./linq-to-xml-vs-other-xml-technologies.md). - -XSLT is the recommended tool for document-centric transformations when the source document has an irregular structure. However, LINQ to XML can also perform document-centric transforms. For more information, see [How to use annotations to transform LINQ to XML trees in an XSLT style (C#)](./how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md). - -## See also - -- [Introduction to Pure Functional Transformations (C#)](./introduction-to-pure-functional-transformations.md) -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) -- [LINQ to XML vs. Other XML Technologies](./linq-to-xml-vs-other-xml-technologies.md) diff --git a/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md deleted file mode 100644 index 7bca8930e1c19..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: "Functional vs. Procedural Programming (LINQ to XML) (C#)" -description: For processing XML, LINQ to XML supports both procedural, in-memory XML tree modification and a functional construction that uses a declarative approach. -ms.date: 07/20/2015 -ms.assetid: fc64e39c-a487-4882-9169-da4de97917d9 ---- -# Functional vs. Procedural Programming (LINQ to XML) (C#) -There are various types of XML applications: - -- Some applications take source XML documents, and produce new XML documents that are in a different shape than the source documents. - -- Some applications take source XML documents, and produce result documents in an entirely different form, such as HTML or CSV text files. - -- Some applications take source XML documents, and insert records into a database. - -- Some applications take data from another source, such as a database, and create XML documents from it. - - These are not all of the types of XML applications, but these are a representative set of the types of functionality that an XML programmer has to implement. - - With all of these types of applications, there are two contrasting approaches that a developer can take: - -- Functional construction using a declarative approach. - -- In-memory XML tree modification using procedural code. - - LINQ to XML supports both approaches. - - When using the functional approach, you write transformations that take the source documents and generate completely new result documents with the desired shape. - - When modifying an XML tree in place, you write code that traverses and navigates through nodes in an in-memory XML tree, inserting, deleting, and modifying nodes as necessary. - - You can use LINQ to XML with either approach. You use the same classes, and in some cases the same methods. However, the structure and goals of the two approaches are very different. For example, in different situations, one or the other approach will often have better performance, and use more or less memory. In addition, one or the other approach will be easier to write and yield more maintainable code. - - To see the two approaches contrasted, see [In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (C#)](./in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md). - - For a tutorial on writing functional transformations, see [Pure Functional Transformations of XML (C#)](./introduction-to-pure-functional-transformations.md). - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md b/docs/csharp/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md deleted file mode 100644 index 5fd4f305e1169..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "How to build LINQ to XML examples (C#)" -description: Supply the appropriate using directives needed to compile C# to run the provided snippets and examples of LINQ to XML. -ms.date: 07/20/2015 -ms.assetid: e5d18fa1-2704-48fe-a44b-1564f97c9e9c ---- -# How to build LINQ to XML examples (C#) -The various snippets and examples in this documentation use classes and types from a variety of namespaces. When compiling C# code, you need to supply appropriate `using` directives. - -## Example - The following code contains the `using` directives that the C# examples require to build and run. Not all `using` directives are required for every example. - -```csharp -using System; -using System.Diagnostics; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Text; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using System.Xml.Schema; -using System.Xml.XPath; -using System.Xml.Xsl; -using System.IO; -using System.Threading; -using System.Reflection; -using System.IO.Packaging; -``` - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md b/docs/csharp/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md deleted file mode 100644 index 67a079ab0e725..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: "How to calculate intermediate values (C#)" -description: This LINQ to XML example in C# shows how to calculate intermediate values that can be used in sorting, filtering, and selecting. -ms.date: 07/20/2015 -ms.assetid: 7fd3001f-f8f9-4bce-879f-d4c7af8a04fe ---- -# How to calculate intermediate values (C#) -This example shows how to calculate intermediate values that can be used in sorting, filtering, and selecting. - -## Example - The following example uses the `Let` clause. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](./sample-xml-file-numerical-data-linq-to-xml.md). - -```csharp -XElement root = XElement.Load("Data.xml"); -IEnumerable extensions = - from el in root.Elements("Data") - let extension = (decimal)el.Element("Quantity") * (decimal)el.Element("Price") - where extension >= 25 - orderby extension - select extension; -foreach (decimal ex in extensions) - Console.WriteLine(ex); -``` - - This code produces the following output: - -```output -55.92 -73.50 -89.99 -198.00 -435.00 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Numerical Data in a Namespace](./sample-xml-file-numerical-data-in-a-namespace.md). - -```csharp -XElement root = XElement.Load("DataInNamespace.xml"); -XNamespace ad = "http://www.adatum.com"; -IEnumerable extensions = - from el in root.Elements(ad + "Data") - let extension = (decimal)el.Element(ad + "Quantity") * (decimal)el.Element(ad + "Price") - where extension >= 25 - orderby extension - select extension; -foreach (decimal ex in extensions) - Console.WriteLine(ex); -``` - - This code produces the following output: - -```output -55.92 -73.50 -89.99 -198.00 -435.00 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-catch-parsing-errors.md b/docs/csharp/programming-guide/concepts/linq/how-to-catch-parsing-errors.md deleted file mode 100644 index 46ddfb62a28f0..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-catch-parsing-errors.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "How to catch parsing errors (C#)" -description: This LINQ to XML example in C# detects badly formed or invalid XML. LINQ to XML uses XmlReader, which throws an exception for badly formed or invalid XML. -ms.date: 07/20/2015 -ms.assetid: bfb612d4-5605-48ef-8c93-915cf9d5dcfb ---- -# How to catch parsing errors (C#) -This topic shows how to detect badly formed or invalid XML. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is implemented using . If badly formed or invalid XML is passed to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], the underlying class will throw an exception. The various methods that parse XML, such as , do not catch the exception; the exception can then be caught by your application. - -## Example - The following code tries to parse invalid XML: - -```csharp -try { - XElement contacts = XElement.Parse( - @" - - Jim Wilson - - "); - - Console.WriteLine(contacts); -} -catch (System.Xml.XmlException e) -{ - Console.WriteLine(e.Message); -} -``` - - When you run this code, it throws the following exception: - -```console -The 'Contacts' start tag on line 1 does not match the end tag of 'Contcts'. Line 5, position 13. -``` - - For information about the exceptions that you can expect the , , , and methods to throw, see the documentation. - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md deleted file mode 100644 index 6ee474a0576d3..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: "How to chain axis method calls (LINQ to XML) (C#)" -description: These LINQ to XML examples in C# demonstrate calls to two axes to find all elements of a specified name at a given depth in the tree. -ms.date: 07/20/2015 -ms.assetid: 067e6da2-ee32-486d-803c-e611b328e39a ---- -# How to chain axis method calls (LINQ to XML) (C#) -A common pattern that you will use in your code is to call an axis method, then call one of the extension method axes. - - There are two axes with the name of `Elements` that return a collection of elements: the method and the method. You can combine these two axes to find all elements of a specified name at a given depth in the tree. - -## Example - This example uses and to find all `Name` elements in all `Address` elements in all `PurchaseOrder` elements. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XElement purchaseOrders = XElement.Load("PurchaseOrders.xml"); -IEnumerable names = - from el in purchaseOrders - .Elements("PurchaseOrder") - .Elements("Address") - .Elements("Name") - select el; -foreach (XElement e in names) - Console.WriteLine(e); -``` - - This example produces the following output: - -```xml -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` - - This works because one of the implementations of the `Elements` axis is as an extension method on of . derives from , so you can call the method on the results of a call to the method. - -## Example - Sometimes you want to retrieve all elements at a particular element depth when there might or might not be intervening ancestors. For example, in the following document, you might want to retrieve all the `ConfigParameter` elements that are children of the `Customer` element, but not the `ConfigParameter` that is a child of the `Root` element. - -```xml - - RootConfigParameter - - Frank - - FirstConfigParameter - - - - Bob - - - - Bill - - SecondConfigParameter - - - -``` - - To do this, you can use the axis, as follows: - -```csharp -XElement root = XElement.Load("Irregular.xml"); -IEnumerable configParameters = - root.Elements("Customer").Elements("Config"). - Elements("ConfigParameter"); -foreach (XElement cp in configParameters) - Console.WriteLine(cp); -``` - - This example produces the following output: - -```xml -FirstConfigParameter -SecondConfigParameter -``` - -## Example - The following example shows the same technique for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders in a Namespace](./sample-xml-file-multiple-purchase-orders-in-a-namespace.md). - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement purchaseOrders = XElement.Load("PurchaseOrdersInNamespace.xml"); -IEnumerable names = - from el in purchaseOrders - .Elements(aw + "PurchaseOrder") - .Elements(aw + "Address") - .Elements(aw + "Name") - select el; -foreach (XElement e in names) - Console.WriteLine(e); -``` - - This example produces the following output: - -```xml -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` - -## See also - -- [LINQ to XML Axes (C#)](linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md b/docs/csharp/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md deleted file mode 100644 index acbea9c1b962c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "How to change the namespace for an entire XML tree (C#)" -description: Learn how to programmatically change the namespace for an element or an attribute in LINQ to XML in C#. -ms.date: 07/20/2015 -ms.assetid: 1584ff3b-c77d-4241-ab62-80adfb7bfc1b ---- -# How to change the namespace for an entire XML tree (C#) -You sometimes have to programmatically change the namespace for an element or an attribute. LINQ to XML makes this easy. The property can be set. The property cannot be set, but you can easily copy the attributes into a , remove the existing attributes, and then add new attributes that are in the new desired namespace. - - For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -## Example - The following code creates two XML trees in no namespace. It then changes the namespace of each of the trees, and combines them into a single tree. - -```csharp -XElement tree1 = new XElement("Data", - new XElement("Child", "content", - new XAttribute("MyAttr", "content") - ) -); -XElement tree2 = new XElement("Data", - new XElement("Child", "content", - new XAttribute("MyAttr", "content") - ) -); -XNamespace aw = "http://www.adventure-works.com"; -XNamespace ad = "http://www.adatum.com"; -// change the namespace of every element and attribute in the first tree -foreach (XElement el in tree1.DescendantsAndSelf()) -{ - el.Name = aw.GetName(el.Name.LocalName); - List atList = el.Attributes().ToList(); - el.Attributes().Remove(); - foreach (XAttribute at in atList) - el.Add(new XAttribute(aw.GetName(at.Name.LocalName), at.Value)); -} -// change the namespace of every element and attribute in the second tree -foreach (XElement el in tree2.DescendantsAndSelf()) -{ - el.Name = ad.GetName(el.Name.LocalName); - List atList = el.Attributes().ToList(); - el.Attributes().Remove(); - foreach (XAttribute at in atList) - el.Add(new XAttribute(ad.GetName(at.Name.LocalName), at.Value)); -} -// add attribute namespaces so that the tree will be serialized with -// the aw and ad namespace prefixes -tree1.Add( - new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com") -); -tree2.Add( - new XAttribute(XNamespace.Xmlns + "ad", "http://www.adatum.com") -); -// create a new composite tree -XElement root = new XElement("Root", - tree1, - tree2 -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - - content - - - content - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md deleted file mode 100644 index 37561441d71b5..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "How to control namespace prefixes (C#) (LINQ to XML)" -description: Learn how to control namespace prefixes when serializing an XML tree in LINQ to XML in C#. Some situations require control of namespace prefixes. -ms.date: 07/20/2015 -ms.assetid: 64de5186-b81a-4ddd-8327-8693df59a01b ---- -# How to control namespace prefixes (C#) (LINQ to XML) -This topic describes how you can control namespace prefixes when serializing an XML tree. - - In many situations, it is not necessary to control namespace prefixes. - - However, certain XML programming tools require specific control of namespace prefixes. For example, you might be manipulating an XSLT style sheet or a XAML document that contains embedded XPath expressions that refer to specific namespace prefixes; in this case, it is important that the document be serialized with those specific prefixes. - - This is the most common reason for controlling namespace prefixes. - - Another common reason for controlling namespace prefixes is that you want users to edit the XML document manually, and you want to create namespace prefixes that are convenient for the user to type. For example, you might be generating an XSD document. Conventions for schemas suggest that you use either `xs` or `xsd` as the prefix for the schema namespace. - - To control namespace prefixes, you insert attributes that declare namespaces. If you declare the namespaces with specific prefixes, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] will attempt to honor the namespace prefixes when serializing. - - To create an attribute that declares a namespace with a prefix, you create an attribute where the namespace of the name of the attribute is , and the name of the attribute is the namespace prefix. The value of the attribute is the URI of the namespace. - -## Example - This example declares two namespaces. It specifies that the `http://www.adventure-works.com` namespace has the prefix of `aw`, and that the `www.fourthcoffee.com` namespace has the prefix of `fc`. - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XNamespace fc = "www.fourthcoffee.com"; -XElement root = new XElement(aw + "Root", - new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), - new XAttribute(XNamespace.Xmlns + "fc", "www.fourthcoffee.com"), - new XElement(fc + "Child", - new XElement(aw + "DifferentChild", "other content") - ), - new XElement(aw + "Child2", "c2 content"), - new XElement(fc + "Child3", "c3 content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - - other content - - c2 content - c3 content - -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md b/docs/csharp/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md deleted file mode 100644 index 504c2687b06a2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: "How to control the type of a projection (C#)" -description: Learn about how to control the type of a projection in LINQ in C# to create collections of types other than IEnumerable of XElement. -ms.date: 07/20/2015 -ms.assetid: e4db6b7e-4cc9-4c8f-af85-94acf32aa348 ---- -# How to control the type of a projection (C#) -Projection is the process of taking one set of data, filtering it, changing its shape, and even changing its type. Most query expressions perform projections. Most of the query expressions shown in this section evaluate to of , but you can control the type of the projection to create collections of other types. This topic shows how to do this. - -## Example - The following example defines a new type, `Customer`. The query expression then instantiates new `Customer` objects in the `Select` clause. This causes the type of the query expression to be of `Customer`. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -public class Customer -{ - private string customerID; - public string CustomerID{ get{return customerID;} set{customerID = value;}} - - private string companyName; - public string CompanyName{ get{return companyName;} set{companyName = value;}} - - private string contactName; - public string ContactName { get{return contactName;} set{contactName = value;}} - - public Customer(string customerID, string companyName, string contactName) - { - CustomerID = customerID; - CompanyName = companyName; - ContactName = contactName; - } - - public override string ToString() - { - return $"{this.customerID}:{this.companyName}:{this.contactName}"; - } -} - -class Program -{ - static void Main(string[] args) - { - XElement custOrd = XElement.Load("CustomersOrders.xml"); - IEnumerable custList = - from el in custOrd.Element("Customers").Elements("Customer") - select new Customer( - (string)el.Attribute("CustomerID"), - (string)el.Element("CompanyName"), - (string)el.Element("ContactName") - ); - foreach (Customer cust in custList) - Console.WriteLine(cust); - } -} -``` - - This code produces the following output: - -```output -GREAL:Great Lakes Food Market:Howard Snyder -HUNGC:Hungry Coyote Import Store:Yoshi Latimer -LAZYK:Lazy K Kountry Store:John Steel -LETSS:Let's Stop N Shop:Jaime Yorres -``` - -## See also - -- diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces-linq-to-xml.md deleted file mode 100644 index 2c743e6a3f395..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces-linq-to-xml.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -title: "How to create a document with namespaces (C#) (LINQ to XML)" -description: Learn how to create a document with a namespace in LINQ to XML in C# by using an XNamespace object to combine the namespace with the local name. -ms.date: 07/20/2015 -ms.assetid: 37e63c57-f86d-47ac-88a7-2c2d107def30 ---- -# How to create a document with namespaces (C#) (LINQ to XML) -This topic shows how to create documents with namespaces. - -## Example - To create an element or an attribute that is in a namespace, you first declare and initialize an object. You then use the addition operator overload to combine the namespace with the local name, expressed as a string. - - The following example creates a document with one namespace. By default, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] serializes this document with a default namespace. - -```csharp -// Create an XML tree in a namespace. -XNamespace aw = "http://www.adventure-works.com"; -XElement root = new XElement(aw + "Root", - new XElement(aw + "Child", "child content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - child content - -``` - -## Example - The following example creates a document with one namespace. It also creates an attribute that declares the namespace with a namespace prefix. To create an attribute that declares a namespace with a prefix, you create an attribute where the name of the attribute is the namespace prefix, and this name is in the namespace. The value of this attribute is the URI of the namespace. - -```csharp -// Create an XML tree in a namespace, with a specified prefix -XNamespace aw = "http://www.adventure-works.com"; -XElement root = new XElement(aw + "Root", - new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), - new XElement(aw + "Child", "child content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - child content - -``` - -## Example - The following example shows the creation of a document that contains two namespaces. One is the default namespace. Another is a namespace with a prefix. - - By including namespace attributes in the root element, the namespaces are serialized so that `http://www.adventure-works.com` is the default namespace, and `www.fourthcoffee.com` is serialized with a prefix of "fc". To create an attribute that declares a default namespace, you create an attribute with the name "xmlns", without a namespace. The value of the attribute is the default namespace URI. - -```csharp -// The http://www.adventure-works.com namespace is forced to be the default namespace. -XNamespace aw = "http://www.adventure-works.com"; -XNamespace fc = "www.fourthcoffee.com"; -XElement root = new XElement(aw + "Root", - new XAttribute("xmlns", "http://www.adventure-works.com"), - new XAttribute(XNamespace.Xmlns + "fc", "www.fourthcoffee.com"), - new XElement(fc + "Child", - new XElement(aw + "DifferentChild", "other content") - ), - new XElement(aw + "Child2", "c2 content"), - new XElement(fc + "Child3", "c3 content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - - other content - - c2 content - c3 content - -``` - -## Example - The following example creates a document that contains two namespaces, both with namespace prefixes. - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XNamespace fc = "www.fourthcoffee.com"; -XElement root = new XElement(aw + "Root", - new XAttribute(XNamespace.Xmlns + "aw", aw.NamespaceName), - new XAttribute(XNamespace.Xmlns + "fc", fc.NamespaceName), - new XElement(fc + "Child", - new XElement(aw + "DifferentChild", "other content") - ), - new XElement(aw + "Child2", "c2 content"), - new XElement(fc + "Child3", "c3 content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - - other content - - c2 content - c3 content - -``` - -## Example - Another way to accomplish the same result is to use expanded names instead of declaring and creating an object. - - This approach has performance implications. Each time you pass a string that contains an expanded name to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] must parse the name, find the atomized namespace, and find the atomized name. This process takes CPU time. If performance is important, you might want to declare and use an object explicitly. - - If performance is an important issue, see [Pre-Atomization of XName Objects (LINQ to XML) (C#)](./pre-atomization-of-xname-objects-linq-to-xml.md) for more information - -```csharp -// Create an XML tree in a namespace, with a specified prefix -XElement root = new XElement("{http://www.adventure-works.com}Root", - new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), - new XElement("{http://www.adventure-works.com}Child", "child content") -); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - child content - -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md b/docs/csharp/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md deleted file mode 100644 index 47b9e36acfc4a..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "How to create a tree from an XmlReader (C#)" -description: "Learn how to create an XML tree directly from an XmlReader. See an example showing how to create a T:System.Xml.XmlReader object." -ms.date: 07/20/2015 -ms.assetid: 60951c9c-7087-406c-b5bb-c60e58609b21 ---- -# How to create a tree from an XmlReader (C#) -This topic shows how to create an XML tree directly from an . To create an from an , you must position the on an element node. The will skip comments and processing instructions, but if the is positioned on a text node, an error will be thrown. To avoid such errors, always position the on an element before you create an XML tree from the . - -## Example - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](./sample-xml-file-books-linq-to-xml.md). - - The following code creates an `T:System.Xml.XmlReader` object, and then reads nodes until it finds the first element node. It then loads the object. - -```csharp -XmlReader r = XmlReader.Create("books.xml"); -while (r.NodeType != XmlNodeType.Element) - r.Read(); -XElement e = XElement.Load(r); -Console.WriteLine(e); -``` - - This example produces the following output: - -```xml - - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - - -``` - -## See also - -- [Parsing XML (C#)](how-to-parse-a-string.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md b/docs/csharp/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md deleted file mode 100644 index c7038f8c11a85..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: "How to create hierarchy using grouping (C#)" -description: Learn how to group data, and then generate a new XML file where the XML hierarchy reflects the grouping. -ms.date: 07/20/2015 -ms.assetid: 0213d59e-5f76-438c-9cab-4bf11f7b971d ---- -# How to create hierarchy using grouping (C#) -This example shows how to group data, and then generate XML based on the grouping. - -## Example - This example first groups data by a category, then generates a new XML file in which the XML hierarchy reflects the grouping. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](./sample-xml-file-numerical-data-linq-to-xml.md). - -```csharp -XElement doc = XElement.Load("Data.xml"); -var newData = - new XElement("Root", - from data in doc.Elements("Data") - group data by (string)data.Element("Category") into groupedData - select new XElement("Group", - new XAttribute("ID", groupedData.Key), - from g in groupedData - select new XElement("Data", - g.Element("Quantity"), - g.Element("Price") - ) - ) - ); -Console.WriteLine(newData); -``` - - This example produces the following output: - -```xml - - - - 3 - 24.50 - - - 5 - 4.95 - - - 3 - 66.00 - - - 15 - 29.00 - - - - - 1 - 89.99 - - - 10 - .99 - - - 8 - 6.99 - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md b/docs/csharp/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md deleted file mode 100644 index 38c4b788aba23..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: "How to debug empty query results sets (C#)" -description: Learn how to debug empty query results sets. These sets might occur if a developer wrote a query as though the XML were not in a namespace. -ms.date: 07/20/2015 -ms.assetid: b569f0dc-425e-45a6-acbf-770fb761c981 ---- -# How to debug empty query results sets (C#) -One of the most common problems when querying XML trees is that if the XML tree has a default namespace, the developer sometimes writes the query as though the XML were not in a namespace. - - The first set of examples in this topic shows a typical way that XML in a default namespace is loaded, and is queried improperly. - - The second set of examples show the necessary corrections so that you can query XML in a namespace. - - For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -## Example - This example shows creation of XML in a namespace, and a query that returns an empty result set. - -```csharp -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -IEnumerable c1 = - from el in root.Elements("Child") - select el; -Console.WriteLine("Result set follows:"); -foreach (XElement el in c1) - Console.WriteLine((int)el); -Console.WriteLine("End of result set"); -``` - - This example produces the following result: - -```output -Result set follows: -End of result set -``` - -## Example - This example shows creation of XML in a namespace, and a query that is coded properly. - - The solution is to declare and initialize an object, and to use it when specifying objects. In this case, the argument to the method is an object. - -```csharp -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -XNamespace aw = "http://www.adventure-works.com"; -IEnumerable c1 = - from el in root.Elements(aw + "Child") - select el; -Console.WriteLine("Result set follows:"); -foreach (XElement el in c1) - Console.WriteLine((int)el); -Console.WriteLine("End of result set"); -``` - - This example produces the following result: - -```output -Result set follows: -1 -2 -3 -End of result set -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md deleted file mode 100644 index 2c2548a92de5f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "How to filter on an attribute (XPath-LINQ to XML) (C#)" -description: Learn how to filter descendant elements with a specified name and attribute value for XPath-LINQ to XML. -ms.date: 07/20/2015 -ms.assetid: 208d6256-1bd7-4237-b2c9-909f26dfd0e2 ---- -# How to filter on an attribute (XPath-LINQ to XML) (C#) -This topic shows how to get the descendant elements with a specified name, and with an attribute with a specified value. - - The XPath expression is: - - `.//Address[@Type='Shipping']` - -## Example - This example finds all descendants elements with the name of `Address`, and with a `Type` attribute with a value of "Shipping". - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -// LINQ to XML query -IEnumerable list1 = - from el in po.Descendants("Address") - where (string)el.Attribute("Type") == "Shipping" - select el; - -// XPath expression -IEnumerable list2 = po.XPathSelectElements(".//Address[@Type='Shipping']"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md b/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md deleted file mode 100644 index ab6268738ff80..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: "How to filter on an optional element (C#)" -description: Learn how to filter for an optional element even if you are not sure that it exists in your XML document. -ms.date: 07/20/2015 -ms.assetid: f99e2f93-fca5-403f-8a0c-770761d4905a ---- -# How to filter on an optional element (C#) -Sometimes you want to filter for an element even though you are not sure it exists in your XML document. The search should be executed so that if the particular element does not have the child element, you do not trigger a null reference exception by filtering for it. In the following example, the `Child5` element does not have a `Type` child element, but the query still executes correctly. - -## Example - This example uses the extension method. - -```csharp -XElement root = XElement.Parse(@" - - Child One Text - - - - Child Two Text - - - - Child Three Text - - - - Child Four Text - - - - Child Five Text - -"); -var cList = - from typeElement in root.Elements().Elements("Type") - where (string)typeElement.Attribute("Value") == "Yes" - select (string)typeElement.Parent.Element("Text"); -foreach(string str in cList) - Console.WriteLine(str); -``` - - This code produces the following output: - -```output -Child One Text -Child Two Text -Child Four Text -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XElement root = XElement.Parse(@" - - Child One Text - - - - Child Two Text - - - - Child Three Text - - - - Child Four Text - - - - Child Five Text - -"); -XNamespace ad = "http://www.adatum.com"; -var cList = - from typeElement in root.Elements().Elements(ad + "Type") - where (string)typeElement.Attribute("Value") == "Yes" - select (string)typeElement.Parent.Element(ad + "Text"); -foreach (string str in cList) - Console.WriteLine(str); -``` - - This code produces the following output: - -```output -Child One Text -Child Two Text -Child Four Text -``` - -## See also - -- -- -- -- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md) -- [Projection Operations (C#)](./projection-operations.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md deleted file mode 100644 index aac5a99fdf14e..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: "How to filter on element names (LINQ to XML) (C#)" -description: Learn how to filter on the element name when you call a method that returns IEnumerable of XElement. -ms.date: 07/20/2015 -ms.assetid: 1849fb03-f075-421f-863c-e8fb32773cdf ---- -# How to filter on element names (LINQ to XML) (C#) -When you call one of the methods that return of , you can filter on the element name. - -## Example - This example retrieves a collection of descendants that is filtered to contain only descendants with the specified name. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -XElement po = XElement.Load("PurchaseOrder.xml"); -IEnumerable items = - from el in po.Descendants("ProductName") - select el; -foreach(XElement prdName in items) - Console.WriteLine(prdName.Name + ":" + (string) prdName); -``` - - This code produces the following output: - -```output -ProductName:Lawnmower -ProductName:Baby Monitor -``` - - The other methods that return of collections follow the same pattern. Their signatures are similar to and . The following is the complete list of methods that have similar method signatures: - -- - -- - -- - -- - -- - -- - -- - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](./sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement po = XElement.Load("PurchaseOrderInNamespace.xml"); -IEnumerable items = - from el in po.Descendants(aw + "ProductName") - select el; -foreach (XElement prdName in items) - Console.WriteLine(prdName.Name + ":" + (string)prdName); -``` - - This code produces the following output: - -```output -{http://www.adventure-works.com}ProductName:Lawnmower -{http://www.adventure-works.com}ProductName:Baby Monitor -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md deleted file mode 100644 index 0b07a2f2eb4b5..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: "How to find a child element (XPath-LINQ to XML) (C#)" -description: Learn how to find a child element by comparing the XPath child element axis to the LINQ to XML Element method. -ms.date: 07/20/2015 -ms.assetid: 4fa6182d-6196-4ed1-9c9e-82949ff89c71 ---- -# How to find a child element (XPath-LINQ to XML) (C#) -This topic compares the XPath child element axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] method. - - The XPath expression is `DeliveryNotes`. - -## Example - This example finds the child element `DeliveryNotes`. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XDocument cpo = XDocument.Load("PurchaseOrders.xml"); -XElement po = cpo.Root.Element("PurchaseOrder"); - -// LINQ to XML query -XElement el1 = po.Element("DeliveryNotes"); - -// XPath expression -XElement el2 = po.XPathSelectElement("DeliveryNotes"); -// same as "child::DeliveryNotes" -// same as "./DeliveryNotes" - -if (el1 == el2) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(el1); -``` - - This example produces the following output: - -```output -Results are identical -Please leave packages in shed by driveway. -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md deleted file mode 100644 index e267ceb01bfe8..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: "How to find a list of child elements (XPath-LINQ to XML) (C#)" -description: Learn how to find a list of child elements by using an XPath expression. Review a code example that finds all the child elements of a specific element. -ms.date: 07/20/2015 -ms.assetid: 7c589dd8-f680-4cdb-9d6a-78d57e2555e8 ---- -# How to find a list of child elements (XPath-LINQ to XML) (C#) -This topic compares the XPath child elements axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axis. - - The XPath expression is: `./*` - -## Example - This example finds all of the child elements of the `Address` element. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XDocument cpo = XDocument.Load("PurchaseOrders.xml"); -XElement po = cpo.Root.Element("PurchaseOrder").Element("Address"); - -// LINQ to XML query -IEnumerable list1 = po.Elements(); - -// XPath expression -IEnumerable list2 = po.XPathSelectElements("./*"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -Ellen Adams -123 Maple Street -Mill Valley -CA -10999 -USA -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md deleted file mode 100644 index c96addfc898a1..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: "How to find a single descendant using the descendants method (C#)" -description: Learn how to find a single descendant by using the Descendants axis method. This method is useful in finding a particular descendant with a specific name. -ms.date: 07/20/2015 -ms.assetid: 6f735be9-0293-4680-8007-ca9d96bfebed ---- -# How to find a single descendant using the descendants method (C#) -You can use the axis method to quickly write code to find a single uniquely named element. This technique is especially useful when you want to find a particular descendant with a specific name. You could write the code to navigate to the desired element, but it is often faster and easier to write the code using the axis. - -## Example - This example uses the standard query operator. - -```csharp -XElement root = XElement.Parse(@" - - GC1 Value - - - GC2 Value - - - GC3 Value - - - GC4 Value - -"); -string grandChild3 = (string) - (from el in root.Descendants("GrandChild3") - select el).First(); -Console.WriteLine(grandChild3); -``` - - This code produces the following output: - -```output -GC3 Value -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XElement root = XElement.Parse(@" - - GC1 Value - - - GC2 Value - - - GC3 Value - - - GC4 Value - -"); -XNamespace aw = "http://www.adventure-works.com"; -string grandChild3 = (string) - (from el in root.Descendants(aw + "GrandChild3") - select el).First(); -Console.WriteLine(grandChild3); -``` - - This code produces the following output: - -```output -GC3 Value -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md deleted file mode 100644 index e41fb9d53cf38..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: "How to find a union of two location paths (XPath-LINQ to XML) (C#)" -description: Learn how to find a union of two XPath location paths by using an XPath expression. Review a code example that uses a sample XML file. -ms.date: 07/20/2015 -ms.assetid: 069622d3-2b58-4919-8903-710a564c0788 ---- -# How to find a union of two location paths (XPath-LINQ to XML) (C#) -XPath allows you to find the union of the results of two XPath location paths. - - The XPath expression is: - - `//Category|//Price` - - You can achieve the same results by using the standard query operator. - -## Example - This example finds all of the `Category` elements and all of the `Price` elements, and concatenates them into a single collection. Note that the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query calls to order the results. The results of the XPath expression evaluation are also in document order. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](./sample-xml-file-numerical-data-linq-to-xml.md). - -```csharp -XDocument data = XDocument.Load("Data.xml"); - -// LINQ to XML query -IEnumerable list1 = - data - .Descendants("Category") - .Concat( - data - .Descendants("Price") - ) - .InDocumentOrder(); - -// XPath expression -IEnumerable list2 = data.XPathSelectElements("//Category|//Price"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -A -24.50 -B -89.99 -A -4.95 -A -66.00 -B -.99 -A -29.00 -B -6.99 -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md deleted file mode 100644 index 4ae0425d785a8..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "How to find all nodes in a namespace (C#)" -description: Learn how to filter on the namespace of each element or attribute to find all of the nodes in that namespace. -ms.date: 07/20/2015 -ms.assetid: 3a38b913-a53e-4d0e-a19d-8782bffd3364 ---- -# How to find all nodes in a namespace (C#) -You can filter on the namespace of each element or attribute to find all nodes in that particular namespace. - -## Example - The following example creates an XML tree with two namespaces. It then iterates through the tree and prints the names of all the elements and attributes in one of those namespaces. - -```csharp -string markup = @" - abc - def - ghi - - jkl - mno - -"; -XElement xmlTree = XElement.Parse(markup); -Console.WriteLine("Nodes in the http://www.adventure-works.com namespace"); -IEnumerable awElements = - from el in xmlTree.Descendants() - where el.Name.Namespace == "http://www.adventure-works.com" - select el; -foreach (XElement el in awElements) - Console.WriteLine(el.Name.ToString()); -``` - - This code produces the following output: - -```output -Nodes in the http://www.adventure-works.com namespace -{http://www.adventure-works.com}Child3 -{http://www.adventure-works.com}GrandChild2 -``` - -## Example - The XML file accessed by the following query contains purchase orders in two different namespaces. The query creates a new tree with just the elements in one of the namespaces. - - This example uses the following XML document: [Sample XML File: Consolidated Purchase Orders](./sample-xml-file-consolidated-purchase-orders.md). - -```csharp -XDocument cpo = XDocument.Load("ConsolidatedPurchaseOrders.xml"); -XNamespace aw = "http://www.adventure-works.com"; -XElement newTree = new XElement("Root", - from el in cpo.Root.Elements() - where el.Name.Namespace == aw - select el -); -Console.WriteLine(newTree); -``` - - This code produces the following output: - -```xml - - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md deleted file mode 100644 index bec2df913d5b4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "How to find an attribute of the parent (XPath-LINQ to XML) (C#)" -description: Learn how to find an attribute of the parent element. See a code example that uses a sample XML document. -ms.date: 07/20/2015 -ms.assetid: dbef9d89-a5c4-431f-80cc-7a2ebf323f86 ---- -# How to find an attribute of the parent (XPath-LINQ to XML) (C#) - -This topic shows how to navigate to the parent element and find an attribute of it. - -The XPath expression is: - -`../@id` - -## Example - -This example first finds an `Author` element. It then finds the `id` attribute of the parent element. - -This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](./sample-xml-file-books-linq-to-xml.md). - -```csharp -XDocument books = XDocument.Load("Books.xml"); - -XElement author = - books - .Root - .Element("Book") - .Element("Author"); - -// LINQ to XML query -XAttribute att1 = - author - .Parent - .Attribute("id"); - -// XPath expression -XAttribute att2 = ((IEnumerable)author.XPathEvaluate("../@id")).Cast().First(); - -if (att1 == att2) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(att1); -``` - -This example produces the following output: - -```output -Results are identical -id="bk101" -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md deleted file mode 100644 index f1907319279a8..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to find an element with a specific attribute (C#)" -description: Learn how to find an element that has an attribute with a specific value. See code examples and additional resources. -ms.date: 07/20/2015 -ms.assetid: b92591aa-3cfb-490e-99f6-da8de335e362 ---- -# How to find an element with a specific attribute (C#) -This topic shows how to find an element that has an attribute that has a specific value. - -## Example - The example shows how to find the `Address` element that has a `Type` attribute with a value of "Billing". - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -XElement root = XElement.Load("PurchaseOrder.xml"); -IEnumerable address = - from el in root.Elements("Address") - where (string)el.Attribute("Type") == "Billing" - select el; -foreach (XElement el in address) - Console.WriteLine(el); -``` - - This code produces the following output: - -```xml -
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
-``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](./sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```csharp -XElement root = XElement.Load("PurchaseOrderInNamespace.xml"); -XNamespace aw = "http://www.adventure-works.com"; -IEnumerable address = - from el in root.Elements(aw + "Address") - where (string)el.Attribute(aw + "Type") == "Billing" - select el; -foreach (XElement el in address) - Console.WriteLine(el); -``` - - This code produces the following output: - -```xml - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - -``` - -## See also - -- -- -- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md) -- [Projection Operations (C#)](./projection-operations.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md deleted file mode 100644 index 4598a9e982dcd..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: "How to find an element with a specific child element (C#)" -description: Learn how to find an element that has a specific child element. See code examples and additional resources. -ms.date: 07/20/2015 -ms.assetid: 00cf5555-374e-4369-bf93-7bd2e7f21db3 ---- -# How to find an element with a specific child element (C#) -This topic shows how to find a particular element that has a child element with a specific value. - -## Example - The example finds the `Test` element that has a `CommandLine` child element with the value of "Examp2.EXE". - - This example uses the following XML document: [Sample XML File: Test Configuration (LINQ to XML)](./sample-xml-file-test-configuration-linq-to-xml.md). - -```csharp -XElement root = XElement.Load("TestConfig.xml"); -IEnumerable tests = - from el in root.Elements("Test") - where (string)el.Element("CommandLine") == "Examp2.EXE" - select el; -foreach (XElement el in tests) - Console.WriteLine((string)el.Attribute("TestId")); -``` - - This code produces the following output: - -```output -0002 -0006 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Test Configuration in a Namespace](./sample-xml-file-test-configuration-in-a-namespace1.md). - -```csharp -XElement root = XElement.Load("TestConfigInNamespace.xml"); -XNamespace ad = "http://www.adatum.com"; -IEnumerable tests = - from el in root.Elements(ad + "Test") - where (string)el.Element(ad + "CommandLine") == "Examp2.EXE" - select el; -foreach (XElement el in tests) - Console.WriteLine((string)el.Attribute("TestId")); -``` - - This code produces the following output: - -```output -0002 -0006 -``` - -## See also - -- -- -- [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md) -- [Projection Operations (C#)](./projection-operations.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md deleted file mode 100644 index 969aaad4040b2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "How to find attributes of siblings with a specific name (XPath-LINQ to XML) (C#)" -description: Learn how to find all attributes of the siblings of the context node. Review a code example that uses a sample XML file. -ms.date: 07/20/2015 -ms.assetid: c3133d64-523f-422d-8838-73d36b945ca0 ---- -# How to find attributes of siblings with a specific name (XPath-LINQ to XML) (C#) -This topic shows how to find all attributes of the siblings of the context node. Only attributes with a specific name are returned in the collection. - - The XPath expression is: - - `../Book/@id` - -## Example - This example first finds a `Book` element, and then finds all sibling elements named `Book`, and then finds all attributes named `id`. The result is a collection of attributes. - - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](./sample-xml-file-books-linq-to-xml.md). - -```csharp -XDocument books = XDocument.Load("Books.xml"); - -XElement book = - books - .Root - .Element("Book"); - -// LINQ to XML query -IEnumerable list1 = - from el in book.Parent.Elements("Book") - select el.Attribute("id"); - -// XPath expression -IEnumerable list2 = - ((IEnumerable)book.XPathEvaluate("../Book/@id")).Cast(); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XAttribute el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -id="bk101" -id="bk102" -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position-xpath-linq-to-xml.md deleted file mode 100644 index 020c1d7bf29ca..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position-xpath-linq-to-xml.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "How to find child elements based on position (XPath-LINQ to XML) (C#)" -description: Learn how to find child elements based on position by using an XPath expression. Review a code example that uses a sample XML file. -ms.date: 07/20/2015 -ms.assetid: e35bb269-ec86-4c96-8321-12491a0eb2c3 ---- -# How to find child elements based on position (XPath-LINQ to XML) (C#) -Sometimes you want to find elements based on their position. You might want to find the second element, or you might want to find the third through the fifth element. - - The XPath expression is: - - `Test[position() >= 2 and position() <= 4]` - - There are two approaches to writing this [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query in a lazy way. You can use the and operators, or you can use the overload that takes an index. When you use the overload, you use a lambda expression that takes two arguments. The following example shows both methods of selecting based on position. - -## Example - This example finds the second through the fourth `Test` element. The result is a collection of elements. - - This example uses the following XML document: [Sample XML File: Test Configuration (LINQ to XML)](./sample-xml-file-test-configuration-linq-to-xml.md). - -```csharp -XElement testCfg = XElement.Load("TestConfig.xml"); - -// LINQ to XML query -IEnumerable list1 = - testCfg - .Elements("Test") - .Skip(1) - .Take(3); - -// LINQ to XML query -IEnumerable list2 = - testCfg - .Elements("Test") - .Where((el, idx) => idx >= 1 && idx <= 3); - -// XPath expression -IEnumerable list3 = - testCfg.XPathSelectElements("Test[position() >= 2 and position() <= 4]"); - -if (list1.Count() == list2.Count() && - list1.Count() == list3.Count() && - list1.Intersect(list2).Count() == list1.Count() && - list1.Intersect(list3).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md deleted file mode 100644 index 5b279056bc43e..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "How to find descendant elements (XPath-LINQ to XML) (C#)" -description: Learn how to find descendant elements with a particular name by using an XPath expression. Review a code example that uses a sample XML file. -ms.date: 07/20/2015 -ms.assetid: b318da39-bb8b-4c56-a019-e13b12b01831 ---- -# How to find descendant elements (XPath-LINQ to XML) (C#) -This topic shows how to get the descendant elements with a particular name. - - The XPath expression is `//Name`. - -## Example - This example finds all descendants named `Name`. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -// LINQ to XML query -IEnumerable list1 = po.Root.Descendants("Name"); - -// XPath expression -IEnumerable list2 = po.XPathSelectElements("//Name"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md deleted file mode 100644 index 5466aa1d5750f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to find descendants of a child element (XPath-LINQ to XML) (C#)" -description: Learn how to find descendant elements of a child element with a particular name by using an XPath expression. -ms.date: 07/20/2015 -ms.assetid: 505b7512-bb8b-4f85-abbf-491f039c961e ---- -# How to find descendants of a child element (XPath-LINQ to XML) (C#) -This topic shows how to get the descendant elements of a child element with a particular name. - - The XPath expression is: - - `./Paragraph//Text/text()` - -## Example - This example simulates the problems of extracting text from an XML representation of a word processing document. It first selects all `Paragraph` elements, and then it selects all `Text` descendant elements of each `Paragraph` element. This doesn't select the descendant `Text` elements of the `Comment` element. - -```csharp -XElement root = XElement.Parse( -@" - - This is the start of - - - This comment is not part of the paragraph text. - - - - a sentence. - - - - This is a second sentence. - -"); - -// LINQ to XML query -string str1 = - root - .Elements("Paragraph") - .Descendants("Text") - .Select(s => s.Value) - .Aggregate( - new StringBuilder(), - (s, i) => s.Append(i), - s => s.ToString() - ); - -// XPath expression -string str2 = - ((IEnumerable)root.XPathEvaluate("./Paragraph//Text/text()")) - .Cast() - .Select(s => s.Value) - .Aggregate( - new StringBuilder(), - (s, i) => s.Append(i), - s => s.ToString() - ); - -if (str1 == str2) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(str2); -``` - - This example produces the following output: - -```output -Results are identical -This is the start of a sentence. This is a second sentence. -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md deleted file mode 100644 index 28f27a2552373..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "How to find descendants with a specific element name (C#)" -description: Learn how to find all descendants with a particular name by using the Descendants axis. See code examples and additional resources. -ms.date: 07/20/2015 -ms.assetid: f684da20-bee9-47f5-9607-7e3fd7e67470 ---- -# How to find descendants with a specific element name (C#) -Sometimes you want to find all descendants with a particular name. You could write code to iterate through all of the descendants, but it is easier to use the axis. - -## Example - The following example shows how to find descendants based on the element name. - -```csharp -XElement root = XElement.Parse(@" - - - Some text - - - - that is broken up into - - - - - multiple segments. - - - -"); -IEnumerable textSegs = - from seg in root.Descendants("t") - select (string)seg; - -string str = textSegs.Aggregate(new StringBuilder(), - (sb, i) => sb.Append(i), - sp => sp.ToString() -); - -Console.WriteLine(str); -``` - - This code produces the following output: - -```output -Some text that is broken up into multiple segments. -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XElement root = XElement.Parse(@" - - - Some text - - - - that is broken up into - - - - - multiple segments. - - - -"); -XNamespace ad = "http://www.adatum.com"; -IEnumerable textSegs = - from seg in root.Descendants(ad + "t") - select (string)seg; - -string str = textSegs.Aggregate(new StringBuilder(), - (sb, i) => sb.Append(i), - sp => sp.ToString() -); - -Console.WriteLine(str); -``` - - This code produces the following output: - -```output -Some text that is broken up into multiple segments. -``` - -## See also - -- diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md deleted file mode 100644 index 1d61f9bb3759a..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to find elements in a namespace (XPath-LINQ to XML) (C#)" -description: Learn how to find elements in a namespace by using an XPath expression. See an example that reads an XML tree containing two namespaces. -ms.date: 07/20/2015 -ms.assetid: cae1c4ac-6cd5-46cf-9b1c-bd85bc9b7ea9 ---- -# How to find elements in a namespace (XPath-LINQ to XML) (C#) - -XPath expressions can find nodes in a particular namespace. XPath expressions use namespace prefixes for specifying namespaces. To parse an XPath expression that contains namespace prefixes, you must pass an object to the XPath methods that implements . This example uses . - -The XPath expression is: - -`./aw:*` - -## Example - -The following example reads an XML tree that contains two namespaces. It uses an to read the XML document. It then gets an from the , and an from the . It uses the when selecting elements. - -```csharp -XmlReader reader = XmlReader.Create("ConsolidatedPurchaseOrders.xml"); -XElement root = XElement.Load(reader); -XmlNameTable nameTable = reader.NameTable; -XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable); -namespaceManager.AddNamespace("aw", "http://www.adventure-works.com"); -IEnumerable list1 = root.XPathSelectElements("./aw:*", namespaceManager); -IEnumerable list2 = - from el in root.Elements() - where el.Name.Namespace == "http://www.adventure-works.com" - select el; -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list2) - Console.WriteLine(el); -``` - -This example produces the following output: - -```output -Results are identical - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute-xpath-linq-to-xml.md deleted file mode 100644 index c391e494baa92..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute-xpath-linq-to-xml.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "How to find elements with a specific attribute (XPath-LINQ to XML) (C#)" -description: This C# example compares XPath to LINQ to XML for how they find elements that have a specific attribute. -ms.date: 07/20/2015 -ms.assetid: daed00dd-923a-43be-8a90-eee406f6f574 ---- -# How to find elements with a specific attribute (XPath-LINQ to XML) (C#) -Sometimes you want to find all elements that have a specific attribute. You are not concerned about the contents of the attribute. Instead, you want to select based on the existence of the attribute. - - The XPath expression is: - - `./*[@Select]` - -## Example - The following code selects just the elements that have the `Select` attribute. - -```csharp -XElement doc = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 -"); - -// LINQ to XML query -IEnumerable list1 = - from el in doc.Elements() - where el.Attribute("Select") != null - select el; - -// XPath expression -IEnumerable list2 = - ((IEnumerable)doc.XPathEvaluate("./*[@Select]")).Cast(); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -2 -4 -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md deleted file mode 100644 index 4405632d825c8..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "How to find preceding siblings (XPath-LINQ to XML) (C#)" -description: This C# example compares the XPath preceding-sibling axis to the LINQ to XML child XNode.ElementsBeforeSelf axis. -ms.date: 07/20/2015 -ms.assetid: b281ff99-d08a-43d0-bea1-eff831b2f8ae ---- -# How to find preceding siblings (XPath-LINQ to XML) (C#) -This topic compares the XPath `preceding-sibling` axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] child axis. - - The XPath expression is: - - `preceding-sibling::*` - - Note that the results of both and are in document order. - -## Example - The following example finds the `FullAddress` element, and then retrieves the previous elements using the `preceding-sibling` axis. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -XElement co = XElement.Load("CustomersOrders.xml"); - -XElement add = co.Element("Customers").Element("Customer").Element("FullAddress"); - -// LINQ to XML query -IEnumerable list1 = add.ElementsBeforeSelf(); - -// XPath expression -IEnumerable list2 = add.XPathSelectElements("preceding-sibling::*"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list2) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical -Great Lakes Food Market -Howard Snyder -Marketing Manager -(503) 555-7555 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md deleted file mode 100644 index aed322275acb2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: "How to find related elements (XPath-LINQ to XML) (C#)" -description: This C# example compares XPath to LINQ to XML for how to get an element selecting on an attribute that is referred to by the value of another element. -ms.date: 07/20/2015 -ms.assetid: 41b386ee-562d-4841-bd6b-e44a7eb69f26 ---- -# How to find related elements (XPath-LINQ to XML) (C#) -This topic shows how to get an element selecting on an attribute that is referred to by the value of another element. - - The XPath expression is: - - `.//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]` - -## Example - This example finds the 12th `Order` element, and then finds the customer for that order. - - Note that indexing into a list in .NET is 'zero' based. Indexing into a collection of nodes in an XPath predicate is 'one' based. This example reflects this difference. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -XDocument co = XDocument.Load("CustomersOrders.xml"); - -// LINQ to XML query -XElement customer1 = - (from el in co.Descendants("Customer") - where (string)el.Attribute("CustomerID") == - (string)(co - .Element("Root") - .Element("Orders") - .Elements("Order") - .ToList()[11] - .Element("CustomerID")) - select el) - .First(); - -// An alternate way to write the query that avoids creation -// of a System.Collections.Generic.List: -XElement customer2 = - (from el in co.Descendants("Customer") - where (string)el.Attribute("CustomerID") == - (string)(co - .Element("Root") - .Element("Orders") - .Elements("Order") - .Skip(11).First() - .Element("CustomerID")) - select el) - .First(); - -// XPath expression -XElement customer3 = co.XPathSelectElement( - ".//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]"); - -if (customer1 == customer2 && customer1 == customer3) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(customer1); -``` - - This example produces the following output: - -```output -Results are identical - - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
-``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md deleted file mode 100644 index 8f63ed95e4563..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: "How to find sibling nodes (XPath-LINQ to XML) (C#)" -description: This C# example compares XPath to LINQ to XML for how to find all siblings of a node that have a specific name. -ms.date: 07/20/2015 -ms.assetid: e2c73d10-a8ca-4e11-b5aa-d055de285874 ---- -# How to find sibling nodes (XPath-LINQ to XML) (C#) -You might want to find all siblings of a node that have a specific name. The resulting collection might include the context node if the context node also has the specific name. - - The XPath expression is: - - `../Book` - -## Example - This example first finds a `Book` element, and then finds all sibling elements named `Book`. The resulting collection includes the context node. - - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](./sample-xml-file-books-linq-to-xml.md). - -```csharp -XDocument books = XDocument.Load("Books.xml"); - -XElement book = - books - .Root - .Elements("Book") - .Skip(1) - .First(); - -// LINQ to XML query -IEnumerable list1 = - book - .Parent - .Elements("Book"); - -// XPath expression -IEnumerable list2 = book.XPathSelectElements("../Book"); - -if (list1.Count() == list2.Count() && - list1.Intersect(list2).Count() == list1.Count()) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces the following output: - -```output -Results are identical - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md deleted file mode 100644 index 5ee6ea9513ebd..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "How to find the immediate preceding sibling (XPath-LINQ to XML) (C#)" -description: This C# example compares XPath to LINQ to XML for how to find the sibling that immediately precedes a node. -ms.date: 07/20/2015 -ms.assetid: 74c06201-0b1b-4b5e-b3ac-0092980614e6 ---- -# How to find the immediate preceding sibling (XPath-LINQ to XML) (C#) -Sometimes you want to find the immediate preceding sibling to a node. Due to the difference in the semantics of positional predicates for the preceding sibling axes in XPath as opposed to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], this is one of the more interesting comparisons. - -## Example - In this example, the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query uses the operator to find the last node in the collection returned by . By contrast, the XPath expression uses a predicate with a value of 1 to find the immediately preceding element. - -```csharp -XElement root = XElement.Parse( - @" - - - - -"); -XElement child4 = root.Element("Child4"); - -// LINQ to XML query -XElement el1 = - child4 - .ElementsBeforeSelf() - .Last(); - -// XPath expression -XElement el2 = - ((IEnumerable)child4 - .XPathEvaluate("preceding-sibling::*[1]")) - .Cast() - .First(); - -if (el1 == el2) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(el1); -``` - - This example produces the following output: - -```output -Results are identical - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md deleted file mode 100644 index b7e267bddca43..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: "How to find the root element (XPath-LINQ to XML) (C#)" -description: This C# example compares XPath to LINQ to XML for how to get the root element for a sample XML document. -ms.date: 07/20/2015 -ms.assetid: 4fd824e0-4d39-429b-b092-f6a5c046ee6c ---- -# How to find the root element (XPath-LINQ to XML) (C#) -This topic shows how to get the root element with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - The XPath expression is: - - `/PurchaseOrders` - -## Example - This example finds the root element. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -// LINQ to XML query -XElement el1 = po.Root; - -// XPath expression -XElement el2 = po.XPathSelectElement("/PurchaseOrders"); - -if (el1 == el2) - Console.WriteLine("Results are identical"); -else - Console.WriteLine("Results differ"); -Console.WriteLine(el1.Name); -``` - - This example produces the following output: - -```output -Results are identical -PurchaseOrders -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md deleted file mode 100644 index e034599bac5ed..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "How to generate text files from XML (C#)" -description: Learn how to generate a .csv file from an XML file in C#. This example uses method syntax and the Aggregate operator. -ms.date: 07/20/2015 -ms.assetid: 9ad283f7-7cac-42ff-bf32-92aa866e6883 ---- -# How to generate text files from XML (C#) -This example shows how to generate a comma-separated values (CSV) file from an XML file. - -## Example - The C# version of this example uses method syntax and the `Aggregate` operator to generate a CSV file from an XML document in a single expression. For more information, see [Query Syntax and Method Syntax in LINQ](./query-syntax-and-method-syntax-in-linq.md). - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -XElement custOrd = XElement.Load("CustomersOrders.xml"); -string csv = - (from el in custOrd.Element("Customers").Elements("Customer") - select - String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}{10}", - (string)el.Attribute("CustomerID"), - (string)el.Element("CompanyName"), - (string)el.Element("ContactName"), - (string)el.Element("ContactTitle"), - (string)el.Element("Phone"), - (string)el.Element("FullAddress").Element("Address"), - (string)el.Element("FullAddress").Element("City"), - (string)el.Element("FullAddress").Element("Region"), - (string)el.Element("FullAddress").Element("PostalCode"), - (string)el.Element("FullAddress").Element("Country"), - Environment.NewLine - ) - ) - .Aggregate( - new StringBuilder(), - (sb, s) => sb.Append(s), - sb => sb.ToString() - ); -Console.WriteLine(csv); -``` - - This code produces the following output: - -```output -GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA -HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA -LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA -LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (C#)](how-to-work-with-dictionaries-using-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md b/docs/csharp/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md deleted file mode 100644 index bbcb014018fc5..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -title: "How to generate XML from CSV files (C#)" -description: Learn how to use LINQ and LINQ to XML in C# to generate XML from a .csv file. The query uses a let clause to split strings into arrays of fields. -ms.date: 07/20/2015 -ms.assetid: 57b9ccde-f983-4a21-ae61-70ecede30307 ---- -# How to generate XML from CSV files (C#) -This example shows how to use Language-Integrated Query (LINQ) and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to generate an XML file from a comma-separated value (CSV) file. - -## Example - The following code performs a LINQ query on an array of strings. - - The query uses the `let` clause to split each string into an array of fields. - -```csharp -// Create the text file. -string csvString = @"GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA -HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA -LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA -LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA"; -File.WriteAllText("cust.csv", csvString); - -// Read into an array of strings. -string[] source = File.ReadAllLines("cust.csv"); -XElement cust = new XElement("Root", - from str in source - let fields = str.Split(',') - select new XElement("Customer", - new XAttribute("CustomerID", fields[0]), - new XElement("CompanyName", fields[1]), - new XElement("ContactName", fields[2]), - new XElement("ContactTitle", fields[3]), - new XElement("Phone", fields[4]), - new XElement("FullAddress", - new XElement("Address", fields[5]), - new XElement("City", fields[6]), - new XElement("Region", fields[7]), - new XElement("PostalCode", fields[8]), - new XElement("Country", fields[9]) - ) - ) -); -Console.WriteLine(cust); -``` - - This code produces the following output: - -```xml - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
-``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md deleted file mode 100644 index 3a44386edfc15..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: "How to join two collections (LINQ to XML) (C#)" -description: This C# example joins the elements in LINQ to XML to other elements and generates a new XML document. -ms.date: 07/20/2015 -ms.assetid: 7b817ede-911a-4cff-9dd3-639c3fc228c9 ---- -# How to join two collections (LINQ to XML) (C#) - -An element or attribute in an XML document can sometimes refer to another element or attribute. For example, the [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md) XML document contains a list of customers and a list of orders. Each `Customer` element contains a `CustomerID` attribute. Each `Order` element contains a `CustomerID` element. The `CustomerID` element in each order refers to the `CustomerID` attribute in a customer. - -The topic [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - -With [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can take advantage of this relationship by using the `join` clause. - -Because there is no index available, such joining will have poor run-time performance. - -For more detailed information about `join`, see [Join Operations (C#)](./join-operations.md). - -## Example - -The following example joins the `Customer` elements to the `Order` elements, and generates a new XML document that includes the `CompanyName` element in the orders. - -Before executing the query, the example validates that the document complies with the schema in [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md). This ensures that the join clause will always work. - -This query first retrieves all `Customer` elements, and then joins them to the `Order` elements. It selects only the orders for customers with a `CustomerID` greater than "K". It then projects a new `Order` element that contains the customer information within each order. - -This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -This example uses the following XSD schema: [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md). - -Joining in this fashion will not perform well. Joins are performed via a linear search. There are no hash tables or indexes to help with performance. - -```csharp -XmlSchemaSet schemas = new XmlSchemaSet(); -schemas.Add("", "CustomersOrders.xsd"); - -Console.Write("Attempting to validate, "); -XDocument custOrdDoc = XDocument.Load("CustomersOrders.xml"); - -bool errors = false; -custOrdDoc.Validate(schemas, (o, e) => - { - Console.WriteLine("{0}", e.Message); - errors = true; - }); -Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); - -if (!errors) -{ - // Join customers and orders, and create a new XML document with - // a different shape. - - // The new document contains orders only for customers with a - // CustomerID > 'K' - XElement custOrd = custOrdDoc.Element("Root"); - XElement newCustOrd = new XElement("Root", - from c in custOrd.Element("Customers").Elements("Customer") - join o in custOrd.Element("Orders").Elements("Order") - on (string)c.Attribute("CustomerID") equals - (string)o.Element("CustomerID") - where ((string)c.Attribute("CustomerID")).CompareTo("K") > 0 - select new XElement("Order", - new XElement("CustomerID", (string)c.Attribute("CustomerID")), - new XElement("CompanyName", (string)c.Element("CompanyName")), - new XElement("ContactName", (string)c.Element("ContactName")), - new XElement("EmployeeID", (string)o.Element("EmployeeID")), - new XElement("OrderDate", (DateTime)o.Element("OrderDate")) - ) - ); - Console.WriteLine(newCustOrd); -} -``` - -This code produces the following output: - -```output -Attempting to validate, custOrdDoc validated - - - LAZYK - Lazy K Kountry Store - John Steel - 1 - 1997-03-21T00:00:00 - - - LAZYK - Lazy K Kountry Store - John Steel - 8 - 1997-05-22T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 1 - 1997-06-25T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 8 - 1997-10-27T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 6 - 1997-11-10T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 4 - 1998-02-12T00:00:00 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md b/docs/csharp/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md deleted file mode 100644 index ed93bb6bdaf10..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "How to load XML from a file (C#)" -description: Learn how to load XML from a URI by using the XElement.Load method in C#. This example loads the XML file and prints the XML tree to the console. -ms.date: 07/20/2015 -ms.assetid: 3ed38487-8028-4209-9872-c8dce0ed4dfe ---- -# How to load XML from a file (C#) -This topic shows how to load XML from a URI by using the method. - -## Example - The following example shows how to load an XML document from a file. The following example loads books.xml and outputs the XML tree to the console. - - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](./sample-xml-file-books-linq-to-xml.md). - -```csharp -XElement booksFromFile = XElement.Load(@"books.xml"); -Console.WriteLine(booksFromFile); -``` - - This code produces the following output: - -```xml - - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md b/docs/csharp/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md deleted file mode 100644 index 46776bd14cd6c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: "How to modify an Office Open XML document (C#)" -description: Learn how to open an Office Open XML document, modify it, and save it. This C# example uses classes found in the WindowsBase assembly. -ms.date: 07/20/2015 -ms.assetid: 467d489c-2b1b-453b-a757-8ac180e82a96 ---- -# How to modify an Office Open XML document (C#) -This topic presents an example that opens an Office Open XML document, modifies it, and saves it. - - For more information on Office Open XML, see [Open XML SDK](https://github.com/OfficeDev/Open-XML-SDK) and [www.ericwhite.com](http://ericwhite.com/). - -## Example - This example finds the first paragraph element in the document. It retrieves the text from the paragraph, and then deletes all text runs in the paragraph. It creates a new text run that consists of the first paragraph text that has been converted to upper case. It then serializes the changed XML into the Open XML package and closes it. - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite)) - { - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - XDocument xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - PackagePart stylePart = null; - XDocument styleDoc = null; - - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - - XElement paraNode = xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - .FirstOrDefault(); - - string paraText = ParagraphText(paraNode); - - // remove all text runs - paraNode.Descendants(w + "r").Remove(); - - paraNode.Add( - new XElement(w + "r", - new XElement(w + "t", paraText.ToUpper()) - ) - ); - - // Save the XML into the package - using (XmlWriter xw = - XmlWriter.Create(documentPart.GetStream(FileMode.Create, FileAccess.Write))) - { - xDoc.Save(xw); - } - - Console.WriteLine("New first paragraph: >{0}<", paraText.ToUpper()); - } - } - } -} -``` - - If you open `SampleDoc.docx` after running this program, you can see that this program converted the first paragraph in the document to upper case. - - When run with the sample Open XML document described in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md), this example produces the following output: - -```output -New first paragraph: >PARSING WORDPROCESSINGML WITH LINQ TO XML< -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-parse-a-string.md b/docs/csharp/programming-guide/concepts/linq/how-to-parse-a-string.md deleted file mode 100644 index 7ad46dc50b40b..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-parse-a-string.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "How to parse a string (C#)" -description: Learn how to parse a string to create an XML tree in C#. Learn how to access specific data in your parsed XML. -ms.date: 07/20/2015 -ms.assetid: 81e5686c-9658-42d8-a7e3-b11be0a2c98b ---- -# How to parse a string (C#) - -This topic shows how to parse a string to create an XML tree in C#. - -## Example - -The following C# code shows how to parse an XML string: - -```csharp -XElement contacts = XElement.Parse( - @" - - Patrick Hines - 206-555-0144 - 425-555-0145 -
- 123 Main St - Mercer Island - WA - 68042 -
- 10 -
- - Gretchen Rivas - 206-555-0163 -
- 123 Main St - Mercer Island - WA - 68042 -
- 11 -
-
"); -Console.WriteLine(contacts); -``` - -The root `Contacts` node has two `Contact` nodes. To access some specific data in your parsed XML, use the [XElement.Elements()](xref:System.Xml.Linq.XContainer.Elements) method, which in this case returns the child elements of the root `Contacts` node. The following example prints the first `Contact` node to the console: - -```csharp -List contactNodes = contacts.Elements("Contact").ToList(); -Console.WriteLine(contactNodes[0]); -``` - -## See also - -- [How to find an element with a specific attribute (C#)](how-to-find-an-element-with-a-specific-attribute.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md b/docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md deleted file mode 100644 index de102bc5aeabb..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md +++ /dev/null @@ -1,319 +0,0 @@ ---- -title: "How to perform streaming transform of large XML documents (C#)" -description: Learn how to do a streaming transformation of text to XML in C# to avoid excessive memory use for some files. -ms.date: 07/20/2015 -ms.assetid: 5f16d1f8-5370-4b55-b0c8-e497df163037 ---- -# How to perform streaming transform of large XML documents (C#) -Sometimes you have to transform large XML files, and write your application so that the memory footprint of the application is predictable. If you try to populate an XML tree with a very large XML file, your memory usage will be proportional to the size of the file (that is, excessive). Therefore, you should use a streaming technique instead. - - Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. Note that if you use a query operator that materializes its source before yielding the first item, you will not retain a small memory footprint for your application. - -Even if you use the technique described in [How to stream XML fragments with access to header information (C#)](./how-to-stream-xml-fragments-with-access-to-header-information.md), if you try to assemble an XML tree that contains the transformed document, memory usage will be too great. - - There are two main approaches. One approach is to use the deferred processing characteristics of . Another approach is to create an , and use the capabilities of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to write elements to an . This topic demonstrates both approaches. - -## Example - The following example builds on the example in [How to stream XML fragments with access to header information (C#)](./how-to-stream-xml-fragments-with-access-to-header-information.md). - - This example uses the deferred execution capabilities of to stream the output. This example can transform a very large document while maintaining a small memory footprint. - - Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would be prepared to parse an invalid document. - - The following is the source document, Source.xml: - -```xml - - - - A. Datum Corporation - - 0001 - - - 0002 - - - 0003 - - - 0004 - - - - Fabrikam, Inc. - - 0005 - - - 0006 - - - 0007 - - - 0008 - - - - Southridge Video - - 0009 - - - 0010 - - - -``` - -```csharp -static IEnumerable StreamCustomerItem(string uri) -{ - using (XmlReader reader = XmlReader.Create(uri)) - { - XElement name = null; - XElement item = null; - - reader.MoveToContent(); - - // Parse the file, save header information when encountered, and yield the - // Item XElement objects as they are created. - - // loop through Customer elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Customer") - { - // move to Name element - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element && - reader.Name == "Name") - { - name = XElement.ReadFrom(reader) as XElement; - break; - } - } - - // loop through Item elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.EndElement) - break; - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Item") - { - item = XElement.ReadFrom(reader) as XElement; - if (item != null) - { - XElement tempRoot = new XElement("Root", - new XElement(name) - ); - tempRoot.Add(item); - yield return item; - } - } - } - } - } - } -} - -static void Main(string[] args) -{ - XStreamingElement root = new XStreamingElement("Root", - from el in StreamCustomerItem("Source.xml") - select new XElement("Item", - new XElement("Customer", (string)el.Parent.Element("Name")), - new XElement(el.Element("Key")) - ) - ); - root.Save("Test.xml"); - Console.WriteLine(File.ReadAllText("Test.xml")); -} -``` - - This code produces the following output: - -```xml - - - - A. Datum Corporation - 0001 - - - A. Datum Corporation - 0002 - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - - Fabrikam, Inc. - 0008 - - - Southridge Video - 0009 - - - Southridge Video - 0010 - - -``` - -## Example -The following example also builds on the example in [How to stream XML fragments with access to header information (C#)](./how-to-stream-xml-fragments-with-access-to-header-information.md). - - This example uses the capability of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to write elements to an . This example can transform a very large document while maintaining a small memory footprint. - - Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would either validate the source document with an XSD, or would be prepared to parse an invalid document. - - This example uses the same source document, Source.xml, as the previous example in this topic. It also produces exactly the same output. - - Using for streaming the output XML is preferred over writing to an . - -```csharp -static IEnumerable StreamCustomerItem(string uri) -{ - using (XmlReader reader = XmlReader.Create(uri)) - { - XElement name = null; - XElement item = null; - - reader.MoveToContent(); - - // Parse the file, save header information when encountered, and yield the - // Item XElement objects as they are created. - - // loop through Customer elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Customer") - { - // move to Name element - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element && - reader.Name == "Name") - { - name = XElement.ReadFrom(reader) as XElement; - break; - } - } - - // loop through Item elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.EndElement) - break; - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Item") - { - item = XElement.ReadFrom(reader) as XElement; - if (item != null) { - XElement tempRoot = new XElement("Root", - new XElement(name) - ); - tempRoot.Add(item); - yield return item; - } - } - } - } - } - } -} - -static void Main(string[] args) -{ - IEnumerable srcTree = - from el in StreamCustomerItem("Source.xml") - select new XElement("Item", - new XElement("Customer", (string)el.Parent.Element("Name")), - new XElement(el.Element("Key")) - ); - XmlWriterSettings xws = new XmlWriterSettings(); - xws.OmitXmlDeclaration = true; - xws.Indent = true; - using (XmlWriter xw = XmlWriter.Create("Output.xml", xws)) { - xw.WriteStartElement("Root"); - foreach (XElement el in srcTree) - el.WriteTo(xw); - xw.WriteEndElement(); - } - - string str = File.ReadAllText("Output.xml"); - Console.WriteLine(str); -} -``` - - This code produces the following output: - -```xml - - - A. Datum Corporation - 0001 - - - A. Datum Corporation - 0002 - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - - Fabrikam, Inc. - 0008 - - - Southridge Video - 0009 - - - Southridge Video - 0010 - - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md b/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md deleted file mode 100644 index e05caa9bc4db4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md +++ /dev/null @@ -1,112 +0,0 @@ ---- -title: "How to populate an XML tree from the file system (C#)" -description: Learn how to populate an XML tree from the file system in C#. This example populates an XML, then queries the tree to calculate the total size of all files. -ms.date: 07/20/2015 -ms.assetid: 2aa2ccac-4a22-47ae-9107-3bb8df232576 ---- -# How to populate an XML tree from the file system (C#) -A common and useful application of XML trees is as a hierarchical name/value data store. You can populate an XML tree with hierarchical data, and then query it, transform it, and if necessary, serialize it. In this usage scenario, many of the XML specific semantics, such as namespaces and white space behavior, are not important. Instead, you are using the XML tree as a small, in memory, single user hierarchical database. - -## Example - The following example populates an XML tree from the local file system using recursion. It then queries the tree, calculating the total of the sizes of all files in the tree. - -```csharp -class Program -{ - static XElement CreateFileSystemXmlTree(string source) - { - DirectoryInfo di = new DirectoryInfo(source); - return new XElement("Dir", - new XAttribute("Name", di.Name), - from d in Directory.GetDirectories(source) - select CreateFileSystemXmlTree(d), - from fi in di.GetFiles() - select new XElement("File", - new XElement("Name", fi.Name), - new XElement("Length", fi.Length) - ) - ); - } - - static void Main(string[] args) - { - XElement fileSystemTree = CreateFileSystemXmlTree("C:/Tmp"); - Console.WriteLine(fileSystemTree); - Console.WriteLine("------"); - long totalFileSize = - (from f in fileSystemTree.Descendants("File") - select (long)f.Element("Length")).Sum(); - Console.WriteLine("Total File Size:{0}", totalFileSize); - } -} -``` - - This example produces output similar to the following: - -```xml - - - - - - ConsoleApplication1.exe - 4608 - - - ConsoleApplication1.pdb - 11776 - - - ConsoleApplication1.vshost.exe - 9568 - - - ConsoleApplication1.vshost.exe.manifest - 473 - - - - - - - - ConsoleApplication1.csproj.FileListAbsolute.txt - 322 - - - ConsoleApplication1.exe - 4608 - - - ConsoleApplication1.pdb - 11776 - - - - - - AssemblyInfo.cs - 1454 - - - - ConsoleApplication1.csproj - 2546 - - - ConsoleApplication1.sln - 937 - - - ConsoleApplication1.suo - 10752 - - - Program.cs - 269 - - - ------- -Total File Size:59089 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md deleted file mode 100644 index cbb662368bc56..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: "How to populate an XML tree with an XmlWriter (LINQ to XML) (C#)" -description: Learn how to populate an XML tree by using CreateWriter to create an XmlWriter, and then write to the XmlWriter in LINQ to XML in C#. -ms.date: 07/20/2015 -ms.assetid: cd5674d1-5c54-4efc-ba68-e23b2875295f ---- -# How to populate an XML tree with an XmlWriter (LINQ to XML) (C#) -One way to populate an XML tree is to use to create an , and then write to the . The XML tree is populated with all nodes that are written to the . - - You would typically use this method when you use [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] with another class that expects to write to an , such as . - -## Example - One possible use for is when invoking an XSLT transformation. This example creates an XML tree, creates an from the XML tree, creates a new document, and then creates an to write into the new document. It then invokes the XSLT transformation, passing in and . After the transformation successfully completes, the new XML tree is populated with the results of the transformation. - -```csharp -string xslMarkup = @" - - - - - - - - - - - -"; - -XDocument xmlTree = new XDocument( - new XElement("Parent", - new XElement("Child1", "Child1 data"), - new XElement("Child2", "Child2 data") - ) -); - -XDocument newTree = new XDocument(); -using (XmlWriter writer = newTree.CreateWriter()) -{ - // Load the style sheet. - XslCompiledTransform xslt = new XslCompiledTransform(); - xslt.Load(XmlReader.Create(new StringReader(xslMarkup))); - - // Execute the transformation and output the results to a writer. - xslt.Transform(xmlTree.CreateReader(), writer); -} - -Console.WriteLine(newTree); -``` - - This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- -- -- -- [Creating XML Trees (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md deleted file mode 100644 index ae99b7f4c66bc..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "How to project a new type (LINQ to XML) (C#)" -description: Learn how to create queries in LINQ to XML in C# that return IEnumerable of types besides XElement, string, or int, which are described in other examples. -ms.date: 07/20/2015 -ms.assetid: 48145cf9-1e0b-4e73-bbfd-28fc04800dc4 ---- -# How to project a new type (LINQ to XML) (C#) - -Other examples in this section have shown queries that return results as of , of `string`, and of `int`. These are common result types, but they are not appropriate for every scenario. In many cases you will want your queries to return an of some other type. - -## Example - -This example shows how to instantiate objects in the `select` clause. The code first defines a new class with a constructor, and then modifies the `select` statement so that the expression is a new instance of the new class. - -This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -class NameQty -{ - public string name; - public int qty; - public NameQty(string n, int q) - { - name = n; - qty = q; - } -}; - -class Program { - public static void Main() - { - XElement po = XElement.Load("PurchaseOrder.xml"); - - IEnumerable nqList = - from n in po.Descendants("Item") - select new NameQty( - (string)n.Element("ProductName"), - (int)n.Element("Quantity") - ); - - foreach (NameQty n in nqList) - Console.WriteLine(n.name + ":" + n.qty); - } -} -``` - -This example uses the method that was introduced in the topic [How to retrieve a single child element (LINQ to XML) (C#)](how-to-retrieve-a-single-child-element-linq-to-xml.md). It also uses casts to retrieve the values of the elements that are returned by the method. - -This example produces the following output: - -```output -Lawnmower:1 -Baby Monitor:2 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md b/docs/csharp/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md deleted file mode 100644 index b5e8ff45245e9..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "How to project an anonymous type (C#)" -description: Learn how to project a query to an anonymous type in C#. Using an anonymous type can be easier than creating a new type to use only briefly. -ms.date: 07/20/2015 -ms.assetid: 5cb9be13-5ac4-4373-a034-b3520a5b2dec ---- -# How to project an anonymous type (C#) -In some cases you might want to project a query to a new type, even though you know you will only use this type for a short while. It is a lot of extra work to create a new type just to use in the projection. A more efficient approach in this case is to project to an anonymous type. Anonymous types allow you to define a class, then declare and initialize an object of that class, without giving the class a name. - - Anonymous types are the C# implementation of the mathematical concept of a *tuple*. The mathematical term tuple originated from the sequence single, double, triple, quadruple, quintuple, n-tuple. It refers to a finite sequence of objects, each of a specific type. Sometimes this is called a list of name/value pairs. For example, the contents of an address in the [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md) XML document could be expressed as follows: - -```text -Name: Ellen Adams -Street: 123 Maple Street -City: Mill Valley -State: CA -Zip: 90952 -Country: USA -``` - - When you create an instance of an anonymous type, it is convenient to think of it as creating a tuple of order n. If you write a query that creates a tuple in the `select` clause, the query returns an `IEnumerable` of the tuple. - -## Example - In this example, the `select` clause projects an anonymous type. The example then uses `var` to create the `IEnumerable` object. Within the `foreach` loop, the iteration variable becomes an instance of the anonymous type created in the query expression. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -XElement custOrd = XElement.Load("CustomersOrders.xml"); -var custList = - from el in custOrd.Element("Customers").Elements("Customer") - select new { - CustomerID = (string)el.Attribute("CustomerID"), - CompanyName = (string)el.Element("CompanyName"), - ContactName = (string)el.Element("ContactName") - }; -foreach (var cust in custList) - Console.WriteLine("{0}:{1}:{2}", cust.CustomerID, cust.CompanyName, cust.ContactName); -``` - - This code produces the following output: - -```output -GREAL:Great Lakes Food Market:Howard Snyder -HUNGC:Hungry Coyote Import Store:Yoshi Latimer -LAZYK:Lazy K Kountry Store:John Steel -LETSS:Let's Stop N Shop:Jaime Yorres -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-project-an-object-graph.md b/docs/csharp/programming-guide/concepts/linq/how-to-project-an-object-graph.md deleted file mode 100644 index 01b8dbb310252..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-project-an-object-graph.md +++ /dev/null @@ -1,256 +0,0 @@ ---- -title: "How to project an object graph (C#)" -description: Learn how to project, or populate, an object graph from XML in C#. The example code populates an object graph with classes from a sample XML file. -ms.date: 07/20/2015 -ms.assetid: 293d15d5-3eaf-48de-9a02-3e13cb117b5b ---- -# How to project an object graph (C#) -This topic illustrates how to project, or populate, an object graph from XML. - -## Example - The following code populates an object graph with the `Address`, `PurchaseOrder`, and `PurchaseOrderItem` classes from the [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md) XML document. - -```csharp -class Address -{ - public enum AddressUse - { - Shipping, - Billing, - } - - private AddressUse addressType; - private string name; - private string street; - private string city; - private string state; - private string zip; - private string country; - - public AddressUse AddressType { - get { return addressType; } set { addressType = value; } - } - - public string Name { - get { return name; } set { name = value; } - } - - public string Street { - get { return street; } set { street = value; } - } - - public string City { - get { return city; } set { city = value; } - } - - public string State { - get { return state; } set { state = value; } - } - - public string Zip { - get { return zip; } set { zip = value; } - } - - public string Country { - get { return country; } set { country = value; } - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append($"Type: {(addressType == AddressUse.Shipping ? "Shipping" : "Billing")}\n"); - sb.Append($"Name: {name}\n"); - sb.Append($"Street: {street}\n"); - sb.Append($"City: {city}\n"); - sb.Append($"State: {state}\n"); - sb.Append($"Zip: {zip}\n"); - sb.Append($"Country: {country}\n"); - return sb.ToString(); - } -} - -class PurchaseOrderItem -{ - private string partNumber; - private string productName; - private int quantity; - private Decimal usPrice; - private string comment; - private DateTime shipDate; - - public string PartNumber { - get { return partNumber; } set { partNumber = value; } - } - - public string ProductName { - get { return productName; } set { productName = value; } - } - - public int Quantity { - get { return quantity; } set { quantity = value; } - } - - public Decimal USPrice { - get { return usPrice; } set { usPrice = value; } - } - - public string Comment { - get { return comment; } set { comment = value; } - } - - public DateTime ShipDate { - get { return shipDate; } set { shipDate = value; } - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append($"PartNumber: {partNumber}\n"); - sb.Append($"ProductName: {productName}\n"); - sb.Append($"Quantity: {quantity}\n"); - sb.Append($"USPrice: {usPrice}\n"); - if (comment != null) - sb.Append($"Comment: {comment}\n"); - if (shipDate != DateTime.MinValue) - sb.Append($"ShipDate: {shipDate:d}\n"); - return sb.ToString(); - } -} - -class PurchaseOrder -{ - private string purchaseOrderNumber; - private DateTime orderDate; - private string comment; - private List
addresses; - private List items; - - public string PurchaseOrderNumber { - get { return purchaseOrderNumber; } set { purchaseOrderNumber = value; } - } - - public DateTime OrderDate { - get { return orderDate; } set { orderDate = value; } - } - - public string Comment { - get { return comment; } set { comment = value; } - } - - public List
Addresses { - get { return addresses; } set { addresses = value; } - } - - public List Items { - get { return items; } set { items = value; } - } - - public override string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append($"PurchaseOrderNumber: {purchaseOrderNumber}\n"); - sb.Append($"OrderDate: {orderDate:d}\n"); - sb.Append("\n"); - sb.Append("Addresses\n"); - sb.Append("=====\n"); - foreach (Address address in addresses) - { - sb.Append(address); - sb.Append("\n"); - } - sb.Append("Items\n"); - sb.Append("=====\n"); - foreach (PurchaseOrderItem item in items) - { - sb.Append(item); - sb.Append("\n"); - } - return sb.ToString(); - } -} - -class Program { - public static void Main() - { - XElement po = XElement.Load("PurchaseOrder.xml"); - PurchaseOrder purchaseOrder = new PurchaseOrder { - PurchaseOrderNumber = (string)po.Attribute("PurchaseOrderNumber"), - OrderDate = (DateTime)po.Attribute("OrderDate"), - Addresses = ( - from a in po.Elements("Address") - select new Address { - AddressType = ((string)a.Attribute("Type") == "Shipping") ? - Address.AddressUse.Shipping : - Address.AddressUse.Billing, - Name = (string)a.Element("Name"), - Street = (string)a.Element("Street"), - City = (string)a.Element("City"), - State = (string)a.Element("State"), - Zip = (string)a.Element("Zip"), - Country = (string)a.Element("Country") - } - ).ToList(), - Items = ( - from i in po.Element("Items").Elements("Item") - select new PurchaseOrderItem { - PartNumber = (string)i.Attribute("PartNumber"), - ProductName = (string)i.Element("ProductName"), - Quantity = (int)i.Element("Quantity"), - USPrice = (Decimal)i.Element("USPrice"), - Comment = (string)i.Element("Comment"), - ShipDate = (i.Element("ShipDate") != null) ? - (DateTime)i.Element("ShipDate") : - DateTime.MinValue - } - ).ToList() - }; - Console.WriteLine(purchaseOrder); - } -} -``` - - In this example, the result of the LINQ query is returned as an of `PurchaseOrderItem`. The items in the `PurchaseOrder` class are of type of `PurchaseOrderItem`. The code uses the extension method to create a collection from the results of the query. - - The example produces the following output: - -```output -PurchaseOrderNumber: 99503 -OrderDate: 10/20/1999 - -Addresses -===== -Type: Shipping -Name: Ellen Adams -Street: 123 Maple Street -City: Mill Valley -State: CA -Zip: 10999 -Country: USA - -Type: Billing -Name: Tai Yee -Street: 8 Oak Avenue -City: Old Town -State: PA -Zip: 95819 -Country: USA - -Items -===== -PartNumber: 872-AA -ProductName: Lawnmower -Quantity: 1 -USPrice: 148.95 -Comment: Confirm this is electric - -PartNumber: 926-AA -ProductName: Baby Monitor -Quantity: 2 -USPrice: 39.98 -ShipDate: 5/21/1999 -``` - -## See also - -- -- diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md b/docs/csharp/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md deleted file mode 100644 index 2d7d3dc4aa280..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "How to query LINQ to XML using XPath (C#)" -description: You can use extension methods in C# to query an XML tree by using XPath. In general, we do not recommend using XPath with LINQ to XML. -ms.date: 07/20/2015 -ms.assetid: ee5af263-4ab1-45e5-b792-33a3221b426d ---- -# How to query LINQ to XML using XPath (C#) -This topic introduces the extension methods that enable you to query an XML tree by using XPath. For detailed information about using these extension methods, see . - - Unless you have a very specific reason for querying using XPath, such as extensive use of legacy code, using XPath with LINQ to XML is not recommended. XPath queries will not perform as well as [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. - -## Example - The following example creates a small XML tree and uses to select a set of elements. - -```csharp -XElement root = new XElement("Root", - new XElement("Child1", 1), - new XElement("Child1", 2), - new XElement("Child1", 3), - new XElement("Child2", 4), - new XElement("Child2", 5), - new XElement("Child2", 6) -); -IEnumerable list = root.XPathSelectElements("./Child2"); -foreach (XElement el in list) - Console.WriteLine(el); -``` - - This example produces the following output: - -```xml -4 -5 -6 -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md b/docs/csharp/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md deleted file mode 100644 index 4fc7d95589c7c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: "How to read and write an encoded document (C#)" -description: Learn how to create an encoded XML document in C# by adding an XDeclaration to the XML tree and setting the encoding to the desired code page name. -ms.date: 07/20/2015 -ms.assetid: 84f64e71-39a6-42c6-ad68-f052bb158a03 ---- -# How to read and write an encoded document (C#) -To create an encoded XML document, you add an to the XML tree, setting the encoding to the desired code page name. - - Any value returned by is a valid value. - - If you read an encoded document, the property will be set to the code page name. - - If you set to a valid code page name, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] will serialize with the specified encoding. - -## Example - The following example creates two documents, one with utf-8 encoding, and one with utf-16 encoding. It then loads the documents and prints the encoding to the console. - -```csharp -Console.WriteLine("Creating a document with utf-8 encoding"); -XDocument encodedDoc8 = new XDocument( - new XDeclaration("1.0", "utf-8", "yes"), - new XElement("Root", "Content") -); -encodedDoc8.Save("EncodedUtf8.xml"); -Console.WriteLine("Encoding is:{0}", encodedDoc8.Declaration.Encoding); -Console.WriteLine(); - -Console.WriteLine("Creating a document with utf-16 encoding"); -XDocument encodedDoc16 = new XDocument( - new XDeclaration("1.0", "utf-16", "yes"), - new XElement("Root", "Content") -); -encodedDoc16.Save("EncodedUtf16.xml"); -Console.WriteLine("Encoding is:{0}", encodedDoc16.Declaration.Encoding); -Console.WriteLine(); - -XDocument newDoc8 = XDocument.Load("EncodedUtf8.xml"); -Console.WriteLine("Encoded document:"); -Console.WriteLine(File.ReadAllText("EncodedUtf8.xml")); -Console.WriteLine(); -Console.WriteLine("Encoding of loaded document is:{0}", newDoc8.Declaration.Encoding); -Console.WriteLine(); - -XDocument newDoc16 = XDocument.Load("EncodedUtf16.xml"); -Console.WriteLine("Encoded document:"); -Console.WriteLine(File.ReadAllText("EncodedUtf16.xml")); -Console.WriteLine(); -Console.WriteLine("Encoding of loaded document is:{0}", newDoc16.Declaration.Encoding); -``` - - This example produces the following output: - -```output -Creating a document with utf-8 encoding -Encoding is:utf-8 - -Creating a document with utf-16 encoding -Encoding is:utf-16 - -Encoded document: - -Content - -Encoding of loaded document is:utf-8 - -Encoded document: - -Content - -Encoding of loaded document is:utf-16 -``` - -## See also - -- diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md deleted file mode 100644 index b7a9b596fb531..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "How to retrieve a collection of attributes (LINQ to XML) (C#)" -description: The Attributes method in C# retrieves the attributes of an element. This LINQ to XML example iterates through the collection of attributes of an element. -ms.date: 07/20/2015 -ms.assetid: a49ee7a3-b2c2-4d49-9b5c-b7c6c41f4f13 ---- -# How to retrieve a collection of attributes (LINQ to XML) (C#) -This topic introduces the method. This method retrieves the attributes of an element. - -## Example - The following example shows how to iterate through the collection of attributes of an element. - -```csharp -XElement val = new XElement("Value", - new XAttribute("ID", "1243"), - new XAttribute("Type", "int"), - new XAttribute("ConvertableTo", "double"), - "100"); -IEnumerable listOfAttributes = - from att in val.Attributes() - select att; -foreach (XAttribute a in listOfAttributes) - Console.WriteLine(a); -``` - - This code produces the following output: - -```output -ID="1243" -Type="int" -ConvertableTo="double" -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md deleted file mode 100644 index bff1ed4df476c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "How to retrieve a collection of elements (LINQ to XML) (C#)" -description: The Elements method in C# retrieves a collection of the child elements of an element. This LINQ to XML example iterates through child elements of an element. -ms.date: 07/20/2015 -ms.assetid: b849668c-7976-4974-b8e1-1cd587d34258 ---- -# How to retrieve a collection of elements (LINQ to XML) (C#) -This topic demonstrates the method. This method retrieves a collection of the child elements of an element. - -## Example - This example iterates through the child elements of the `purchaseOrder` element. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -XElement po = XElement.Load("PurchaseOrder.xml"); -IEnumerable childElements = - from el in po.Elements() - select el; -foreach (XElement el in childElements) - Console.WriteLine("Name: " + el.Name); -``` - - This example produces the following output. - -```output -Name: Address -Name: Address -Name: DeliveryNotes -Name: Items -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md deleted file mode 100644 index f39add044e47a..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: "How to retrieve a single attribute (LINQ to XML) (C#)" -description: Learn how to use LINQ to XML retrieve a single attribute of an element in C#, given the attribute name. -ms.date: 07/20/2015 -ms.assetid: 1b6b07b9-933f-47e9-874e-e790cab49dc5 ---- -# How to retrieve a single attribute (LINQ to XML) (C#) -This topic explains how to retrieve a single attribute of an element, given the attribute name. This is useful for writing query expressions where you want to find an element that has a particular attribute. - - The method of the class returns the with the specified name. - -## Example - The following example uses the method. - -```csharp -XElement cust = new XElement("PhoneNumbers", - new XElement("Phone", - new XAttribute("type", "home"), - "555-555-5555"), - new XElement("Phone", - new XAttribute("type", "work"), - "555-555-6666") -); -IEnumerable elList = - from el in cust.Descendants("Phone") - select el; -foreach (XElement el in elList) - Console.WriteLine((string)el.Attribute("type")); -``` - - This example finds all the descendants in the tree named `Phone`, and then finds the attribute named `type`. - - This code produces the following output: - -```output -home -work -``` - -## Example - If you want to retrieve the value of the attribute, you can cast it, just as you do for with objects. The following example demonstrates this. - -```csharp -XElement cust = new XElement("PhoneNumbers", - new XElement("Phone", - new XAttribute("type", "home"), - "555-555-5555"), - new XElement("Phone", - new XAttribute("type", "work"), - "555-555-6666") -); -IEnumerable elList = - from el in cust.Descendants("Phone") - select el; -foreach (XElement el in elList) - Console.WriteLine((string)el.Attribute("type")); -``` - - This code produces the following output: - -```output -home -work -``` - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides explicit cast operators for the class to `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. - -## Example - The following example shows the same code for an attribute that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement cust = new XElement(aw + "PhoneNumbers", - new XElement(aw + "Phone", - new XAttribute(aw + "type", "home"), - "555-555-5555"), - new XElement(aw + "Phone", - new XAttribute(aw + "type", "work"), - "555-555-6666") -); -IEnumerable elList = - from el in cust.Descendants(aw + "Phone") - select el; -foreach (XElement el in elList) - Console.WriteLine((string)el.Attribute(aw + "type")); -``` - - This code produces the following output: - -```output -home -work -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md deleted file mode 100644 index 0582e8e39b2b7..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "How to retrieve a single child element (LINQ to XML) (C#)" -description: Learn how to use LINQ to XML to retrieve a single child element by name. In this C# example, the Element method returns the first specified child element. -ms.date: 07/20/2015 -ms.assetid: ce37db9e-76fa-46eb-b4cc-e8f32d22ad90 ---- -# How to retrieve a single child element (LINQ to XML) (C#) -This topic explains how to retrieve a single child element, given the name of the child element. When you know the name of the child element and that there is only one element that has this name, it can be convenient to retrieve just one element, instead of a collection. - - The method returns the first child with the specified . - - If you want to retrieve a single child element in Visual Basic, a common approach is to use the XML property, and then retrieve the first element using array indexer notation. - -## Example - The following example demonstrates the use of the method. This example takes the XML tree named `po` and finds the first element named `Comment`. - - The Visual Basic example shows using array indexer notation to retrieve a single element. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -XElement po = XElement.Load("PurchaseOrder.xml"); -XElement e = po.Element("DeliveryNotes"); -Console.WriteLine(e); -``` - - This example produces the following output: - -```xml -Please leave packages in shed by driveway. -``` - -## Example - The following example shows the same code for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](./sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```csharp -XElement po = XElement.Load("PurchaseOrderInNamespace.xml"); -XNamespace aw = "http://www.adventure-works.com"; -XElement e = po.Element(aw + "DeliveryNotes"); -Console.WriteLine(e); -``` - - This example produces the following output: - -```xml -Please leave packages in shed by driveway. -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md deleted file mode 100644 index dde3348d386ff..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: "How to retrieve paragraphs from an Office Open XML document (C#)" -description: Learn how to retrieve a collection of paragraphs from an Office Open XML document. See an example that uses the 'StringConcatenate' extension method. -ms.date: 07/20/2015 -ms.assetid: cc2687cf-d648-451e-88ac-3847c6c967c8 ---- -# How to retrieve paragraphs from an Office Open XML document (C#) -This topic presents an example that opens an Office Open XML document, and retrieves a collection of all of the paragraphs in the document. - - For more information on Office Open XML, see [Open XML SDK](https://github.com/OfficeDev/Open-XML-SDK) and [www.ericwhite.com](http://ericwhite.com/). - -## Example - This example opens an Office Open XML package, uses the relationships within the Open XML package to find the document and the style parts. It then queries the document, projecting a collection of an anonymous type that contains the paragraph node, the style name of each paragraph, and the text of each paragraph. - - The example uses an extension method named `StringConcatenate`, which is also supplied in the example. - - For a detailed tutorial that explains how this example works, see [Pure Functional Transformations of XML (C#)](./introduction-to-pure-functional-transformations.md). - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = - wdPackage - .GetRelationshipsByType(documentRelationshipType) - .FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = - PackUriHelper - .ResolvePartUri( - new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = - wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType) - .FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = ParagraphText(para.ParagraphNode) - }; - - foreach (var p in paraWithText) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); - } -} -``` - - When run with the sample Open XML document described in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md), this example produces the following output: - -```output -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >using System;< -StyleName:Code >< -StyleName:Code >class Program {< -StyleName:Code > public static void (string[] args) {< -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code > }< -StyleName:Code >}< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md deleted file mode 100644 index 3f5703e5f6ce4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "How to retrieve the shallow value of an element (C#)" -description: Learn how to get the shallow value of an element. The shallow value is for the specific element only. -ms.date: 07/20/2015 -ms.assetid: 924a2699-72f6-4be1-aaa6-de62f8ec73b9 ---- -# How to retrieve the shallow value of an element (C#) -This topic shows how to get the shallow value of an element. The shallow value is the value of the specific element only, as opposed to the deep value, which includes the values of all descendent elements concatenated into a single string. - - When you retrieve an element value by using either casting or the property, you retrieve the deep value. To retrieve the shallow value, you can use the `ShallowValue` extension method, as shown in the following example. Retrieving the shallow value is useful when you want to select elements based on their content. - - The following example declares an extension method that retrieves the shallow value of an element. It then uses the extension method in a query to list all elements that contain a calculated value. - -## Example - The following text file, Report.xml, is the source for this example. - -```xml - - -
- - =Customer.CustomerId.Heading - =Customer.Name.Heading - - - =Customer.CustomerId - =Customer.Name - -
-
-``` - -```csharp -public static class MyExtensions -{ - public static string ShallowValue(this XElement xe) - { - return xe - .Nodes() - .OfType() - .Aggregate(new StringBuilder(), - (s, c) => s.Append(c), - s => s.ToString()); - } -} - -class Program -{ - static void Main(string[] args) - { - XElement root = XElement.Load("Report.xml"); - - IEnumerable query = from el in root.Descendants() - where el.ShallowValue().StartsWith("=") - select el; - - foreach (var q in query) - { - Console.WriteLine("{0}{1}{2}", - q.Name.ToString().PadRight(8), - q.Attribute("Name").ToString().PadRight(20), - q.ShallowValue()); - } - } -} -``` - - This example produces the following output: - -```output -Column Name="CustomerId" =Customer.CustomerId.Heading -Column Name="Name" =Customer.Name.Heading -Column Name="CustomerId" =Customer.CustomerId -Column Name="Name" =Customer.Name -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md deleted file mode 100644 index ca582afbff4b5..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "How to retrieve the value of an attribute (LINQ to XML) (C#)" -description: Learn how to get the value of an attribute. See code examples and view additional available resources. -ms.date: 07/20/2015 -ms.assetid: 817bbe89-5979-4234-bf0c-46f63692ac8c ---- -# How to retrieve the value of an attribute (LINQ to XML) (C#) -This topic shows how to obtain the value of attributes. There are two main ways: You can cast an to the desired type; the explicit conversion operator then converts the contents of the element or attribute to the specified type. Alternatively, you can use the property. However, casting is generally the better approach. If you cast the attribute to a nullable value type, the code is simpler to write when retrieving the value of an attribute that might or might not exist. For examples of this technique, see [How to retrieve the value of an element (LINQ to XML) (C#)](./how-to-retrieve-the-value-of-an-element-linq-to-xml.md). - -## Example - To retrieve the value of an attribute, you just cast the object to your desired type. - -```csharp -XElement root = new XElement("Root", - new XAttribute("Attr", "abcde") - ); -Console.WriteLine(root); -string str = (string)root.Attribute("Attr"); -Console.WriteLine(str); -``` - - This example produces the following output: - -```output - -abcde -``` - -## Example - The following example shows how to retrieve the value of an attribute where the attribute is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement root = new XElement(aw + "Root", - new XAttribute(aw + "Attr", "abcde") - ); -string str = (string)root.Attribute(aw + "Attr"); -Console.WriteLine(str); -``` - - This example produces the following output: - -```output -abcde -``` - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md deleted file mode 100644 index cecf15c1eba80..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md +++ /dev/null @@ -1,150 +0,0 @@ ---- -title: "How to retrieve the value of an element (LINQ to XML) (C#)" -description: Learn how to get the value of elements. See examples using string casting, integer casting, and the Value property. -ms.date: 07/20/2015 -ms.assetid: 4228c007-07c9-4cf2-a45b-e7074c109581 ---- -# How to retrieve the value of an element (LINQ to XML) (C#) - -This article shows how to get the value of elements. There are two main ways to get the value: - -- Cast an or an to the desired type. The explicit conversion operator then converts the contents of the element or attribute to the specified type and assigns it to your variable. - -- Use the or properties. You can also set the value using these properties. - -With C#, casting is generally the better approach. If you cast the element or attribute to a nullable value type, the code is simpler to write when retrieving the value of an element (or attribute) that might or might not exist. The [last example](#element-might-not-exist-example) in this article demonstrates that casting is simpler in the case where the element might not exist. However, you cannot set the contents of an element through casting, as you can through property. - -## String cast example - To retrieve the value of an element, cast the object to your desired type. You can cast an element to a string, as follows: - -```csharp -XElement e = new XElement("StringElement", "abcde"); -Console.WriteLine(e); -Console.WriteLine("Value of e:" + (string)e); -``` - - This example produces the following output: - -```output -abcde -Value of e:abcde -``` - -## Integer cast example - You can also cast elements to types other than string. For example, if you have an element that contains an integer, you can cast it to `int`, as shown in the following code: - -```csharp -XElement e = new XElement("Age", "44"); -Console.WriteLine(e); -Console.WriteLine("Value of e:" + (int)e); -``` - - This example produces the following output: - -```output -44 -Value of e:44 -``` - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides explicit cast operators for the following data types: `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides the same cast operators for objects. - -## Value property example - You can use the property to retrieve the contents of an element: - -```csharp -XElement e = new XElement("StringElement", "abcde"); -Console.WriteLine(e); -Console.WriteLine("Value of e:" + e.Value); -``` - - This example produces the following output: - -```output -abcde -Value of e:abcde -``` - -## Element might not exist example - Sometimes you try to retrieve the value of an element even though you're not sure if it exists. In this case, when you assign the casted element to a nullable reference type or nullable value type, if the element does not exist, the assigned variable is set to `null`. The following code shows that when the element might or might not exist, it is easier to use casting than to use the property. - -```csharp -XElement root = new XElement("Root", - new XElement("Child1", "child 1 content"), - new XElement("Child2", "2") -); - -// The following assignments show why it is easier to use -// casting when the element might or might not exist. - -string c1 = (string)root.Element("Child1"); -Console.WriteLine("c1:{0}", c1 == null ? "element does not exist" : c1); - -int? c2 = (int?)root.Element("Child2"); -Console.WriteLine("c2:{0}", c2 == null ? "element does not exist" : c2.ToString()); - -string c3 = (string)root.Element("Child3"); -Console.WriteLine("c3:{0}", c3 == null ? "element does not exist" : c3); - -int? c4 = (int?)root.Element("Child4"); -Console.WriteLine("c4:{0}", c4 == null ? "element does not exist" : c4.ToString()); - -Console.WriteLine(); - -// The following assignments show the required code when using -// the Value property when the element might or might not exist. -// Notice that this is more difficult than the casting approach. - -XElement e1 = root.Element("Child1"); -string v1; -if (e1 == null) - v1 = null; -else - v1 = e1.Value; -Console.WriteLine("v1:{0}", v1 == null ? "element does not exist" : v1); - -XElement e2 = root.Element("Child2"); -int? v2; -if (e2 == null) - v2 = null; -else - v2 = Int32.Parse(e2.Value); -Console.WriteLine("v2:{0}", v2 == null ? "element does not exist" : v2.ToString()); - -XElement e3 = root.Element("Child3"); -string v3; -if (e3 == null) - v3 = null; -else - v3 = e3.Value; -Console.WriteLine("v3:{0}", v3 == null ? "element does not exist" : v3); - -XElement e4 = root.Element("Child4"); -int? v4; -if (e4 == null) - v4 = null; -else - v4 = Int32.Parse(e4.Value); -Console.WriteLine("v4:{0}", v4 == null ? "element does not exist" : v4.ToString()); -``` - - This code produces the following output: - -```output -c1:child 1 content -c2:2 -c3:element does not exist -c4:element does not exist - -v1:child 1 content -v2:2 -v3:element does not exist -v4:element does not exist -``` - - In general, you can write simpler code when using casting to retrieve the contents of elements and attributes. - -## See also - -- [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md b/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md deleted file mode 100644 index 1a949034160da..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: "How to serialize using DataContractSerializer (C#)" -description: Learn how to serialize objects by using DataContractSerializer. See an example that creates objects, serializes them to text files, and then deserializes them. -ms.date: 07/20/2015 -ms.assetid: 3320ecbf-cdbe-480e-979c-2c14bbef9988 ---- -# How to serialize using DataContractSerializer (C#) -This topic shows an example that serializes and deserializes using . - -## Example - The following example creates a number of objects that contain objects. It then serializes them to text files, and then deserializes them from the text files. - -```csharp -using System; -using System.Xml; -using System.Xml.Linq; -using System.IO; -using System.Runtime.Serialization; - -public class XLinqTest -{ - public static void Main() - { - Test(CreateXElement()); - Test(new XElementContainer()); - Test(new XElementNullContainer()); - } - - public static void Test(T obj) - { - DataContractSerializer s = new DataContractSerializer(typeof(T)); - using (FileStream fs = File.Open("test" + typeof(T).Name + ".xml", FileMode.Create)) - { - Console.WriteLine("Testing for type: {0}", typeof(T)); - s.WriteObject(fs, obj); - } - using (FileStream fs = File.Open("test" + typeof(T).Name + ".xml", FileMode.Open)) - { - object s2 = s.ReadObject(fs); - if (s2 == null) - Console.WriteLine(" Deserialized object is null (Nothing in VB)"); - else - Console.WriteLine(" Deserialized type: {0}", s2.GetType()); - } - } - - public static XElement CreateXElement() - { - return new XElement(XName.Get("NameInNamespace", "http://www.adventure-works.org")); - } -} - -[DataContract] -public class XElementContainer -{ - [DataMember] - public XElement member; - - public XElementContainer() - { - member = XLinqTest.CreateXElement(); - } -} - -[DataContract] -public class XElementNullContainer -{ - [DataMember] - public XElement member; - - public XElementNullContainer() - { - member = null; - } -} -``` - - This example produces the following output: - -```output -Testing for type: System.Xml.Linq.XElement - Deserialized type: System.Xml.Linq.XElement -Testing for type: XElementContainer - Deserialized type: XElementContainer -Testing for type: XElementNullContainer - Deserialized type: XElementNullContainer -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md b/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md deleted file mode 100644 index 5b8078511fc24..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "How to serialize using XmlSerializer (C#)" -description: Learn how to serialize objects by using XmlSerializer. See an example that creates objects, serializes them to a memory stream, and then deserializes them. -ms.date: 07/20/2015 -ms.assetid: 2e0a0bbc-c548-4fe2-8741-be5a9ccd0cbb ---- -# How to serialize using XmlSerializer (C#) -This topic shows an example that serializes and deserializes using . - -## Example - The following example creates a number of objects that contain objects. It then serializes them to a memory stream, and then deserializes them from the memory stream. - -```csharp -using System; -using System.IO; -using System.Linq; -using System.Xml; -using System.Xml.Serialization; -using System.Xml.Linq; - -public class XElementContainer -{ - public XElement member; - - public XElementContainer() - { - member = XLinqTest.CreateXElement(); - } - - public override string ToString() - { - return member.ToString(); - } -} - -public class XElementNullContainer -{ - public XElement member; - - public XElementNullContainer() - { - } -} - -class XLinqTest -{ - static void Main(string[] args) - { - Test(new XElementNullContainer()); - Test(CreateXElement()); - Test(new XElementContainer()); - } - - public static XElement CreateXElement() - { - XNamespace ns = "http://www.adventure-works.com"; - return new XElement(ns + "aw"); - } - - static void Test(T obj) - { - using (MemoryStream stream = new MemoryStream()) - { - XmlSerializer s = new XmlSerializer(typeof(T)); - Console.WriteLine("Testing for type: {0}", typeof(T)); - s.Serialize(XmlWriter.Create(stream), obj); - stream.Flush(); - stream.Seek(0, SeekOrigin.Begin); - object o = s.Deserialize(XmlReader.Create(stream)); - Console.WriteLine(" Deserialized type: {0}", o.GetType()); - } - } -} -``` - - This example produces the following output: - -```output -Testing for type: XElementNullContainer - Deserialized type: XElementNullContainer -Testing for type: System.Xml.Linq.XElement - Deserialized type: System.Xml.Linq.XElement -Testing for type: XElementContainer - Deserialized type: XElementContainer -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-sort-elements.md b/docs/csharp/programming-guide/concepts/linq/how-to-sort-elements.md deleted file mode 100644 index 63bd99b5df784..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-sort-elements.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: "How to sort elements (C#)" -description: Learn how to sort elements. See examples of how to write a query that sorts its results in an XML document. -ms.date: 07/20/2015 -ms.assetid: aee6fbbc-81fd-4b3e-b40f-6ed7b3bd3fee ---- -# How to sort elements (C#) -This example shows how to write a query that sorts its results. - -## Example - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](./sample-xml-file-numerical-data-linq-to-xml.md). - -```csharp -XElement root = XElement.Load("Data.xml"); -IEnumerable prices = - from el in root.Elements("Data") - let price = (decimal)el.Element("Price") - orderby price - select price; -foreach (decimal el in prices) - Console.WriteLine(el); -``` - - This code produces the following output: - -```output -0.99 -4.95 -6.99 -24.50 -29.00 -66.00 -89.99 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Numerical Data in a Namespace](./sample-xml-file-numerical-data-in-a-namespace.md). - -```csharp -XElement root = XElement.Load("DataInNamespace.xml"); -XNamespace aw = "http://www.adatum.com"; -IEnumerable prices = - from el in root.Elements(aw + "Data") - let price = (decimal)el.Element(aw + "Price") - orderby price - select price; -foreach (decimal el in prices) - Console.WriteLine(el); -``` - - This code produces the following output: - -```output -0.99 -4.95 -6.99 -24.50 -29.00 -66.00 -89.99 -``` - -## See also - -- [Sorting Data (C#)](./sorting-data.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md b/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md deleted file mode 100644 index df0c5092a6c95..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "How to stream XML fragments from an XmlReader (C#)" -description: Learn how to stream XML fragments from an XmlReader. This method is used for processing large XML files. -ms.date: 07/20/2015 -ms.assetid: 4a8f0e45-768a-42e2-bc5f-68bdf0e0a726 ---- -# How to stream XML fragments from an XmlReader (C#) - -When you have to process large XML files, it might not be feasible to load the whole XML tree into memory. This topic shows how to stream fragments using an . - - One of the most effective ways to use an to read objects is to write your own custom axis method. An axis method typically returns a collection such as of , as shown in the example in this topic. In the custom axis method, after you create the XML fragment by calling the method, return the collection using `yield return`. This provides deferred execution semantics to your custom axis method. - - When you create an XML tree from an object, the must be positioned on an element. The method does not return until it has read the close tag of the element. - - If you want to create a partial tree, you can instantiate an , position the reader on the node that you want to convert to an tree, and then create the object. - -The topic [How to stream XML fragments with access to header information (C#)](./how-to-stream-xml-fragments-with-access-to-header-information.md) contains information and an example on how to stream a more complex document. - - The topic [How to perform streaming transform of large XML documents (C#)](./how-to-perform-streaming-transform-of-large-xml-documents.md) contains an example of using LINQ to XML to transform extremely large XML documents while maintaining a small memory footprint. - -## Example - This example creates a custom axis method. You can query it by using a LINQ query. The custom axis method, `StreamRootChildDoc`, is a method that is designed specifically to read a document that has a repeating `Child` element. - -```csharp -static IEnumerable StreamRootChildDoc(StringReader stringReader) -{ - using (XmlReader reader = XmlReader.Create(stringReader)) - { - reader.MoveToContent(); - // Parse the file and display each of the nodes. - while (reader.Read()) - { - switch (reader.NodeType) - { - case XmlNodeType.Element: - if (reader.Name == "Child") { - XElement el = XElement.ReadFrom(reader) as XElement; - if (el != null) - yield return el; - } - break; - } - } - } -} - -static void Main(string[] args) -{ - string markup = @" - - aaa - - - bbb - - - ccc - - "; - - IEnumerable grandChildData = - from el in StreamRootChildDoc(new StringReader(markup)) - where (int)el.Attribute("Key") > 1 - select (string)el.Element("GrandChild"); - - foreach (string str in grandChildData) { - Console.WriteLine(str); - } -} -``` - - This example produces the following output: - -```output -bbb -ccc -``` - - In this example, the source document is very small. However, even if there were millions of `Child` elements, this example would still have a small memory footprint. diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md b/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md deleted file mode 100644 index 5e4cf6feb059b..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md +++ /dev/null @@ -1,163 +0,0 @@ ---- -title: "How to stream XML fragments with access to header information (C#)" -description: Learn how to stream XML fragments with access to header information. Streaming techniques help avoid excessive memory usage. -ms.date: 07/20/2015 -ms.assetid: 7f242770-b0c7-418d-894b-643215e1f8aa ---- -# How to stream XML fragments with access to header information (C#) -Sometimes you have to read arbitrarily large XML files, and write your application so that the memory footprint of the application is predictable. If you attempt to populate an XML tree with a large XML file, your memory usage will be proportional to the size of the file—that is, excessive. Therefore, you should use a streaming technique instead. - -One option is to write your application using . However, you might want to use LINQ to query the XML tree. If this is the case, you can write your own custom axis method. For more information, see [How to write a LINQ to XML axis method (C#)](./how-to-write-a-linq-to-xml-axis-method.md). - - To write your own axis method, you write a small method that uses the to read nodes until it reaches one of the nodes in which you are interested. The method then calls , which reads from the and instantiates an XML fragment. It then yields each fragment through `yield return` to the method that is enumerating your custom axis method. You can then write LINQ queries on your custom axis method. - - Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. If you use a query operator that materializes its source before yielding the first item, you will not retain a small memory footprint. - -## Example - -Sometimes the problem gets just a little more interesting. In the following XML document, the consumer of your custom axis method also has to know the name of the customer that each item belongs to. - -```xml - - - - A. Datum Corporation - - 0001 - - - 0002 - - - 0003 - - - 0004 - - - - Fabrikam, Inc. - - 0005 - - - 0006 - - - 0007 - - - 0008 - - - - Southridge Video - - 0009 - - - 0010 - - - -``` - - The approach that this example takes is to also watch for this header information, save the header information, and then build a small XML tree that contains both the header information and the detail that you are enumerating. The axis method then yields this new, small XML tree. The query then has access to the header information as well as the detail information. - - This approach has a small memory footprint. As each detail XML fragment is yielded, no references are kept to the previous fragment, and it is available for garbage collection. This technique creates many short lived objects on the heap. - - The following example shows how to implement and use a custom axis method that streams XML fragments from the file specified by the URI. This custom axis is written such that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the above `Source.xml` document. It is a simplistic implementation. A more robust implementation would be prepared to parse an invalid document. - -```csharp -static IEnumerable StreamCustomerItem(string uri) -{ - using (XmlReader reader = XmlReader.Create(uri)) - { - XElement name = null; - XElement item = null; - - reader.MoveToContent(); - - // Parse the file, save header information when encountered, and yield the - // Item XElement objects as they are created. - - // loop through Customer elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Customer") - { - // move to Name element - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.Element && - reader.Name == "Name") - { - name = XElement.ReadFrom(reader) as XElement; - break; - } - } - - // loop through Item elements - while (reader.Read()) - { - if (reader.NodeType == XmlNodeType.EndElement) - break; - if (reader.NodeType == XmlNodeType.Element - && reader.Name == "Item") - { - item = XElement.ReadFrom(reader) as XElement; - if (item != null) { - XElement tempRoot = new XElement("Root", - new XElement(name) - ); - tempRoot.Add(item); - yield return item; - } - } - } - } - } - } -} - -static void Main(string[] args) -{ - XElement xmlTree = new XElement("Root", - from el in StreamCustomerItem("Source.xml") - where (int)el.Element("Key") >= 3 && (int)el.Element("Key") <= 7 - select new XElement("Item", - new XElement("Customer", (string)el.Parent.Element("Name")), - new XElement(el.Element("Key")) - ) - ); - Console.WriteLine(xmlTree); -} -``` - - This code produces the following output: - -```xml - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md b/docs/csharp/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md deleted file mode 100644 index b59a7b3910488..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: "How to transform the shape of an XML tree (C#)" -description: Learn how to transform the shape of an XML tree. The shape of an XML tree refers to its element and attribute names, and its hierarchy characteristics. -ms.date: 07/20/2015 -ms.assetid: 93c5d426-dea2-4709-a991-60204de42e8f ---- -# How to transform the shape of an XML tree (C#) -The *shape* of an XML document refers to its element names, attribute names, and the characteristics of its hierarchy. - - Sometimes you will have to change the shape of an XML document. For example, you might have to send an existing XML document to another system that requires different element and attribute names. You could go through the document, deleting and renaming elements as required, but using functional construction results in more readable and maintainable code. For more information about functional construction, see [Functional Construction (LINQ to XML) (C#)](./functional-construction-linq-to-xml.md). - - The first example changes the organization of the XML document. It moves complex elements from one location in the tree to another. - - The second example in this topic creates an XML document with a different shape than the source document. It changes the casing of the element names, renames some elements, and leaves some elements from the source tree out of the transformed tree. - -## Example - The following code changes the shape of an XML file using embedded query expressions. - - The source XML document in this example contains a `Customers` element under the `Root` element that contains all customers. It also contains an `Orders` element under the `Root` element that contains all orders. This example creates a new XML tree in which the orders for each customer are contained in an `Orders` element within the `Customer` element. The original document also contains a `CustomerID` element in the `Order` element; this element will be removed from the re-shaped document. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - -```csharp -XElement co = XElement.Load("CustomersOrders.xml"); -XElement newCustOrd = - new XElement("Root", - from cust in co.Element("Customers").Elements("Customer") - select new XElement("Customer", - cust.Attributes(), - cust.Elements(), - new XElement("Orders", - from ord in co.Element("Orders").Elements("Order") - where (string)ord.Element("CustomerID") == (string)cust.Attribute("CustomerID") - select new XElement("Order", - ord.Attributes(), - ord.Element("EmployeeID"), - ord.Element("OrderDate"), - ord.Element("RequiredDate"), - ord.Element("ShipInfo") - ) - ) - ) - ); -Console.WriteLine(newCustOrd); -``` - - This code produces the following output: - -```xml - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
- -
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
- -
- . . . -``` - -## Example - This example renames some elements and converts some attributes to elements. - - The code calls `ConvertAddress`, which returns a list of objects. The argument to the method is a query that determines the `Address` complex element where the `Type` attribute has a value of `"Shipping"`. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](./sample-xml-file-typical-purchase-order-linq-to-xml-1.md). - -```csharp -static IEnumerable ConvertAddress(XElement add) -{ - List fragment = new List() { - new XElement("NAME", (string)add.Element("Name")), - new XElement("STREET", (string)add.Element("Street")), - new XElement("CITY", (string)add.Element("City")), - new XElement("ST", (string)add.Element("State")), - new XElement("POSTALCODE", (string)add.Element("Zip")), - new XElement("COUNTRY", (string)add.Element("Country")) - }; - return fragment; -} - -static void Main(string[] args) -{ - XElement po = XElement.Load("PurchaseOrder.xml"); - XElement newPo = new XElement("PO", - new XElement("ID", (string)po.Attribute("PurchaseOrderNumber")), - new XElement("DATE", (DateTime)po.Attribute("OrderDate")), - ConvertAddress( - (from el in po.Elements("Address") - where (string)el.Attribute("Type") == "Shipping" - select el) - .First() - ) - ); - Console.WriteLine(newPo); -} -``` - - This code produces the following output: - -```xml - - 99503 - 1999-10-20T00:00:00 - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md b/docs/csharp/programming-guide/concepts/linq/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md deleted file mode 100644 index 56f03d8280586..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md +++ /dev/null @@ -1,422 +0,0 @@ ---- -title: "How to use annotations to transform LINQ to XML trees in an XSLT style (C#)" -description: Learn how to use annotations to transform LINQ to XML trees in an XSLT style. See an example of transforming a tree by using the XForm function. -ms.date: 07/20/2015 -ms.assetid: 12a95902-a6b7-4a1e-ad52-04a518db226f ---- -# How to use annotations to transform LINQ to XML trees in an XSLT style (C#) -Annotations can be used to facilitate transforms of an XML tree. - - Some XML documents are "document centric with mixed content." With such documents, you don't necessarily know the shape of child nodes of an element. For instance, a node that contains text may look like this: - -```xml -A phrase with bold and italic text. -``` - - For any given text node, there may be any number of child `` and `` elements. This approach extends to a number of other situations, such as pages that can contain a variety of child elements, such as regular paragraphs, bulleted paragraphs, and bitmaps. Cells in a table may contain text, drop down lists, or bitmaps. One of the primary characteristics of document centric XML is that you do not know which child element any particular element will have. - - If you want to transform elements in a tree where you don't necessarily know much about the children of the elements that you want to transform, then this approach that uses annotations is an effective approach. - - The summary of the approach is: - -- First, annotate elements in the tree with a replacement element. - -- Second, iterate through the entire tree, creating a new tree where you replace each element with its annotation. This example implements the iteration and creation of the new tree in a function named `XForm`. - - In detail, the approach consists of: - -- Execute one or more LINQ to XML queries that return the set of elements that you want to transform from one shape to another. For each element in the query, add a new object as an annotation to the element. This new element will replace the annotated element in the new, transformed tree. This is simple code to write, as demonstrated by the example. - -- The new element that is added as an annotation can contain new child nodes; it can form a sub-tree with any desired shape. - -- There is a special rule: If a child node of the new element is in a different namespace, a namespace that is made up for this purpose (in this example, the namespace is `http://www.microsoft.com/LinqToXmlTransform/2007`), then that child element is not copied to the new tree. Instead, if the namespace is the above mentioned special namespace, and the local name of the element is `ApplyTransforms`, then the child nodes of the element in the source tree are iterated, and copied to the new tree (with the exception that annotated child elements are themselves transformed according to these rules). - -- This is somewhat analogous to the specification of transforms in XSL. The query that selects a set of nodes is analogous to the XPath expression for a template. The code to create the new that is saved as an annotation is analogous to the sequence constructor in XSL, and the `ApplyTransforms` element is analogous in function to the `xsl:apply-templates` element in XSL. - -- One advantage to taking this approach - as you formulate queries, you are always writing queries on the unmodified source tree. You need not worry about how modifications to the tree affect the queries that you are writing. - -## Transforming a Tree - This first example renames all `Paragraph` nodes to `para`. - -```csharp -XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; -XName at = xf + "ApplyTransforms"; - -XElement root = XElement.Parse(@" - - This is a sentence with bold and italic text. - More text. -"); - -// replace Paragraph with para -foreach (var el in root.Descendants("Paragraph")) - el.AddAnnotation( - new XElement("para", - // same idea as xsl:apply-templates - new XElement(xf + "ApplyTransforms") - ) - ); - -// The XForm method, shown later in this topic, accomplishes the transform -XElement newRoot = XForm(root); - -Console.WriteLine(newRoot); -``` - - This example produces the following output: - -```xml - - This is a sentence with bold and italic text. - More text. - -``` - -## A More Complicated Transform - The following example queries the tree and calculates the average and sum of the `Data` elements, and adds them as new elements to the tree. - -```csharp -XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; -XName at = xf + "ApplyTransforms"; - -XElement data = new XElement("Root", - new XElement("Data", 20), - new XElement("Data", 10), - new XElement("Data", 3) -); - -// while adding annotations, you can query the source tree all you want, -// as the tree is not mutated while annotating. -var avg = data.Elements("Data").Select(z => (Decimal)z).Average(); -data.AddAnnotation( - new XElement("Root", - new XElement(xf + "ApplyTransforms"), - new XElement("Average", $"{avg:F4}"), - new XElement("Sum", - data - .Elements("Data") - .Select(z => (int)z) - .Sum() - ) - ) -); - -Console.WriteLine("Before Transform"); -Console.WriteLine("----------------"); -Console.WriteLine(data); -Console.WriteLine(); -Console.WriteLine(); - -// The XForm method, shown later in this topic, accomplishes the transform -XElement newData = XForm(data); - -Console.WriteLine("After Transform"); -Console.WriteLine("----------------"); -Console.WriteLine(newData); -``` - - This example produces the following output: - -```output -Before Transform ----------------- - - 20 - 10 - 3 - - -After Transform ----------------- - - 20 - 10 - 3 - 11.0000 - 33 - -``` - -## Effecting the Transform - A small function, `XForm`, creates a new transformed tree from the original, annotated tree. - -- The pseudo code for the function is quite simple: - -```text -The function takes an XElement as an argument and returns an XElement. -If an element has an XElement annotation, then - Return a new XElement - The name of the new XElement is the annotation element's name. - All attributes are copied from the annotation to the new node. - All child nodes are copied from the annotation, with the - exception that the special node xf:ApplyTransforms is - recognized, and the source element's child nodes are - iterated. If the source child node is not an XElement, it - is copied to the new tree. If the source child is an - XElement, then it is transformed by calling this function - recursively. -If an element is not annotated - Return a new XElement - The name of the new XElement is the source element's name - All attributes are copied from the source element to the - destination's element. - All child nodes are copied from the source element. - If the source child node is not an XElement, it is copied to - the new tree. If the source child is an XElement, then it - is transformed by calling this function recursively. -``` - - Following is the implementation of this function: - -```csharp -// Build a transformed XML tree per the annotations -static XElement XForm(XElement source) -{ - XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; - XName at = xf + "ApplyTransforms"; - - if (source.Annotation() != null) - { - XElement anno = source.Annotation(); - return new XElement(anno.Name, - anno.Attributes(), - anno - .Nodes() - .Select( - (XNode n) => - { - XElement annoEl = n as XElement; - if (annoEl != null) - { - if (annoEl.Name == at) - return (object)( - source.Nodes() - .Select( - (XNode n2) => - { - XElement e2 = n2 as XElement; - if (e2 == null) - return n2; - else - return XForm(e2); - } - ) - ); - else - return n; - } - else - return n; - } - ) - ); - } - else - { - return new XElement(source.Name, - source.Attributes(), - source - .Nodes() - .Select(n => - { - XElement el = n as XElement; - if (el == null) - return n; - else - return XForm(el); - } - ) - ); - } -} -``` - -## Complete Example - The following code is a complete example that includes the `XForm` function. It includes a few of the typical uses of this type of transform: - -```csharp -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml; -using System.Xml.Linq; - -class Program -{ - static XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; - static XName at = xf + "ApplyTransforms"; - - // Build a transformed XML tree per the annotations - static XElement XForm(XElement source) - { - if (source.Annotation() != null) - { - XElement anno = source.Annotation(); - return new XElement(anno.Name, - anno.Attributes(), - anno - .Nodes() - .Select( - (XNode n) => - { - XElement annoEl = n as XElement; - if (annoEl != null) - { - if (annoEl.Name == at) - return (object)( - source.Nodes() - .Select( - (XNode n2) => - { - XElement e2 = n2 as XElement; - if (e2 == null) - return n2; - else - return XForm(e2); - } - ) - ); - else - return n; - } - else - return n; - } - ) - ); - } - else - { - return new XElement(source.Name, - source.Attributes(), - source - .Nodes() - .Select(n => - { - XElement el = n as XElement; - if (el == null) - return n; - else - return XForm(el); - } - ) - ); - } - } - - static void Main(string[] args) - { - XElement root = new XElement("Root", - new XComment("A comment"), - new XAttribute("Att1", 123), - new XElement("Child", 1), - new XElement("Child", 2), - new XElement("Other", - new XElement("GC", 3), - new XElement("GC", 4) - ), - XElement.Parse( - "This is an element that " + - "has some mixed content"), - new XElement("AnUnchangedElement", 42) - ); - - // each of the following serves the same semantic purpose as - // XSLT templates and sequence constructors - - // replace Child with NewChild - foreach (var el in root.Elements("Child")) - el.AddAnnotation(new XElement("NewChild", (string)el)); - - // replace first GC with GrandChild, add an attribute - foreach (var el in root.Descendants("GC").Take(1)) - el.AddAnnotation( - new XElement("GrandChild", - new XAttribute("ANewAttribute", 999), - (string)el - ) - ); - - // replace Other with NewOther, add new child elements around original content - foreach (var el in root.Elements("Other")) - el.AddAnnotation( - new XElement("NewOther", - new XElement("MyNewChild", 1), - // same idea as xsl:apply-templates - new XElement(xf + "ApplyTransforms"), - new XElement("ChildThatComesAfter") - ) - ); - - // change name of element that has mixed content - root.Descendants("SomeMixedContent").First().AddAnnotation( - new XElement("MixedContent", - new XElement(xf + "ApplyTransforms") - ) - ); - - // replace with - foreach (var el in root.Descendants("b")) - el.AddAnnotation( - new XElement("Bold", - new XElement(xf + "ApplyTransforms") - ) - ); - - // replace with - foreach (var el in root.Descendants("i")) - el.AddAnnotation( - new XElement("Italic", - new XElement(xf + "ApplyTransforms") - ) - ); - - Console.WriteLine("Before Transform"); - Console.WriteLine("----------------"); - Console.WriteLine(root); - Console.WriteLine(); - Console.WriteLine(); - XElement newRoot = XForm(root); - - Console.WriteLine("After Transform"); - Console.WriteLine("----------------"); - Console.WriteLine(newRoot); - } -} -``` - - This example produces the following output: - -```output -Before Transform ----------------- - - - 1 - 2 - - 3 - 4 - - This is an element that has some mixed content - 42 - - -After Transform ----------------- - - - 1 - 2 - - 1 - 3 - 4 - - - This is an element that has some mixed content - 42 - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md deleted file mode 100644 index b9e1141ba7112..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: "How to validate using XSD (LINQ to XML) (C#)" -description: Learn how to validate an XML tree against an XML Schema Definition Language (XSD) file. See code examples and view additional resources. -ms.date: 07/20/2015 -ms.assetid: 6a7f83a9-2d74-4c2b-8417-0a8595879516 ---- -# How to validate using XSD (LINQ to XML) (C#) -The namespace contains extension methods that make it easy to validate an XML tree against an XML Schema Definition Language (XSD) file. For more information, see the method documentation. - -## Example - The following example creates an , then validates two objects against the schema set. One of the documents is valid, the other is not. - -```csharp -string xsdMarkup = - @" - - - - - - - - - "; -XmlSchemaSet schemas = new XmlSchemaSet(); -schemas.Add("", XmlReader.Create(new StringReader(xsdMarkup))); - -XDocument doc1 = new XDocument( - new XElement("Root", - new XElement("Child1", "content1"), - new XElement("Child2", "content1") - ) -); - -XDocument doc2 = new XDocument( - new XElement("Root", - new XElement("Child1", "content1"), - new XElement("Child3", "content1") - ) -); - -Console.WriteLine("Validating doc1"); -bool errors = false; -doc1.Validate(schemas, (o, e) => - { - Console.WriteLine("{0}", e.Message); - errors = true; - }); -Console.WriteLine("doc1 {0}", errors ? "did not validate" : "validated"); - -Console.WriteLine(); -Console.WriteLine("Validating doc2"); -errors = false; -doc2.Validate(schemas, (o, e) => - { - Console.WriteLine("{0}", e.Message); - errors = true; - }); -Console.WriteLine("doc2 {0}", errors ? "did not validate" : "validated"); -``` - - This example produces the following output: - -```output -Validating doc1 -doc1 validated - -Validating doc2 -The element 'Root' has invalid child element 'Child3'. List of possible elements expected: 'Child2'. -doc2 did not validate -``` - -## Example - The following example validates that the XML document from [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md) is valid per the schema from [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md). It then modifies the source XML document. It changes the `CustomerID` attribute on the first customer. After the change, orders will then refer to a customer that does not exist, so the XML document will no longer validate. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). - - This example uses the following XSD schema: [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md). - -```csharp -XmlSchemaSet schemas = new XmlSchemaSet(); -schemas.Add("", "CustomersOrders.xsd"); - -Console.WriteLine("Attempting to validate"); -XDocument custOrdDoc = XDocument.Load("CustomersOrders.xml"); -bool errors = false; -custOrdDoc.Validate(schemas, (o, e) => - { - Console.WriteLine("{0}", e.Message); - errors = true; - }); -Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); - -Console.WriteLine(); -// Modify the source document so that it will not validate. -custOrdDoc.Root.Element("Orders").Element("Order").Element("CustomerID").Value = "AAAAA"; -Console.WriteLine("Attempting to validate after modification"); -errors = false; -custOrdDoc.Validate(schemas, (o, e) => - { - Console.WriteLine("{0}", e.Message); - errors = true; - }); -Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); -``` - - This example produces the following output: - -```output -Attempting to validate -custOrdDoc validated - -Attempting to validate after modification -The key sequence 'AAAAA' in Keyref fails to refer to some key. -custOrdDoc did not validate -``` - -## See also - -- -- [Creating XML Trees (C#)](creating-xml-trees-linq-to-xml-2.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md deleted file mode 100644 index 607016c53509d..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: "How to work with dictionaries using LINQ to XML (C#)" -description: Learn how to work with dictionaries using LINQ to XML. See examples converting dictionaries to XML, and XML back to other data structures. -ms.date: 07/20/2015 -ms.assetid: 57bcefe3-8433-4d3b-935a-511c9bcbdfa8 ---- -# How to work with dictionaries using LINQ to XML (C#) -It is often convenient to convert varieties of data structures to XML, and XML back to other data structures. This topic shows a specific implementation of this general approach by converting a to XML and back. - -## Example - This example uses a form of functional construction in which a query projects new objects, and the resulting collection is passed as an argument to the constructor of the Root object. - -```csharp -Dictionary dict = new Dictionary(); -dict.Add("Child1", "Value1"); -dict.Add("Child2", "Value2"); -dict.Add("Child3", "Value3"); -dict.Add("Child4", "Value4"); -XElement root = new XElement("Root", - from keyValue in dict - select new XElement(keyValue.Key, keyValue.Value) -); -Console.WriteLine(root); -``` - - This code produces the following output: - -```xml - - Value1 - Value2 - Value3 - Value4 - -``` - -## Example - The following code creates a dictionary from XML. - -```csharp -XElement root = new XElement("Root", - new XElement("Child1", "Value1"), - new XElement("Child2", "Value2"), - new XElement("Child3", "Value3"), - new XElement("Child4", "Value4") -); - -Dictionary dict = new Dictionary(); -foreach (XElement el in root.Elements()) - dict.Add(el.Name.LocalName, el.Value); -foreach (string str in dict.Keys) - Console.WriteLine("{0}:{1}", str, dict[str]); -``` - - This code produces the following output: - -```output -Child1:Value1 -Child2:Value2 -Child3:Value3 -Child4:Value4 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md b/docs/csharp/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md deleted file mode 100644 index 8c31ee9947628..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md +++ /dev/null @@ -1,288 +0,0 @@ ---- -title: "How to write a LINQ to XML axis method (C#)" -description: Learn how to write a LINQ to XML axis method. XML axis methods are used to retrieve collections from an XML tree. -ms.date: 07/20/2015 -ms.assetid: 50aef06b-1d22-4718-a18a-21237e26d7c1 ---- -# How to write a LINQ to XML axis method (C#) - -An XML [axis method](linq-to-xml-axes-overview.md) retrieves a collection of XML elements from an XML document or ancestor element. You can write your own axis methods to retrieve collections from an XML tree. One of the best ways to do this is to write an extension method that returns a collection of elements or attributes. You can write your extension method to return specific subsets of elements or attributes, based on the requirements of your application. - -## Example - The following example uses two extension methods. The first extension method, `GetXPath`, operates on , and returns an XPath expression that when evaluated will return the node or attribute. The second extension method, `Find`, operates on . It returns a collection of objects and objects that contain some specified text. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```csharp -public static class MyExtensions -{ - private static string GetQName(XElement xe) - { - string prefix = xe.GetPrefixOfNamespace(xe.Name.Namespace); - if (xe.Name.Namespace == XNamespace.None || prefix == null) - return xe.Name.LocalName.ToString(); - else - return prefix + ":" + xe.Name.LocalName.ToString(); - } - - private static string GetQName(XAttribute xa) - { - string prefix = - xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace); - if (xa.Name.Namespace == XNamespace.None || prefix == null) - return xa.Name.ToString(); - else - return prefix + ":" + xa.Name.LocalName; - } - - private static string NameWithPredicate(XElement el) - { - if (el.Parent != null && el.Parent.Elements(el.Name).Count() != 1) - return GetQName(el) + "[" + - (el.ElementsBeforeSelf(el.Name).Count() + 1) + "]"; - else - return GetQName(el); - } - - public static string StrCat(this IEnumerable source, - string separator) - { - return source.Aggregate(new StringBuilder(), - (sb, i) => sb - .Append(i.ToString()) - .Append(separator), - s => s.ToString()); - } - - public static string GetXPath(this XObject xobj) - { - if (xobj.Parent == null) - { - XDocument doc = xobj as XDocument; - if (doc != null) - return "."; - XElement el = xobj as XElement; - if (el != null) - return "/" + NameWithPredicate(el); - // the XPath data model does not include white space text nodes - // that are children of a document, so this method returns null. - XText xt = xobj as XText; - if (xt != null) - return null; - XComment com = xobj as XComment; - if (com != null) - return - "/" + - ( - com - .Document - .Nodes() - .OfType() - .Count() != 1 ? - "comment()[" + - (com - .NodesBeforeSelf() - .OfType() - .Count() + 1) + - "]" : - "comment()" - ); - XProcessingInstruction pi = xobj as XProcessingInstruction; - if (pi != null) - return - "/" + - ( - pi.Document.Nodes() - .OfType() - .Count() != 1 ? - "processing-instruction()[" + - (pi - .NodesBeforeSelf() - .OfType() - .Count() + 1) + - "]" : - "processing-instruction()" - ); - return null; - } - else - { - XElement el = xobj as XElement; - if (el != null) - { - return - "/" + - el - .Ancestors() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - NameWithPredicate(el); - } - XAttribute at = xobj as XAttribute; - if (at != null) - return - "/" + - at - .Parent - .AncestorsAndSelf() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - "@" + GetQName(at); - XComment com = xobj as XComment; - if (com != null) - return - "/" + - com - .Parent - .AncestorsAndSelf() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - ( - com - .Parent - .Nodes() - .OfType() - .Count() != 1 ? - "comment()[" + - (com - .NodesBeforeSelf() - .OfType() - .Count() + 1) + "]" : - "comment()" - ); - XCData cd = xobj as XCData; - if (cd != null) - return - "/" + - cd - .Parent - .AncestorsAndSelf() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - ( - cd - .Parent - .Nodes() - .OfType() - .Count() != 1 ? - "text()[" + - (cd - .NodesBeforeSelf() - .OfType() - .Count() + 1) + "]" : - "text()" - ); - XText tx = xobj as XText; - if (tx != null) - return - "/" + - tx - .Parent - .AncestorsAndSelf() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - ( - tx - .Parent - .Nodes() - .OfType() - .Count() != 1 ? - "text()[" + - (tx - .NodesBeforeSelf() - .OfType() - .Count() + 1) + "]" : - "text()" - ); - XProcessingInstruction pi = xobj as XProcessingInstruction; - if (pi != null) - return - "/" + - pi - .Parent - .AncestorsAndSelf() - .InDocumentOrder() - .Select(e => NameWithPredicate(e)) - .StrCat("/") + - ( - pi - .Parent - .Nodes() - .OfType() - .Count() != 1 ? - "processing-instruction()[" + - (pi - .NodesBeforeSelf() - .OfType() - .Count() + 1) + "]" : - "processing-instruction()" - ); - return null; - } - } - - public static IEnumerable Find(this XElement source, string value) - { - if (source.Attributes().Any()) - { - foreach (XAttribute att in source.Attributes()) - { - string contents = (string)att; - if (contents.Contains(value)) - yield return att; - } - } - if (source.Elements().Any()) - { - foreach (XElement child in source.Elements()) - foreach (XObject s in child.Find(value)) - yield return s; - } - else - { - string contents = (string)source; - if (contents.Contains(value)) - yield return source; - } - } -} - -class Program -{ - static void Main(string[] args) - { - XElement purchaseOrders = XElement.Load("PurchaseOrders.xml"); - - IEnumerable subset = - from xobj in purchaseOrders.Find("1999") - select xobj; - - foreach (XObject obj in subset) - { - Console.WriteLine(obj.GetXPath()); - if (obj.GetType() == typeof(XElement)) - Console.WriteLine(((XElement)obj).Value); - else if (obj.GetType() == typeof(XAttribute)) - Console.WriteLine(((XAttribute)obj).Value); - } - } -} -``` - - This code produces the following output: - -```output -/PurchaseOrders/PurchaseOrder[1]/@OrderDate -1999-10-20 -/PurchaseOrders/PurchaseOrder[1]/Items/Item[2]/ShipDate -1999-05-21 -/PurchaseOrders/PurchaseOrder[2]/@OrderDate -1999-10-22 -/PurchaseOrders/PurchaseOrder[3]/@OrderDate -1999-10-22 -``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md b/docs/csharp/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md deleted file mode 100644 index e8418f14eee87..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md +++ /dev/null @@ -1,101 +0,0 @@ ---- -title: "How to write a query that finds elements based on context (C#)" -description: Learn how to write a query that finds elements based on context. See code examples and view additional resources. -ms.date: 07/20/2015 -ms.assetid: 3ff79ef0-fc8b-42fe-8cc0-10dc32b06b4e ---- -# How to write a query that finds elements based on context (C#) -Sometimes you might have to write a query that selects elements based on their context. You might want to filter based on preceding or following sibling elements. You might want to filter based on child or ancestor elements. - - You can do this by writing a query and using the results of the query in the `where` clause. If you have to first test against null, and then test the value, it is more convenient to do the query in a `let` clause, and then use the results in the `where` clause. - -## Example - The following example selects all `p` elements that are immediately followed by a `ul` element. - -```csharp -XElement doc = XElement.Parse(@" -

-

    abc
- -

- -

-

    def
-

- - -

- -

-

    abc
-

- -"); - -IEnumerable items = - from e in doc.Descendants("p") - let z = e.ElementsAfterSelf().FirstOrDefault() - where z != null && z.Name.LocalName == "ul" - select e; - -foreach (XElement e in items) - Console.WriteLine("id = {0}", (string)e.Attribute("id")); -``` - - This code produces the following output: - -```output -id = 1 -id = 3 -id = 6 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - -```csharp -XElement doc = XElement.Parse(@" -

-

    abc
- -

- -

-

    def
-

- - -

- -

-

    abc
-

- -"); - -XNamespace ad = "http://www.adatum.com"; - -IEnumerable items = - from e in doc.Descendants(ad + "p") - let z = e.ElementsAfterSelf().FirstOrDefault() - where z != null && z.Name == ad.GetName("ul") - select e; - -foreach (XElement e in items) - Console.WriteLine("id = {0}", (string)e.Attribute("id")); -``` - - This code produces the following output: - -```output -id = 1 -id = 3 -id = 6 -``` - -## See also - -- -- -- -- diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md b/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md deleted file mode 100644 index 3915d00b136be..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: "How to write queries on XML in namespaces (C#)" -description: Learn how to write queries on XML in namespaces. For these queries, you must use the XName objects that have the correct namespace. -ms.date: 07/20/2015 -ms.assetid: 7c54df81-15e4-4091-8c81-a87637029130 ---- -# How to write queries on XML in namespaces (C#) -To write a query on XML that is in a namespace, you must use objects that have the correct namespace. - - For C#, the most common approach is to initialize an using a string that contains the URI, then use the addition operator overload to combine the namespace with the local name. - - The first set of examples in this topic shows how to create an XML tree in a default namespace. The second set shows how to create an XML tree in a namespace with a prefix. - -## Example - The following example creates an XML tree that is in a default namespace. It then retrieves a collection of elements. - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -IEnumerable c1 = - from el in root.Elements(aw + "Child") - select el; -foreach (XElement el in c1) - Console.WriteLine((int)el); -``` - - This example produces the following output: - -```output -1 -2 -3 -``` - -## Example - In C#, you write queries in the same way regardless of whether you are writing queries on an XML tree that uses a namespace with a prefix or on an XML tree with a default namespace. - - The following example creates an XML tree that is in a namespace with a prefix. It then retrieves a collection of elements. - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -IEnumerable c1 = - from el in root.Elements(aw + "Child") - select el; -foreach (XElement el in c1) - Console.WriteLine((int)el); -``` - - This example produces the following output: - -```output -1 -2 -3 -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md b/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md deleted file mode 100644 index dd1d80c658bd3..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to write queries with complex filtering (C#)" -description: Learn how to write LINQ to XML queries with complex filters. See code examples and view additional resources. -ms.date: 07/20/2015 -ms.assetid: 4065d901-cf89-4e47-8bf9-abb65acfb003 ---- -# How to write queries with complex filtering (C#) -Sometimes you want to write LINQ to XML queries with complex filters. For example, you might have to find all elements that have a child element with a particular name and value. This topic gives an example of writing a query with complex filtering. - -## Example - This example shows how to find all `PurchaseOrder` elements that have a child `Address` element that has a `Type` attribute equal to "Shipping" and a child `State` element equal to "NY". It uses a nested query in the `Where` clause, and the `Any` operator returns `true` if the collection has any elements in it. For information about using method-based query syntax, see [Query Syntax and Method Syntax in LINQ](./query-syntax-and-method-syntax-in-linq.md). - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](./sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - - For more information about the `Any` operator, see [Quantifier Operations (C#)](./quantifier-operations.md). - -```csharp -XElement root = XElement.Load("PurchaseOrders.xml"); -IEnumerable purchaseOrders = - from el in root.Elements("PurchaseOrder") - where - (from add in el.Elements("Address") - where - (string)add.Attribute("Type") == "Shipping" && - (string)add.Element("State") == "NY" - select add) - .Any() - select el; -foreach (XElement el in purchaseOrders) - Console.WriteLine((string)el.Attribute("PurchaseOrderNumber")); -``` - - This code produces the following output: - -```output -99505 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders in a Namespace](./sample-xml-file-multiple-purchase-orders-in-a-namespace.md). - -```csharp -XElement root = XElement.Load("PurchaseOrdersInNamespace.xml"); -XNamespace aw = "http://www.adventure-works.com"; -IEnumerable purchaseOrders = - from el in root.Elements(aw + "PurchaseOrder") - where - (from add in el.Elements(aw + "Address") - where - (string)add.Attribute(aw + "Type") == "Shipping" && - (string)add.Element(aw + "State") == "NY" - select add) - .Any() - select el; -foreach (XElement el in purchaseOrders) - Console.WriteLine((string)el.Attribute(aw + "PurchaseOrderNumber")); -``` - - This code produces the following output: - -```output -99505 -``` - -## See also - -- -- -- [Projection Operations (C#)](./projection-operations.md) -- [Quantifier Operations (C#)](./quantifier-operations.md) diff --git a/docs/csharp/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md deleted file mode 100644 index b031fd7bab4fe..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: "In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (C#)" -description: These examples change the shape of an XML document by modifying it in place and by using LINQ to XML functional construction in C#. -ms.date: 07/20/2015 -ms.assetid: b5afc31d-a325-4ec6-bf17-0ff90a20ffca ---- -# In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (C#) -Modifying an XML tree in place is a traditional approach to changing the shape of an XML document. A typical application loads a document into a data store such as DOM or [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]; uses a programming interface to insert nodes, delete nodes, or change the content of nodes; and then saves the XML to a file or transmits it over a network. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] enables another approach that is useful in many scenarios: *functional construction*. Functional construction treats modifying data as a problem of transformation, rather than as detailed manipulation of a data store. If you can take a representation of data and transform it efficiently from one form to another, the result is the same as if you took one data store and manipulated it in some way to take another shape. A key to the functional construction approach is to pass the results of queries to and constructors. - - In many cases you can write the transformational code in a fraction of the time that it would take to manipulate the data store, and that code is more robust and easier to maintain. In these cases, even though the transformational approach can take more processing power, it is a more effective way to modify data. If a developer is familiar with the functional approach, the resulting code in many cases is easier to understand. It is easy to find the code that modifies each part of the tree. - - The approach where you modify an XML tree in-place is more familiar to many DOM programmers, whereas code written using the functional approach might look unfamiliar to a developer who doesn't yet understand that approach. If you have to only make a small modification to a large XML tree, the approach where you modify a tree in place in many cases will take less CPU time. - - This topic provides an example that is implemented with both approaches. - -## Transforming Attributes into Elements - For this example, suppose you want to modify the following simple XML document so that the attributes become elements. This topic first presents the traditional in-place modification approach. It then shows the functional construction approach. - -```xml - - - Content - -``` - -### Modifying the XML Tree - You can write some procedural code to create elements from the attributes, and then delete the attributes, as follows: - -```csharp -XElement root = XElement.Load("Data.xml"); -foreach (XAttribute att in root.Attributes()) { - root.Add(new XElement(att.Name, (string)att)); -} -root.Attributes().Remove(); -Console.WriteLine(root); -``` - - This code produces the following output: - -```xml - - Content - 123 - 456 - -``` - -### Functional Construction Approach - By contrast, a functional approach consists of code to form a new tree, picking and choosing elements and attributes from the source tree, and transforming them as appropriate as they are added to the new tree. The functional approach looks like the following: - -```csharp -XElement root = XElement.Load("Data.xml"); -XElement newTree = new XElement("Root", - root.Element("Child1"), - from att in root.Attributes() - select new XElement(att.Name, (string)att) -); -Console.WriteLine(newTree); -``` - - This example outputs the same XML as the first example. However, notice that you can actually see the resulting structure of the new XML in the functional approach. You can see the creation of the `Root` element, the code that pulls the `Child1` element from the source tree, and the code that transforms the attributes from the source tree to elements in the new tree. - - The functional example in this case is not any shorter than the first example, and it is not really any simpler. However, if you have many changes to make to an XML tree, the non functional approach will become quite complex and somewhat obtuse. In contrast, when using the functional approach, you still just form the desired XML, embedding queries and expressions as appropriate, to pull in the desired content. The functional approach yields code that is easier to maintain. - - Notice that in this case the functional approach probably would not perform quite as well as the tree manipulation approach. The main issue is that the functional approach creates more short lived objects. However, the tradeoff is an effective one if using the functional approach allows for greater programmer productivity. - - This is a very simple example, but it serves to show the difference in philosophy between the two approaches. The functional approach yields greater productivity gains for transforming larger XML documents. - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/intermediate-materialization.md b/docs/csharp/programming-guide/concepts/linq/intermediate-materialization.md deleted file mode 100644 index ff36d938465ac..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/intermediate-materialization.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "Intermediate Materialization (C#)" -description: This C# example shows intermediate materialization, where a query causes AppendString to enumerate its entire source before yielding the first item. -ms.date: 07/20/2015 -ms.assetid: 7922d38f-5044-41cf-8e17-7173d6553a5e ---- -# Intermediate Materialization (C#) -If you are not careful, in some situations you can drastically alter the memory and performance profile of your application by causing premature materialization of collections in your queries. Some standard query operators cause materialization of their source collection before yielding a single element. For example, first iterates through its entire source collection, then sorts all items, and then finally yields the first item. This means that it is expensive to get the first item of an ordered collection; each item thereafter is not expensive. This makes sense: It would be impossible for that query operator to do otherwise. - -## Example - This example alters the previous example. The `AppendString` method calls before iterating through the source. This causes materialization. - -```csharp -public static class LocalExtensions -{ - public static IEnumerable - ConvertCollectionToUpperCase(this IEnumerable source) - { - foreach (string str in source) - { - Console.WriteLine("ToUpper: source >{0}<", str); - yield return str.ToUpper(); - } - } - - public static IEnumerable - AppendString(this IEnumerable source, string stringToAppend) - { - // the following statement materializes the source collection in a List - // before iterating through it - foreach (string str in source.ToList()) - { - Console.WriteLine("AppendString: source >{0}<", str); - yield return str + stringToAppend; - } - } -} - -class Program -{ - static void Main(string[] args) - { - string[] stringArray = { "abc", "def", "ghi" }; - - IEnumerable q1 = - from s in stringArray.ConvertCollectionToUpperCase() - select s; - - IEnumerable q2 = - from s in q1.AppendString("!!!") - select s; - - foreach (string str in q2) - { - Console.WriteLine("Main: str >{0}<", str); - Console.WriteLine(); - } - } -} -``` - - This example produces the following output: - -```output -ToUpper: source >abc< -ToUpper: source >def< -ToUpper: source >ghi< -AppendString: source >ABC< -Main: str >ABC!!!< - -AppendString: source >DEF< -Main: str >DEF!!!< - -AppendString: source >GHI< -Main: str >GHI!!!< -``` - - In this example, you can see that the call to causes `AppendString` to enumerate its entire source before yielding the first item. If the source were a large array, this would significantly alter the memory profile of the application. - - Standard query operators can also be chained together. The final topic in this tutorial illustrates this. - -- [Chaining Standard Query Operators Together (C#)](./chaining-standard-query-operators-together.md) - -## See also - -- [Tutorial: Chaining Queries Together (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md b/docs/csharp/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md deleted file mode 100644 index 1b89cbb31c55b..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Introduction to Pure Functional Transformations (C#)" -description: Learn about functional transformations, including underlying concepts and language constructs in C#. These resources use XML transformation for examples. -ms.date: 07/20/2015 -ms.assetid: 8495c9d9-2d02-4aa0-8a10-9e8794b985fe ---- -# Introduction to Pure Functional Transformations (C#) -This section introduces functional transformations, including the underlying concepts and supporting language constructs. It contrasts the object-oriented and functional transformation approaches to programming, including advice on how to transition to the latter. Although functional transformations can be used in many programming scenarios, XML transformation is used here as a concrete example. - - The [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) tutorial provides a series of examples, each building on the previous one. These examples demonstrate the pure functional transformational approach to manipulating XML. This tutorial assumes a working knowledge of C#. Detailed semantics of the language constructs are not provided in this tutorial, but links are provided to the language documentation as appropriate. - - A working knowledge of basic computer science concepts and XML, including XML namespaces, is also assumed. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Concepts and Terminology (Functional Transformation) (C#)](./concepts-and-terminology-functional-transformation.md)|Introduces the concepts and terminology of pure functional transformations.| -|[Functional Programming vs. Imperative Programming (C#)](./functional-programming-vs-imperative-programming.md)|Compares and contrasts functional programming to more traditional imperative (procedural) programming.| -|[Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md)|Introduces pure functions, and shows examples of and pure and impure functions.| -|[Applicability of Functional Transformation (C#)](./applicability-of-functional-transformation.md)|Describes typical scenarios for functional transformations.| -|[Functional Transformation of XML (Visual Basic)](../../../../visual-basic/programming-guide/concepts/linq/functional-transformation-of-xml.md)|Describes functional transformations in the context of transforming XML trees.| - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes-overview.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes-overview.md deleted file mode 100644 index f6c88bcd7a1fc..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-axes-overview.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "LINQ to XML Axes Overview (C#)" -description: Learn about the axis methods in C#, also called axes. You can query an XML tree in LINQ to find elements and attributes and retrieve their values through axes. -ms.date: 07/20/2015 -ms.assetid: 516792fb-461d-40a8-8a50-9993a51258fc ---- -# LINQ to XML Axes Overview (C#) -After you have created an XML tree or loaded an XML document into an XML tree, you can query it to find elements and attributes and retrieve their values. You retrieve collections through the *axis methods*, also called *axes*. Some of the axes are methods in the and classes that return collections. Some of the axes are extension methods in the class. The axes that are implemented as extension methods operate on collections, and return collections. - - As described in [XElement Class Overview](./xelement-class-overview.md), an object represents a single element node. The content of an element can be complex (sometimes called structured content), or it can be a simple element. A simple element can be empty or can contain a value. If the node contains structured content, you can use the various axis methods to retrieve enumerations of descendant elements. The most commonly used axis methods are and . - - In addition to the axis methods, which return collections, there are two more methods that you will commonly use in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. The method returns a single . The method returns a single . - - For many purposes, LINQ queries provide the most powerful way to examine a tree, extract data from it, and transform it. LINQ queries operate on objects that implement , and the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axes return of collections, and of collections. You need these collections to perform your queries. - - In addition to the axis methods that retrieve collections of elements and attributes, there are axis methods that allow you to iterate through the tree in great detail. For example, instead of dealing with elements and attributes, you can work with the nodes of the tree. Nodes are a finer level of granularity than elements and attributes. When working with nodes, you can examine XML comments, text nodes, processing instructions, and more. This functionality is important, for example, to someone who is writing a word processor and wants to save documents as XML. However, the majority of XML programmers are primarily concerned with elements, attributes, and their values. - -## Methods for Retrieving a Collection of Elements - The following is a summary of the methods of the class (or its base classes) that you call on an to return a collection of elements. - -|Method|Description| -|------------|-----------------| -||Returns an of of the ancestors of this element. An overload returns an of of the ancestors that have the specified .| -||Returns an of of the descendants of this element. An overload returns an of of the descendants that have the specified .| -||Returns an of of the child elements of this element. An overload returns an of of the child elements that have the specified .| -||Returns an of of the elements that come after this element. An overload returns an of of the elements after this element that have the specified .| -||Returns an of of the elements that come before this element. An overload returns an of of the elements before this element that have the specified .| -||Returns an of of this element and its ancestors. An overload returns an of of the elements that have the specified .| -||Returns an of of this element and its descendants. An overload returns an of of the elements that have the specified .| - -## Method for Retrieving a Single Element - The following method retrieves a single child from an object. - -|Method|Description| -|------------|-----------------| -||Returns the first child object that has the specified .| - -## Method for Retrieving a Collection of Attributes - The following method retrieves attributes from an object. - -|Method|Description| -|------------|-----------------| -||Returns an of of all of the attributes.| - -## Method for Retrieving a Single Attribute - The following method retrieves a single attribute from an object. - -|Method|Description| -|------------|-----------------| -||Returns the that has the specified .| - -## See also - -- [LINQ to XML Axes (C#)](linq-to-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md deleted file mode 100644 index de804a73a5461..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-classes-overview.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "LINQ to XML Classes Overview (C#)" -description: This article summarizes the LINQ to XML classes in C# in the System.Xml.Linq namespace, with a short description of each. -ms.date: 07/20/2015 -ms.assetid: bf666100-5392-4968-97f4-f6b9d3287d7b ---- -# LINQ to XML Classes Overview (C#) -This topic provides a list of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes in the namespace, and a short description of each. - -## LINQ to XML Classes - -### XAttribute Class - represents an XML attribute. For detailed information and examples, see [XAttribute Class Overview (C#)](./xattribute-class-overview.md). - -### XCData Class - represents a CDATA text node. - -### XComment Class - represents an XML comment. - -### XContainer Class - is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: - -- - -- - -### XDeclaration Class - represents an XML declaration. An XML declaration is used to declare the XML version and the encoding of a document. In addition, an XML declaration specifies whether the XML document is stand-alone. If a document is stand-alone, there are no external markup declarations, either in an external DTD, or in an external parameter entity referenced from the internal subset. - -### XDocument Class - represents an XML document. For detailed information and examples, see [XDocument Class Overview (C#)](./xdocument-class-overview.md). - -### XDocumentType Class - represents an XML Document Type Definition (DTD). - -### XElement Class - represents an XML element. For detailed information and examples, see [XElement Class Overview (C#)](./xelement-class-overview.md). - -### XName Class - represents names of elements () and attributes (). For detailed information and examples, see [XDocument Class Overview (C#)](./xdocument-class-overview.md). - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced topic in XML. Arguably, this complexity comes not from namespaces, which developers use regularly in programming, but from namespace prefixes. Namespace prefixes can be useful to reduce the keystrokes required when you input XML, or to make XML easier to read. However, prefixes are often just a shortcut for using the full XML namespace, and are not required in most cases. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they are required, through the method. - - It is possible, if necessary, to control namespace prefixes. In some circumstances, if you are working with other XML systems, such as XSLT or XAML, you need to control namespace prefixes. For example, if you have an XPath expression that uses namespace prefixes and is embedded in an XSLT stylesheet, you must make sure that your XML document is serialized with namespace prefixes that match those used in the XPath expression. - -### XNamespace Class - represents a namespace for an or . Namespaces are a component of an . - -### XNode Class - is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: - -- - -- - -- - -- - -- - -### XNodeDocumentOrderComparer Class - provides functionality to compare nodes for their document order. - -### XNodeEqualityComparer Class - provides functionality to compare nodes for value equality. - -### XObject Class - is an abstract base class of and . It provides annotation and event functionality. - -### XObjectChange Class - specifies the event type when an event is raised for an . - -### XObjectChangeEventArgs Class - provides data for the and events. - -### XProcessingInstruction Class - represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. - -### XText Class - represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content. - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-events.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-events.md deleted file mode 100644 index a32620a47758c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-events.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: "LINQ to XML Events (C#)" -description: Add LINQ to XML events in C# to an instance of any XObject. The event handler receives events when the XML tree for that XObject is modified. -ms.date: 07/20/2015 -ms.assetid: ce7de951-cba7-4870-9962-733eb01cd680 ---- -# LINQ to XML Events (C#) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] events enable you to be notified when an XML tree is altered. - - You can add events to an instance of any . The event handler will then receive events for modifications to that and any of its descendants. For example, you can add an event handler to the root of the tree, and handle all modifications to the tree from that event handler. - - For examples of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] events, see and . - -## Types and Events - You use the following types when working with events: - -|Type|Description| -|----------|-----------------| -||Specifies the event type when an event is raised for an .| -||Provides data for the and events.| - - The following events are raised when you modify an XML tree: - -|Event|Description| -|-----------|-----------------| -||Occurs just before this or any of its descendants is going to change.| -||Occurs when an has changed or any of its descendants have changed.| - -## Example - -### Description - Events are useful when you want to maintain some aggregate information in an XML tree. For example, you may want maintain an invoice total that is the sum of the line items of the invoice. This example uses events to maintain the total of all of the child elements under the complex element `Items`. - -### Code - -```csharp -XElement root = new XElement("Root", - new XElement("Total", "0"), - new XElement("Items") -); -XElement total = root.Element("Total"); -XElement items = root.Element("Items"); -items.Changed += (object sender, XObjectChangeEventArgs cea) => -{ - switch (cea.ObjectChange) - { - case XObjectChange.Add: - if (sender is XElement) - total.Value = ((int)total + (int)(XElement)sender).ToString(); - if (sender is XText) - total.Value = ((int)total + (int)((XText)sender).Parent).ToString(); - break; - case XObjectChange.Remove: - if (sender is XElement) - total.Value = ((int)total - (int)(XElement)sender).ToString(); - if (sender is XText) - total.Value = ((int)total - Int32.Parse(((XText)sender).Value)).ToString(); - break; - } - Console.WriteLine("Changed {0} {1}", - sender.GetType().ToString(), cea.ObjectChange.ToString()); -}; -items.SetElementValue("Item1", 25); -items.SetElementValue("Item2", 50); -items.SetElementValue("Item2", 75); -items.SetElementValue("Item3", 133); -items.SetElementValue("Item1", null); -items.SetElementValue("Item4", 100); -Console.WriteLine("Total:{0}", (int)total); -Console.WriteLine(root); -``` - -### Comments - This code produces the following output: - -```output -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XText Remove -Changed System.Xml.Linq.XText Add -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XElement Remove -Changed System.Xml.Linq.XElement Add -Total:308 - - 308 - - 75 - 133 - 100 - - -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-overview.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-overview.md deleted file mode 100644 index 38cc62c1d825c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-overview.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -title: "LINQ to XML Overview (C#)" -description: LINQ to XML leverages the .NET LINQ Framework to provide in-memory document modification capabilities and query expressions with functionality like XPath. -ms.date: 10/30/2018 -ms.assetid: 716b94d3-0091-4de1-8e05-41bc069fa9dd ---- -# LINQ to XML Overview (C#) - -LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. LINQ to XML uses .NET capabilities and is comparable to an updated, redesigned Document Object Model (DOM) XML programming interface. - -XML has been widely adopted as a way to format data in many contexts. For example, you can find XML on the Web, in configuration files, in Microsoft Office Word files, and in databases. - -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is an up-to-date, redesigned approach to programming with XML. It provides the in-memory document modification capabilities of the Document Object Model (DOM), and supports LINQ query expressions. Although these query expressions are syntactically different from XPath, they provide similar functionality. - -## LINQ to XML Developers - -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] targets a variety of developers. For an average developer who just wants to get something done, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] makes XML easier by providing a query experience that is similar to SQL. With just a bit of study, programmers can learn to write succinct and powerful queries in their programming language of choice. - -Professional developers can use [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to greatly increase their productivity. With [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], they can write less code that is more expressive, more compact, and more powerful. They can use query expressions from multiple data domains at the same time. - -## What Is LINQ to XML? - -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET programming languages. - -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] differs from DOM: It provides a new object model that is lighter weight and easier to work with, and that takes advantage of language features in C#. - -The most important advantage of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is its integration with Language-Integrated Query (LINQ). This integration enables you to write queries on the in-memory XML document to retrieve collections of elements and attributes. The query capability of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is comparable in functionality (although not in syntax) to XPath and XQuery. The integration of LINQ in C# provides stronger typing, compile-time checking, and improved debugger support. - -Another advantage of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is the ability to use query results as parameters to and object constructors enables a powerful approach to creating XML trees. This approach, called *functional construction*, enables developers to easily transform XML trees from one shape to another. - -For example, you might have a typical XML purchase order as described in [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml-1.md). By using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you could run the following query to obtain the part number attribute value for every item element in the purchase order: - -```csharp -// Load the XML file from our project directory containing the purchase orders -var filename = "PurchaseOrder.xml"; -var currentDirectory = Directory.GetCurrentDirectory(); -var purchaseOrderFilepath = Path.Combine(currentDirectory, filename); - -XElement purchaseOrder = XElement.Load(purchaseOrderFilepath); - -IEnumerable partNos = from item in purchaseOrder.Descendants("Item") - select (string) item.Attribute("PartNumber"); -``` - -This can be rewritten in method syntax form: - -```csharp -IEnumerable partNos = purchaseOrder.Descendants("Item").Select(x => (string) x.Attribute("PartNumber")); -``` - -As another example, you might want a list, sorted by part number, of the items with a value greater than $100. To obtain this information, you could run the following query: - -```csharp -// Load the XML file from our project directory containing the purchase orders -var filename = "PurchaseOrder.xml"; -var currentDirectory = Directory.GetCurrentDirectory(); -var purchaseOrderFilepath = Path.Combine(currentDirectory, filename); - -XElement purchaseOrder = XElement.Load(purchaseOrderFilepath); - -IEnumerable pricesByPartNos = from item in purchaseOrder.Descendants("Item") - where (int) item.Element("Quantity") * (decimal) item.Element("USPrice") > 100 - orderby (string)item.Element("PartNumber") - select item; -``` - -Again, this can be rewritten in method syntax form: - -```csharp -IEnumerable pricesByPartNos = purchaseOrder.Descendants("Item") - .Where(item => (int)item.Element("Quantity") * (decimal)item.Element("USPrice") > 100) - .OrderBy(order => order.Element("PartNumber")); -``` - -In addition to these LINQ capabilities, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides an improved XML programming interface. Using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can: - -- Load XML from [files](how-to-load-xml-from-a-file.md) or [streams](how-to-stream-xml-fragments-from-an-xmlreader.md). - -- Serialize XML to files or streams. - -- Create XML from scratch by using functional construction. - -- Query XML using XPath-like axes. - -- Manipulate the in-memory XML tree by using methods such as , , , and . - -- Validate XML trees using XSD. - -- Use a combination of these features to transform XML trees from one shape into another. - -## Creating XML Trees - -One of the most significant advantages of programming with [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is that it is easy to create XML trees. For example, to create a small XML tree, you can write code as follows: - -```csharp -XElement contacts = -new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144", - new XAttribute("Type", "Home")), - new XElement("phone", "425-555-0145", - new XAttribute("Type", "Work")), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) -); -``` - -For more information, see [Creating XML Trees (C#)](./creating-xml-trees-linq-to-xml-2.md). - -## See also - -- [Reference (LINQ to XML)](./reference-linq-to-xml.md) -- [LINQ to XML vs. DOM (C#)](./linq-to-xml-vs-dom.md) -- [LINQ to XML vs. Other XML Technologies](./linq-to-xml-vs-other-xml-technologies.md) -- diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-security.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-security.md deleted file mode 100644 index f43e788cf2e2f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-security.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: "LINQ to XML Security (C#)" -description: Learn about security issues associated with LINQ to XML, including some guidance for mitigating security exposure. -ms.date: 07/20/2015 -ms.assetid: ef2c0dc9-ecf9-4c17-b24e-144184ab725f ---- -# LINQ to XML Security (C#) -This topic describes security issues associated with LINQ to XML. In addition, it provides some guidance for mitigating security exposure. - -## LINQ to XML Security Overview - LINQ to XML is designed more for programming convenience than for server-side applications with stringent security requirements. Most XML scenarios consist of processing trusted XML documents, rather than processing untrusted XML documents that are uploaded to a server. LINQ to XML is optimized for these scenarios. - - If you must process untrusted data from unknown sources, Microsoft recommends that you use an instance of the class that has been configured to filter out known XML denial of service (DoS) attacks. - - If you have configured an to mitigate denial of service attacks, you can use that reader to populate a LINQ to XML tree and still benefit from the programmer productivity enhancements of LINQ to XML. Many mitigation techniques involve creating readers that are configured to mitigate the security issue, and then instantiating an XML tree through the configured reader. - - XML is intrinsically vulnerable to denial of service attacks because documents are unbounded in size, depth, element name size, and more. Regardless of the component that you use to process XML, you should always be prepared to recycle the application domain if it uses excessive resources. - -## Mitigation of XML, XSD, XPath, and XSLT Attacks - LINQ to XML is built upon and . LINQ to XML supports XSD and XPath through extension methods in the and namespaces. Using the , , and classes in conjunction with LINQ to XML, you can invoke XSLT to transform XML trees. - - If you are operating in a less secure environment, there are a number of security issues that are associated with XML and the use of the classes in , , , and . These issues include, but are not limited to, the following: - -- XSD, XPath, and XSLT are string-based languages in which you can specify operations that consume a lot of time or memory. It is the responsibility of application programmers who take XSD, XPath, or XSLT strings from untrusted sources to validate that the strings are not malicious, or to monitor and mitigate the possibility that evaluating these strings will lead to excessive system resource consumption. - -- XSD schemas (including inline schemas) are inherently vulnerable to denial of service attacks; you should not accept schemas from untrusted sources. - -- XSD and XSLT can include references to other files, and such references can result in cross-zone and cross-domain attacks. - -- External entities in DTDs can result in cross-zone and cross-domain attacks. - -- DTDs are vulnerable to denial of service attacks. - -- Exceptionally deep XML documents can pose denial of service issues; you might want to limit the depth of XML documents. - -- Do not accept supporting components, such as , , and objects, from untrusted assemblies. - -- Read data in chunks to mitigate large document attacks. - -- Script blocks in XSLT style sheets can expose a number of attacks. - -- Validate carefully before constructing dynamic XPath expressions. - -## LINQ to XML Security Issues - The security issues in this topic are not presented in any particular order. All issues are important and should be addressed as appropriate. - - A successful elevation of privilege attack gives a malicious assembly more control over its environment. A successful elevation of privilege attack can result in disclosure of data, denial of service, and more. - - Applications should not disclose data to users who are not authorized to see that data. - - Denial of service attacks cause the XML parser or LINQ to XML to consume excessive amounts of memory or CPU time. Denial of service attacks are considered to be less severe than elevation of privilege attacks or disclosure of data attacks. However, they are important in a scenario where a server needs to process XML documents from untrusted sources. - -### Exceptions and Error Messages Might Reveal Data - The description of an error might reveal data, such as the data being transformed, file names, or implementation details. Error messages should not be exposed to callers that are not trusted. You should catch all errors and report errors with your own custom error messages. - -### Do Not Call CodeAccessPermissions.Assert in an Event Handler - An assembly can have lesser or greater permissions. An assembly that has greater permissions has greater control over the computer and its environments. - - If code in an assembly with greater permissions calls in an event handler, and then the XML tree is passed to a malicious assembly that has restricted permissions, the malicious assembly can cause an event to be raised. Because the event runs code that is in the assembly with greater permissions, the malicious assembly would then be operating with elevated privileges. - - Microsoft recommends that you never call in an event handler. - -### DTDs are Not Secure - Entities in DTDs are inherently not secure. It is possible for a malicious XML document that contains a DTD to cause the parser to use all memory and CPU time, causing a denial of service attack. Therefore, in LINQ to XML, DTD processing is turned off by default. You should not accept DTDs from untrusted sources. - - One example of accepting DTDs from untrusted sources is a Web application that allows Web users to upload an XML file that references a DTD and a DTD file. Upon validation of the file, a malicious DTD could execute a denial of service attack on your server. Another example of accepting DTDs from untrusted sources is to reference a DTD on a network share that also allows anonymous FTP access. - -### Avoid Excessive Buffer Allocation - Application developers should be aware that extremely large data sources can lead to resource exhaustion and denial of service attacks. - - If a malicious user submits or uploads a very large XML document, it could cause LINQ to XML to consume excessive system resources. This can constitute a denial of service attack. To prevent this, you can set the property, and create a reader that is then limited in the size of document that it can load. You then use the reader to create the XML tree. - - For example, if you know that the maximum expected size of your XML documents coming from an untrusted source will be less than 50K bytes, set to 100,000. This will not encumber your processing of XML documents, and at the same time it will mitigate denial of service threats where documents might be uploaded that would consume large amounts of memory. - -### Avoid Excess Entity Expansion - One of the known denial of service attacks when using a DTD is a document that causes excessive entity expansion. To prevent this, you can set the property, and create a reader that is then limited in the number of characters that result from entity expansion. You then use the reader to create the XML tree. - -### Limit the Depth of the XML Hierarchy - One possible denial of service attack is when a document is submitted that has excessive depth of hierarchy. To prevent this, you can wrap a in your own class that counts the depth of elements. If the depth exceeds a predetermined reasonable level, you can terminate the processing of the malicious document. - -### Protect Against Untrusted XmlReader or XmlWriter Implementations - Administrators should verify that any externally supplied or implementations have strong names and have been registered in the machine configuration. This prevents malicious code masquerading as a reader or writer from being loaded. - -### Periodically Free Objects that Reference XName - To protect against certain kinds of attacks, application programmers should free all objects that reference an object in the application domain on a regular basis. - -### Protect Against Random XML Names - Applications that take data from untrusted sources should consider using an that is wrapped in custom code to inspect for the possibility of random XML names and namespaces. If such random XML names and namespaces are detected, the application can then terminate the processing of the malicious document. - - You might want to limit the number of names in any given namespace (including names in no namespace) to a reasonable limit. - -### Annotations Are Accessible by Software Components that Share a LINQ to XML Tree - LINQ to XML could be used to build processing pipelines in which different application components load, validate, query, transform, update, and save XML data that is passed between components as XML trees. This can help optimize performance, because the overhead of loading and serializing objects to XML text is done only at the ends of the pipeline. Developers must be aware, however, that all annotations and event handlers created by one component are accessible to other components. This can create a number of vulnerabilities if the components have different levels of trust. To build secure pipelines across less trusted components, you must serialize LINQ to XML objects to XML text before passing the data to an untrusted component. - - Some security is provided by the common language runtime (CLR). For example, a component that does not include a private class cannot access annotations keyed by that class. However, annotations can be deleted by components that cannot read them. This could be used as a tampering attack. - -## See also - -- [Programming Guide (LINQ to XML) (C#)](linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-dom.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-dom.md deleted file mode 100644 index ec382a4ff247f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-dom.md +++ /dev/null @@ -1,131 +0,0 @@ ---- -title: "LINQ to XML vs. DOM (C#)" -description: Learn about some key differences between LINQ to XML and the W3C Document Object Model (DOM) XML programming API. -ms.date: 07/20/2015 -ms.assetid: 51c0e3d2-c047-4e6a-a423-d61a882400b7 ---- -# LINQ to XML vs. DOM (C#) -This section describes some key differences between [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] and the current predominant XML programming API, the W3C Document Object Model (DOM). - -## New Ways to Construct XML Trees - In the W3C DOM, you build an XML tree from the bottom up; that is, you create a document, you create elements, and then you add the elements to the document. - - For example, the following would be a typical way to create an XML tree using the Microsoft implementation of DOM, : - -```csharp -XmlDocument doc = new XmlDocument(); -XmlElement name = doc.CreateElement("Name"); -name.InnerText = "Patrick Hines"; -XmlElement phone1 = doc.CreateElement("Phone"); -phone1.SetAttribute("Type", "Home"); -phone1.InnerText = "206-555-0144"; -XmlElement phone2 = doc.CreateElement("Phone"); -phone2.SetAttribute("Type", "Work"); -phone2.InnerText = "425-555-0145"; -XmlElement street1 = doc.CreateElement("Street1"); -street1.InnerText = "123 Main St"; -XmlElement city = doc.CreateElement("City"); -city.InnerText = "Mercer Island"; -XmlElement state = doc.CreateElement("State"); -state.InnerText = "WA"; -XmlElement postal = doc.CreateElement("Postal"); -postal.InnerText = "68042"; -XmlElement address = doc.CreateElement("Address"); -address.AppendChild(street1); -address.AppendChild(city); -address.AppendChild(state); -address.AppendChild(postal); -XmlElement contact = doc.CreateElement("Contact"); -contact.AppendChild(name); -contact.AppendChild(phone1); -contact.AppendChild(phone2); -contact.AppendChild(address); -XmlElement contacts = doc.CreateElement("Contacts"); -contacts.AppendChild(contact); -doc.AppendChild(contacts); -``` - - This style of coding does not visually provide much information about the structure of the XML tree. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] supports this approach to constructing an XML tree, but also supports an alternative approach, *functional construction*. Functional construction uses the and constructors to build an XML tree. - - Here is how you would construct the same XML tree by using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] functional construction: - -```csharp -XElement contacts = - new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144", - new XAttribute("Type", "Home")), - new XElement("phone", "425-555-0145", - new XAttribute("Type", "Work")), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) - ); -``` - - Notice that indenting the code to construct the XML tree shows the structure of the underlying XML. - - For more information, see [Creating XML Trees (C#)](./linq-to-xml-overview.md). - -## Working Directly with XML Elements - When you program with XML, your primary focus is usually on XML elements and perhaps on attributes. In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can work directly with XML elements and attributes. For example, you can do the following: - -- Create XML elements without using a document object at all. This simplifies programming when you have to work with fragments of XML trees. - -- Load `T:System.Xml.Linq.XElement` objects directly from an XML file. - -- Serialize `T:System.Xml.Linq.XElement` objects to a file or a stream. - - Compare this to the W3C DOM, in which the XML document is used as a logical container for the XML tree. In DOM, XML nodes, including elements and attributes, must be created in the context of an XML document. Here is a fragment of the code to create a name element in DOM: - -```csharp -XmlDocument doc = new XmlDocument(); -XmlElement name = doc.CreateElement("Name"); -name.InnerText = "Patrick Hines"; -doc.AppendChild(name); -``` - - If you want to use an element across multiple documents, you must import the nodes across documents. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] avoids this layer of complexity. - - When using LINQ to XML, you use the class only if you want to add a comment or processing instruction at the root level of the document. - -## Simplified Handling of Names and Namespaces - Handling names, namespaces, and namespace prefixes is generally a complex part of XML programming. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies names and namespaces by eliminating the requirement to deal with namespace prefixes. If you want to control namespace prefixes, you can. But if you decide to not explicitly control namespace prefixes, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] will assign namespace prefixes during serialization if they are required, or will serialize using default namespaces if they are not. If default namespaces are used, there will be no namespace prefixes in the resulting document. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). - - Another problem with the DOM is that it does not let you change the name of a node. Instead, you have to create a new node and copy all the child nodes to it, losing the original node identity. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] avoids this problem by enabling you to set the property on a node. - -## Static Method Support for Loading XML - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] lets you load XML by using static methods, instead of instance methods. This simplifies loading and parsing. For more information, see [How to load XML from a file (C#)](./how-to-load-xml-from-a-file.md). - -## Removal of Support for DTD Constructs - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] further simplifies XML programming by removing support for entities and entity references. The management of entities is complex, and is rarely used. Removing their support increases performance and simplifies the programming interface. When a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] tree is populated, all DTD entities are expanded. - -## Support for Fragments - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] does not provide an equivalent for the `XmlDocumentFragment` class. In many cases, however, the `XmlDocumentFragment` concept can be handled by the result of a query that is typed as of , or of . - -## Support for XPathNavigator - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides support for through extension methods in the namespace. For more information, see . - -## Support for White Space and Indentation - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] handles white space more simply than the DOM. - - A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can do this by preserving white space when you load or parse the XML and disabling formatting when you serialize the XML. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] stores white space as an node, instead of having a specialized node type, as the DOM does. - -## Support for Annotations - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] elements support an extensible set of annotations. This is useful for tracking miscellaneous information about an element, such as schema information, information about whether the element is bound to a UI, or any other kind of application-specific information. For more information, see [LINQ to XML Annotations](./linq-to-xml-annotations.md). - -## Support for Schema Information -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides support for XSD validation through extension methods in the namespace. You can validate that an XML tree complies with an XSD. You can populate the XML tree with the post-schema-validation infoset (PSVI). For more information, see [How to validate using XSD](./how-to-validate-using-xsd-linq-to-xml.md) and . - -## See also - -- [Getting Started (LINQ to XML)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md b/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md deleted file mode 100644 index 2df19234d500f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "LINQ to XML vs. Other XML Technologies3" -description: This article compares LINQ to XML to several XML technologies, including XmlReader, XSLT, MSXML, and XmlLite, to help you decide which technology to use. -ms.date: 07/20/2015 -ms.assetid: 01b8e746-12d3-471d-b811-7539e4547784 ---- -# LINQ to XML vs. Other XML Technologies -This topic compares [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to the following XML technologies: , XSLT, MSXML, and XmlLite. This information can help you decide which technology to use. - - For a comparison of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to the Document Object Model (DOM), see [LINQ to XML vs. DOM (C#)](./linq-to-xml-vs-dom.md). - -## LINQ to XML vs. XmlReader - is a fast, forward-only, non-caching parser. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is implemented on top of , and they are tightly integrated. However, you can also use by itself. - - For example, suppose you are building a Web service that will parse hundreds of XML documents per second, and the documents have the same structure, meaning that you only have to write one implementation of the code to parse the XML. In this case, you would probably want to use by itself. - - In contrast, if you are building a system that parses many smaller XML documents, and each one is different, you would want to take advantage of the productivity improvements that [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides. - -## LINQ to XML vs. XSLT - Both [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] and XSLT provide extensive XML document transformation capabilities. XSLT is a rule-based, declarative approach. Advanced XSLT programmers write XSLT in a functional programming style that emphasizes a stateless approach. Transformations can be written using pure functions that are implemented without side effects. This rule-based or functional approach is unfamiliar to many developers, and can be difficult and time-consuming to learn. - - XSLT can be a very productive system that yields high-performance applications. For example, some big Web companies use XSLT as a way to generate HTML from XML that has been pulled from a variety of data stores. The managed XSLT engine compiles XSLT to CLR code, and performs even better in some scenarios than the native XSLT engine. - - However, XSLT does not take advantage of the C# and Visual Basic knowledge that many developers have. It requires developers to write code in a different and complex programming language. Using two non-integrated development systems such as C# (or Visual Basic) and XSLT results in software systems that are more difficult to develop and maintain. - - After you have mastered [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query expressions, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] transformations are a powerful technology that is easy to use. Basically, you form your XML document by using functional construction, pulling in data from various sources, constructing objects dynamically, and assembling the whole into a new XML tree. The transformation can generate a completely new document. Constructing transformations in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is relatively easy and intuitive, and the resulting code is readable. This reduces development and maintenance costs. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is not intended to replace XSLT. XSLT is still the tool of choice for complicated and document-centric XML transformations, especially if the structure of the document is not well defined. - - XSLT has the advantage of being a World Wide Web Consortium (W3C) standard. If you have a requirement that you use only technologies that are standards, XSLT might be more appropriate. - - XSLT is XML, and therefore can be programmatically manipulated. - -## LINQ to XML vs. MSXML - MSXML is the COM-based technology for processing XML that is included with Microsoft Windows. MSXML provides a native implementation of the DOM with support for XPath and XSLT. It also contains the SAX2 non-caching, event-based parser. - - MSXML performs well, is secure by default in most scenarios, and can be accessed in Internet Explorer for performing client-side XML processing in AJAX-style applications. MSXML can be used from any programming language that supports COM, including C++, JavaScript, and Visual Basic 6.0. - - MSXML is not recommended for use in managed code based on the common language runtime (CLR). - -## LINQ to XML vs. XmlLite - XmlLite is a non-caching, forward only, pull parser. Developers primarily use XmlLite with C++. It is not recommended for developers to use XmlLite with managed code. - - The main advantage of XmlLite is that it is a lightweight, fast XML parser that is secure in most scenarios. Its threat surface area is very small. If you have to parse untrusted documents and you want to protect against attacks such as denial of service or exposure of data, XmlLite might be a good option. - - XmlLite is not integrated with Language-Integrated Query (LINQ). It does not yield the programmer productivity improvements that are the motivating force behind LINQ. - -## See also - -- [Getting Started (LINQ to XML)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/maintaining-name-value-pairs.md b/docs/csharp/programming-guide/concepts/linq/maintaining-name-value-pairs.md deleted file mode 100644 index e5ec6c5f854da..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/maintaining-name-value-pairs.md +++ /dev/null @@ -1,120 +0,0 @@ ---- -title: "Maintaining Name-Value Pairs (C#)" -description: LINQ to XML contains methods that make it easy to maintain name/value pairs, either as attributes or as a set of child elements. -ms.date: 07/20/2015 -ms.assetid: 7b04b0f1-af64-42eb-8737-83f8861b5915 ---- -# Maintaining Name/Value Pairs (C#) -Many applications have to maintain information that is best kept as name/value pairs. This information might be configuration information or global settings. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] contains some methods that make it easy to keep a set of name/value pairs. You can either keep the information as attributes or as a set of child elements. - - One difference between keeping the information as attributes or as child elements is that attributes have the constraint that there can be only one attribute with a particular name for an element. This limitation does not apply to child elements. - -## SetAttributeValue and SetElementValue - The two methods that facilitate keeping name/value pairs are and . These two methods have similar semantics. - - can add, modify, or remove attributes of an element. - -- If you call with a name of an attribute that does not exist, the method creates a new attribute and adds it to the specified element. - -- If you call with a name of an existing attribute and with some specified content, the contents of the attribute are replaced with the specified content. - -- If you call with a name of an existing attribute, and specify null for the content, the attribute is removed from its parent. - - can add, modify, or remove child elements of an element. - -- If you call with a name of a child element that does not exist, the method creates a new element and adds it to the specified element. - -- If you call with a name of an existing element and with some specified content, the contents of the element are replaced with the specified content. - -- If you call with a name of an existing element, and specify null for the content, the element is removed from its parent. - -## Example - The following example creates an element with no attributes. It then uses the method to create and maintain a list of name/value pairs. - -```csharp -// Create an element with no content. -XElement root = new XElement("Root"); - -// Add a number of name/value pairs as attributes. -root.SetAttributeValue("Top", 22); -root.SetAttributeValue("Left", 20); -root.SetAttributeValue("Bottom", 122); -root.SetAttributeValue("Right", 300); -root.SetAttributeValue("DefaultColor", "Color.Red"); -Console.WriteLine(root); - -// Replace the value of Top. -root.SetAttributeValue("Top", 10); -Console.WriteLine(root); - -// Remove DefaultColor. -root.SetAttributeValue("DefaultColor", null); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - - -``` - -## Example - The following example creates an element with no child elements. It then uses the method to create and maintain a list of name/value pairs. - -```csharp -// Create an element with no content. -XElement root = new XElement("Root"); - -// Add a number of name/value pairs as elements. -root.SetElementValue("Top", 22); -root.SetElementValue("Left", 20); -root.SetElementValue("Bottom", 122); -root.SetElementValue("Right", 300); -root.SetElementValue("DefaultColor", "Color.Red"); -Console.WriteLine(root); -Console.WriteLine("----"); - -// Replace the value of Top. -root.SetElementValue("Top", 10); -Console.WriteLine(root); -Console.WriteLine("----"); - -// Remove DefaultColor. -root.SetElementValue("DefaultColor", null); -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - 22 - 20 - 122 - 300 - Color.Red - ----- - - 10 - 20 - 122 - 300 - Color.Red - ----- - - 10 - 20 - 122 - 300 - -``` - -## See also - -- -- -- [Modifying XML Trees (LINQ to XML) (C#)](./in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md deleted file mode 100644 index 607f7a5c59d47..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md +++ /dev/null @@ -1,164 +0,0 @@ ---- -title: "Mixed Declarative Code-Imperative Code Bugs (LINQ to XML) (C#)" -description: LINQ to XML methods can modify an XML tree directly. Iterating through one of the axes while modifying the XML tree can give rise to odd bugs. -ms.date: 07/20/2015 -ms.assetid: fada62d0-0680-4e73-945a-2b00d7a507af ---- -# Mixed Declarative Code/Imperative Code Bugs (LINQ to XML) (C#) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] contains various methods that allow you to modify an XML tree directly. You can add elements, delete elements, change the contents of an element, add attributes, and so on. This programming interface is described in [Modifying XML Trees (LINQ to XML) (C#)](./in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md). If you are iterating through one of the axes, such as , and you are modifying the XML tree as you iterate through the axis, you can end up with some strange bugs. - - This problem is sometimes known as "The Halloween Problem". - -## Definition of the Problem - When you write some code using LINQ that iterates through a collection, you are writing code in a declarative style. It is more akin to describing *what* you want, rather that *how* you want to get it done. If you write code that 1) gets the first element, 2) tests it for some condition, 3) modifies it, and 4) puts it back into the list, then this would be imperative code. You are telling the computer *how* to do what you want done. - - Mixing these styles of code in the same operation is what leads to problems. Consider the following: - - Suppose you have a linked list with three items in it (a, b, and c): - - `a -> b -> c` - - Now, suppose that you want to move through the linked list, adding three new items (a', b', and c'). You want the resulting linked list to look like this: - - `a -> a' -> b -> b' -> c -> c'` - - So you write code that iterates through the list, and for every item, adds a new item right after it. What happens is that your code will first see the `a` element, and insert `a'` after it. Now, your code will move to the next node in the list, which is now `a'`! It happily adds a new item to the list, `a''`. - - How would you solve this in the real world? Well, you might make a copy of the original linked list, and create a completely new list. Or if you are writing purely imperative code, you might find the first item, add the new item, and then advance twice in the linked list, advancing over the element that you just added. - -## Adding While Iterating - For example, suppose you want to write some code that for every element in a tree, you want to create a duplicate element: - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -foreach (XElement e in root.Elements()) - root.Add(new XElement(e.Name, (string)e)); -``` - - This code goes into an infinite loop. The `foreach` statement iterates through the `Elements()` axis, adding new elements to the `doc` element. It ends up iterating also through the elements it just added. And because it allocates new objects with every iteration of the loop, it will eventually consume all available memory. - - You can fix this problem by pulling the collection into memory using the standard query operator, as follows: - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -foreach (XElement e in root.Elements().ToList()) - root.Add(new XElement(e.Name, (string)e)); -Console.WriteLine(root); -``` - - Now the code works. The resulting XML tree is the following: - -```xml - - 1 - 2 - 3 - 1 - 2 - 3 - -``` - -## Deleting While Iterating - If you want to delete all nodes at a certain level, you might be tempted to write code like the following: - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -foreach (XElement e in root.Elements()) - e.Remove(); -Console.WriteLine(root); -``` - - However, this does not do what you want. In this situation, after you have removed the first element, A, it is removed from the XML tree contained in root, and the code in the Elements method that is doing the iterating cannot find the next element. - - The preceding code produces the following output: - -```xml - - 2 - 3 - -``` - - The solution again is to call to materialize the collection, as follows: - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -foreach (XElement e in root.Elements().ToList()) - e.Remove(); -Console.WriteLine(root); -``` - - This produces the following output: - -```xml - -``` - - Alternatively, you can eliminate the iteration altogether by calling on the parent element: - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -root.RemoveAll(); -Console.WriteLine(root); -``` - -## Why Can't LINQ Automatically Handle This? - One approach would be to always bring everything into memory instead of doing lazy evaluation. However, it would be very expensive in terms of performance and memory use. In fact, if LINQ and (LINQ to XML) were to take this approach, it would fail in real-world situations. - - Another possible approach would be to put in some sort of transaction syntax into LINQ, and have the compiler attempt to analyze the code and determine if any particular collection needed to be materialized. However, attempting to determine all code that has side-effects is incredibly complex. Consider the following code: - -```csharp -var z = - from e in root.Elements() - where TestSomeCondition(e) - select DoMyProjection(e); -``` - - Such analysis code would need to analyze the methods TestSomeCondition and DoMyProjection, and all methods that those methods called, to determine if any code had side-effects. But the analysis code could not just look for any code that had side-effects. It would need to select for just the code that had side-effects on the child elements of `root` in this situation. - - LINQ to XML does not attempt to do any such analysis. - - It is up to you to avoid these problems. - -## Guidance - First, do not mix declarative and imperative code. - - Even if you know exactly the semantics of your collections and the semantics of the methods that modify the XML tree, if you write some clever code that avoids these categories of problems, your code will need to be maintained by other developers in the future, and they may not be as clear on the issues. If you mix declarative and imperative coding styles, your code will be more brittle. - - If you write code that materializes a collection so that these problems are avoided, note it with comments as appropriate in your code, so that maintenance programmers will understand the issue. - - Second, if performance and other considerations allow, use only declarative code. Don't modify your existing XML tree. Generate a new one. - -```csharp -XElement root = new XElement("Root", - new XElement("A", "1"), - new XElement("B", "2"), - new XElement("C", "3") -); -XElement newRoot = new XElement("Root", - root.Elements(), - root.Elements() -); -Console.WriteLine(newRoot); -``` diff --git a/docs/csharp/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md deleted file mode 100644 index 0e254f176605c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Namespaces Overview (LINQ to XML)" -description: Introduce yourself to namespaces, the XName class, the XNamespace class, and other aspects of XML names. -ms.date: 07/20/2015 -ms.assetid: 16283322-8238-4918-ab11-802ac6748eb7 ---- -# Namespaces Overview (LINQ to XML) - -This article introduces namespaces, the class, and the class. - -## XML Names - -XML names are often a source of complexity in XML programming. An XML name consists of an XML namespace (also called an XML namespace URI) and a local name. An XML namespace is similar to a namespace in a .NET program. It enables you to uniquely qualify the names of elements and attributes. This helps avoid name conflicts between various parts of an XML document. When you have declared an XML namespace, you can select a local name that only has to be unique within that namespace. - -Another aspect of XML names is XML *namespace prefixes*. XML prefixes cause most of the complexity of XML names. These prefixes enable you to create a shortcut for an XML namespace, which makes the XML document more concise and understandable. However, XML prefixes depend on their context to have meaning, which adds complexity. For example, the XML prefix `aw` could be associated with one XML namespace in one part of an XML tree, and with a different XML namespace in a different part of the XML tree. - -One of the advantages of using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] with C# is that you do not have to use XML prefixes. When [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] loads or parses an XML document, each XML prefix is resolved to its corresponding XML namespace. After that, when you work with a document that uses namespaces, you almost always access the namespaces through the namespace URI, and not through the namespace prefix. When developers work with XML names in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] they always work with a fully-qualified XML name (that is, an XML namespace and a local name). However, when necessary, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] allows you to work with and control namespace prefixes. - -In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], the class that represents XML names is . XML names appear frequently throughout the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] API, and wherever an XML name is required, you will find an parameter. However, you rarely work directly with an . contains an implicit conversion from string. - -For more information, see and . diff --git a/docs/csharp/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md deleted file mode 100644 index a0a25663441de..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md +++ /dev/null @@ -1,117 +0,0 @@ ---- -title: "Pre-Atomization of XName Objects (LINQ to XML) (C#)" -description: Learn about pre-atomization of XName objects. Pre-atomizing objects improves performance when creating a large XML tree in which specific names are repeated. -ms.date: 07/20/2015 -ms.assetid: e84fbbe7-f072-4771-bfbb-059d18e1ad15 ---- -# Pre-Atomization of XName Objects (LINQ to XML) (C#) -One way to improve performance in LINQ to XML is to pre-atomize objects. Pre-atomization means that you assign a string to an object before you create the XML tree by using the constructors of the and classes. Then, instead of passing a string to the constructor, which would use the implicit conversion from string to , you pass the initialized object. - - This improves performance when you create a large XML tree in which specific names are repeated. To do this, you declare and initialize objects before you construct the XML tree, and then use the objects instead of specifying strings for the element and attribute names. This technique can yield significant performance gains if you are creating a large number of elements (or attributes) with the same name. - - You should test pre-atomization with your scenario to decide if you should use it. - -## Example - The following example demonstrates this. - -```csharp -XName Root = "Root"; -XName Data = "Data"; -XName ID = "ID"; - -XElement root = new XElement(Root, - new XElement(Data, - new XAttribute(ID, "1"), - "4,100,000"), - new XElement(Data, - new XAttribute(ID, "2"), - "3,700,000"), - new XElement(Data, - new XAttribute(ID, "3"), - "1,150,000") -); - -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - 4,100,000 - 3,700,000 - 1,150,000 - -``` - - The following example shows the same technique where the XML document is in a namespace: - -```csharp -XNamespace aw = "http://www.adventure-works.com"; -XName Root = aw + "Root"; -XName Data = aw + "Data"; -XName ID = "ID"; - -XElement root = new XElement(Root, - new XAttribute(XNamespace.Xmlns + "aw", aw), - new XElement(Data, - new XAttribute(ID, "1"), - "4,100,000"), - new XElement(Data, - new XAttribute(ID, "2"), - "3,700,000"), - new XElement(Data, - new XAttribute(ID, "3"), - "1,150,000") -); - -Console.WriteLine(root); -``` - - This example produces the following output: - -```xml - - 4,100,000 - 3,700,000 - 1,150,000 - -``` - - The following example is more similar to what you will likely encounter in the real world. In this example, the content of the element is supplied by a query: - -```csharp -XName Root = "Root"; -XName Data = "Data"; -XName ID = "ID"; - -DateTime t1 = DateTime.Now; -XElement root = new XElement(Root, - from i in System.Linq.Enumerable.Range(1, 100000) - select new XElement(Data, - new XAttribute(ID, i), - i * 5) -); -DateTime t2 = DateTime.Now; - -Console.WriteLine("Time to construct:{0}", t2 - t1); -``` - - The previous example performs better than the following example, in which names are not pre-atomized: - -```csharp -DateTime t1 = DateTime.Now; -XElement root = new XElement("Root", - from i in System.Linq.Enumerable.Range(1, 100000) - select new XElement("Data", - new XAttribute("ID", i), - i * 5) -); -DateTime t2 = DateTime.Now; - -Console.WriteLine("Time to construct:{0}", t2 - t1); -``` - -## See also - -- [Atomized XName and XNamespace Objects (LINQ to XML) (C#)](./atomized-xname-and-xnamespace-objects-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml1.md b/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml1.md deleted file mode 100644 index 001a5f2f793eb..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml1.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Preserving White Space while Loading or Parsing XML" -description: Learn how to control white-space behavior while loading or parsing XML, specifically the behavior of methods that populate XML trees. -ms.date: 07/20/2015 -ms.assetid: f3ff58c4-55aa-4fcd-b933-e3a2ee6e706c ---- -# Preserving White Space while Loading or Parsing XML -This topic describes how to control the white-space behavior of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. - - This topic describes the white-space behavior of methods that populate XML trees. For information about controlling white space when you serialize XML trees, see [Preserving White Space While Serializing](./preserving-white-space-while-serializing.md). - -## Behavior of Methods that Populate XML Trees - The following methods in the and classes populate an XML tree. You can populate an XML tree from a file, a , an , or a string: - -- - -- - -- - -- - - If the method does not take as an argument, the method will not preserve insignificant white space. - - In most cases, if the method takes as an argument, you can optionally preserve insignificant white space as text nodes in the XML tree. However, if the method is loading the XML from an , then the determines whether white space will be preserved or not. Setting will have no effect. - - With these methods, if white space is preserved, insignificant white space is inserted into the XML tree as nodes. If white space is not preserved, text nodes are not inserted. - - You can create an XML tree by using an . Nodes that are written to the are populated in the tree. However, when you build an XML tree using this method, all nodes are preserved, regardless of whether the node is white space or not, or whether the white space is significant or not. - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-serializing.md b/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-serializing.md deleted file mode 100644 index 1ea969907e677..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/preserving-white-space-while-serializing.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Preserving White Space While Serializing3" -description: Learn how to control white space when serializing an XML tree using methods in the XElement and XDocument classes. -ms.date: 07/20/2015 -ms.assetid: 0c4f8b98-483b-4cf8-86be-fa146eef90dc ---- -# Preserving White Space While Serializing -This topic describes how to control white space when serializing an XML tree. - - A common scenario is to read indented XML, create an in-memory XML tree without any white-space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. - -## White-Space Behavior of Methods that Serialize XML Trees - The following methods in the and classes serialize an XML tree. You can serialize an XML tree to a file, a , or an . The `ToString` method serializes to a string. - -- - -- - -- [XElement.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) - -- [XDocument.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) - - If the method does not take as an argument, then the method will format (indent) the serialized XML. In this case, all insignificant white space in the XML tree is discarded. - - If the method does take as an argument, then you can specify that the method not format (indent) the serialized XML. In this case, all white space in the XML tree is preserved. diff --git a/docs/csharp/programming-guide/concepts/linq/programming-with-nodes.md b/docs/csharp/programming-guide/concepts/linq/programming-with-nodes.md deleted file mode 100644 index dbc8d75b96199..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/programming-with-nodes.md +++ /dev/null @@ -1,169 +0,0 @@ ---- -title: "Programming with Nodes (C#)" -description: Learn about programming with nodes. This allows developers to write programs that work at a finer level of detail than elements and attributes. -ms.date: 07/20/2015 -ms.assetid: c38df0f2-c805-431a-93ff-9103a4284c2f ---- -# Programming with Nodes (C#) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] developers who need to write programs such as an XML editor, a transform system, or a report writer often need to write programs that work at a finer level of granularity than elements and attributes. They often need to work at the node level, manipulating text nodes, processing instructions, and comments. This topic provides some details about programming at the node level. - -## Node Details - There are a number of details of programming that a programmer working at the node level should know. - -### Parent Property of Children Nodes of XDocument is Set to Null - The property contains the parent , not the parent node. Child nodes of have no parent . Their parent is the document, so the property for those nodes is set to null. - - The following example demonstrates this: - -```csharp -XDocument doc = XDocument.Parse(@""); -Console.WriteLine(doc.Nodes().OfType().First().Parent == null); -Console.WriteLine(doc.Root.Parent == null); -``` - - This example produces the following output: - -```output -True -True -``` - -### Adjacent Text Nodes are Possible - In a number of XML programming models, adjacent text nodes are always merged. This is sometimes called normalization of text nodes. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] does not normalize text nodes. If you add two text nodes to the same element, it will result in adjacent text nodes. However, if you add content specified as a string rather than as an node, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] might merge the string with an adjacent text node. - - The following example demonstrates this: - -```csharp -XElement xmlTree = new XElement("Root", "Content"); - -Console.WriteLine(xmlTree.Nodes().OfType().Count()); - -// this does not add a new text node -xmlTree.Add("new content"); -Console.WriteLine(xmlTree.Nodes().OfType().Count()); - -// this does add a new, adjacent text node -xmlTree.Add(new XText("more text")); -Console.WriteLine(xmlTree.Nodes().OfType().Count()); -``` - - This example produces the following output: - -```output -1 -1 -2 -``` - -### Empty Text Nodes are Possible - In some XML programming models, text nodes are guaranteed to not contain the empty string. The reasoning is that such a text node has no impact on serialization of the XML. However, for the same reason that adjacent text nodes are possible, if you remove the text from a text node by setting its value to the empty string, the text node itself will not be deleted. - -```csharp -XElement xmlTree = new XElement("Root", "Content"); -XText textNode = xmlTree.Nodes().OfType().First(); - -// the following line does not cause the removal of the text node. -textNode.Value = ""; - -XText textNode2 = xmlTree.Nodes().OfType().First(); -Console.WriteLine(">>{0}<<", textNode2); -``` - - This example produces the following output: - -```output ->><< -``` - -### An Empty Text Node Impacts Serialization - If an element contains only a child text node that is empty, it is serialized with the long tag syntax: ``. If an element contains no child nodes whatsoever, it is serialized with the short tag syntax: ``. - -```csharp -XElement child1 = new XElement("Child1", - new XText("") -); -XElement child2 = new XElement("Child2"); -Console.WriteLine(child1); -Console.WriteLine(child2); -``` - - This example produces the following output: - -```xml - - -``` - -### Namespaces are Attributes in the LINQ to XML Tree - Even though namespace declarations have identical syntax to attributes, in some programming interfaces, such as XSLT and XPath, namespace declarations are not considered to be attributes. However, in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], namespaces are stored as objects in the XML tree. If you iterate through the attributes for an element that contains a namespace declaration, you will see the namespace declaration as one of the items in the returned collection. - - The property indicates whether an attribute is a namespace declaration. - -```csharp -XElement root = XElement.Parse( -@""); -foreach (XAttribute att in root.Attributes()) - Console.WriteLine("{0} IsNamespaceDeclaration:{1}", att, att.IsNamespaceDeclaration); -``` - - This example produces the following output: - -```output -xmlns="http://www.adventure-works.com" IsNamespaceDeclaration:True -xmlns:fc="www.fourthcoffee.com" IsNamespaceDeclaration:True -AnAttribute="abc" IsNamespaceDeclaration:False -``` - -### XPath Axis Methods Do Not Return Child White Space of XDocument - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] allows for child text nodes of an , as long as the text nodes contain only white space. However, the XPath object model does not include white space as child nodes of a document, so when you iterate through the children of an using the axis, white-space text nodes will be returned. However, when you iterate through the children of an using the XPath axis methods, white-space text nodes will not be returned. - -```csharp -// Create a document with some white-space child nodes of the document. -XDocument root = XDocument.Parse( -@" - - - - -", LoadOptions.PreserveWhitespace); - -// count the white-space child nodes using LINQ to XML -Console.WriteLine(root.Nodes().OfType().Count()); - -// count the white-space child nodes using XPathEvaluate -Console.WriteLine(((IEnumerable)root.XPathEvaluate("text()")).OfType().Count()); -``` - - This example produces the following output: - -```output -3 -0 -``` - -### XDeclaration Objects are not Nodes - When you iterate through the children nodes of an , you will not see the XML declaration object. It is a property of the document, not a child node of it. - -```csharp -XDocument doc = new XDocument( - new XDeclaration("1.0", "utf-8", "yes"), - new XElement("Root") -); -doc.Save("Temp.xml"); -Console.WriteLine(File.ReadAllText("Temp.xml")); - -// this shows that there is only one child node of the document -Console.WriteLine(doc.Nodes().Count()); -``` - - This example produces the following output: - -```output - - -1 -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md b/docs/csharp/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md deleted file mode 100644 index 99e565f4f99b2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md +++ /dev/null @@ -1,232 +0,0 @@ ---- -title: "Projecting XML in a Different Shape (C#)" -description: Learn how to project XML in a different shape than the source XML. Review a code example that uses classes from the WindowsBase assembly. -ms.date: 07/20/2015 -ms.assetid: 4cb6b14a-32dc-4a2a-813e-bf9368fa8d86 ---- -# Projecting XML in a Different Shape (C#) -This topic shows an example of projecting XML that is in a different shape than the source XML. - - Many typical XML transformations consist of chained queries, as in this example. It is common to start with some form of XML, project intermediate results as collections of anonymous types or named types, and then finally to project the results back into XML that is in an entirely different shape than the source XML. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style and text of each paragraph. Finally, the example projects XML with a different shape. This example builds on the previous examples in this tutorial. The new statement that does the projection is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = ParagraphText(para.ParagraphNode) - }; - - // The following is the new code that projects XML in a new shape. - XElement root = new XElement("Root", - from p in paraWithText - select new XElement("Paragraph", - new XElement("StyleName", p.StyleName), - new XElement("Text", p.Text) - ) - ); - - Console.WriteLine(root); - } -} -``` - - This example produces the following output: - -```xml - - - Heading1 - Parsing WordprocessingML with LINQ to XML - - - Normal - - - - Normal - The following example prints to the console. - - - Normal - - - - Code - using System; - - - Code - - - - Code - class Program { - - - Code - public static void (string[] args) { - - - Code - Console.WriteLine("Hello World"); - - - Code - } - - - Code - } - - - Normal - - - - Normal - This example produces the following output: - - - Normal - - - - Code - Hello World - - -``` - -## Next Steps - In the next example, you'll query to find all the text in a Word document: - -- [Finding Text in Word Documents (C#)](./finding-text-in-word-documents.md) - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md b/docs/csharp/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md deleted file mode 100644 index 0697a8c90d86d..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: "Querying an XDocument vs. Querying an XElement (C#)" -description: Learn about the differences between querying an XDocument and querying an XElement. Review code examples that demonstrate these differences. -ms.date: 07/20/2015 -ms.assetid: 46221ff5-62ee-4de8-93ba-66465facb5c1 ---- -# Querying an XDocument vs. Querying an XElement (C#) -When you load a document via , you will notice that you have to write queries slightly differently than when you load via . - -## Comparison of XDocument.Load and XElement.Load - When you load an XML document into an via , the at the root of the XML tree contains the root element of the loaded document. However, when you load the same XML document into an via , the root of the tree is an node, and the root element of the loaded document is the one allowed child node of the . The [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axes operate relative to the root node. - - This first example loads an XML tree using . It then queries for the child elements of the root of the tree. - -```csharp -// Create a simple document and write it to a file -File.WriteAllText("Test.xml", @" - 1 - 2 - 3 -"); - -Console.WriteLine("Querying tree loaded with XElement.Load"); -Console.WriteLine("----"); -XElement doc = XElement.Load("Test.xml"); -IEnumerable childList = - from el in doc.Elements() - select el; -foreach (XElement e in childList) - Console.WriteLine(e); -``` - - As expected, this example produces the following output: - -```output -Querying tree loaded with XElement.Load ----- -1 -2 -3 -``` - - The following example is the same as the one above, with the exception that the XML tree is loaded into an instead of an . - -```csharp -// Create a simple document and write it to a file -File.WriteAllText("Test.xml", @" - 1 - 2 - 3 -"); - -Console.WriteLine("Querying tree loaded with XDocument.Load"); -Console.WriteLine("----"); -XDocument doc = XDocument.Load("Test.xml"); -IEnumerable childList = - from el in doc.Elements() - select el; -foreach (XElement e in childList) - Console.WriteLine(e); -``` - - This example produces the following output: - -```output -Querying tree loaded with XDocument.Load ----- - - 1 - 2 - 3 - -``` - - Notice that the same query returned the one `Root` node instead of the three child nodes. - - One approach to dealing with this is to use the property before accessing the axes methods, as follows: - -```csharp -// Create a simple document and write it to a file -File.WriteAllText("Test.xml", @" - 1 - 2 - 3 -"); - -Console.WriteLine("Querying tree loaded with XDocument.Load"); -Console.WriteLine("----"); -XDocument doc = XDocument.Load("Test.xml"); -IEnumerable childList = - from el in doc.Root.Elements() - select el; -foreach (XElement e in childList) - Console.WriteLine(e); -``` - - This query now performs in the same way as the query on the tree rooted in . The example produces the following output: - -```output -Querying tree loaded with XDocument.Load ----- -1 -2 -3 -``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/refactoring-into-pure-functions.md b/docs/csharp/programming-guide/concepts/linq/refactoring-into-pure-functions.md deleted file mode 100644 index f92c8ceb9fadf..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/refactoring-into-pure-functions.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "Refactoring Into Pure Functions (C#)" -description: Learn how to refactor code using pure functions. See code examples and view additional available resources. -ms.date: 07/20/2015 -ms.assetid: 2944a0d4-fd33-4e2e-badd-abb0f9be2fcc ---- -# Refactoring Into Pure Functions (C#) - -An important aspect of pure functional transformations is learning how to refactor code using pure functions. - -> [!NOTE] -> The common nomenclature in functional programming is that you refactor programs using pure functions. In Visual Basic and C++, this aligns with the use of functions in the respective languages. However, in C#, functions are called methods. For the purposes of this discussion, a pure function is implemented as a method in C#. - - As noted previously in this section, a pure function has two useful characteristics: - -- It has no side effects. The function does not change any variables or the data of any type outside of the function. - -- It is consistent. Given the same set of input data, it will always return the same output value. - - One way of transitioning to functional programming is to refactor existing code to eliminate unnecessary side effects and external dependencies. In this way, you can create pure function versions of existing code. - - This topic discusses what a pure function is and what it is not. The [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) tutorial shows how to manipulate a WordprocessingML document, and includes two examples of how to refactor using a pure function. - -## Eliminating Side Effects and External Dependencies - The following examples contrast two non-pure functions and a pure function. - -### Non-Pure Function that Changes a Class Member - In the following code, the `HyphenatedConcat` function is not a pure function, because it modifies the `aMember` data member in the class: - -```csharp -public class Program -{ - private static string aMember = "StringOne"; - - public static void HyphenatedConcat(string appendStr) - { - aMember += '-' + appendStr; - } - - public static void Main() - { - HyphenatedConcat("StringTwo"); - Console.WriteLine(aMember); - } -} -``` - - This code produces the following output: - -```output -StringOne-StringTwo -``` - - Note that it is irrelevant whether the data being modified has `public` or `private` access, or is a `static` member or an instance member. A pure function does not change any data outside of the function. - -### Non-Pure Function that Changes an Argument - Furthermore, the following version of this same function is not pure because it modifies the contents of its parameter, `sb`. - -```csharp -public class Program -{ - public static void HyphenatedConcat(StringBuilder sb, String appendStr) - { - sb.Append('-' + appendStr); - } - - public static void Main() - { - StringBuilder sb1 = new StringBuilder("StringOne"); - HyphenatedConcat(sb1, "StringTwo"); - Console.WriteLine(sb1); - } -} -``` - - This version of the program produces the same output as the first version, because the `HyphenatedConcat` function has changed the value (state) of its first parameter by invoking the member function. Note that this alteration occurs despite that fact that `HyphenatedConcat` uses call-by-value parameter passing. - -> [!IMPORTANT] -> For reference types, if you pass a parameter by value, it results in a copy of the reference to an object being passed. This copy is still associated with the same instance data as the original reference (until the reference variable is assigned to a new object). Call-by-reference is not necessarily required for a function to modify a parameter. - -### Pure Function -This next version of the program shows how to implement the `HyphenatedConcat` function as a pure function. - -```csharp -class Program -{ - public static string HyphenatedConcat(string s, string appendStr) - { - return (s + '-' + appendStr); - } - - public static void Main(string[] args) - { - string s1 = "StringOne"; - string s2 = HyphenatedConcat(s1, "StringTwo"); - Console.WriteLine(s2); - } -} -``` - - Again, this version produces the same line of output: `StringOne-StringTwo`. Note that to retain the concatenated value, it is stored in the intermediate variable `s2`. - - One approach that can be very useful is to write functions that are locally impure (that is, they declare and modify local variables) but are globally pure. Such functions have many of the desirable composability characteristics, but avoid some of the more convoluted functional programming idioms, such as having to use recursion when a simple loop would accomplish the same thing. - -## Standard Query Operators - An important characteristic of the standard query operators is that they are implemented as pure functions. - - For more information, see [Standard Query Operators Overview (C#)](./standard-query-operators-overview.md). - -## See also - -- [Introduction to Pure Functional Transformations (C#)](./introduction-to-pure-functional-transformations.md) -- [Functional Programming vs. Imperative Programming (C#)](./functional-programming-vs-imperative-programming.md) diff --git a/docs/csharp/programming-guide/concepts/linq/refactoring-using-a-pure-function.md b/docs/csharp/programming-guide/concepts/linq/refactoring-using-a-pure-function.md deleted file mode 100644 index ce73f9a0fffaa..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/refactoring-using-a-pure-function.md +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: "Refactoring Using a Pure Function (C#)" -description: Learn how to refactor code using a pure function. See code examples and view additional available resources. -ms.date: 07/20/2015 -ms.assetid: a3416a45-9e12-4e4a-9747-897f06eef510 ---- -# Refactoring Using a Pure Function (C#) -The following example refactors the previous example, [Refactoring Using an Extension Method (C#)](./refactoring-using-an-extension-method.md), to use a pure function. In this example, the code to find the text of a paragraph is moved to the pure static method `ParagraphText`. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The refactored code is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - // This is a new method that assembles the paragraph text. - public static string ParagraphText(XElement e) - { - XNamespace w = e.Name.Namespace; - return e - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(element => (string)element); - } - - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, - styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = ParagraphText(para.ParagraphNode) - }; - - foreach (var p in paraWithText) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); - } -} -``` - - This example produces the same output as before the refactoring: - -```output -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >using System;< -StyleName:Code >< -StyleName:Code >class Program {< -StyleName:Code > public static void (string[] args) {< -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code > }< -StyleName:Code >}< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - -### Next Steps - The next example shows how to project XML into a different shape: - -- [Projecting XML in a Different Shape (C#)](./projecting-xml-in-a-different-shape.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) -- [Refactoring Using an Extension Method (C#)](./refactoring-using-an-extension-method.md) -- [Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md) diff --git a/docs/csharp/programming-guide/concepts/linq/refactoring-using-an-extension-method.md b/docs/csharp/programming-guide/concepts/linq/refactoring-using-an-extension-method.md deleted file mode 100644 index 07dda4afc105c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/refactoring-using-an-extension-method.md +++ /dev/null @@ -1,247 +0,0 @@ ---- -title: "Refactoring Using an Extension Method (C#)" -description: Learn how to refactor code using an extension method. See code examples and view additional available resources. -ms.date: 07/20/2015 -ms.assetid: c5fc123d-af10-4a2f-b8e4-db921efb2639 ---- -# Refactoring Using an Extension Method (C#) -This example builds on the previous example, [Retrieving the Text of the Paragraphs (C#)](./retrieving-the-text-of-the-paragraphs.md), by refactoring the concatenation of strings using a pure function that is implemented as an extension method. - - The previous example used the standard query operator to concatenate multiple strings into one string. However, it is more convenient to write an extension method to do this, because the resulting query smaller and more simple. - -## Example - This example processes a WordprocessingML document, retrieving the paragraphs, the style of each paragraph, and the text of each paragraph. This example builds on the previous examples in this tutorial. - - The example contains multiple overloads of the `StringConcatenate` method. - - You can find instructions for creating the source document for this example in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} -``` - -## Example - There are four overloads of the `StringConcatenate` method. One overload simply takes a collection of strings and returns a single string. Another overload can take a collection of any type, and a delegate that projects from a singleton of the collection to a string. There are two more overloads that allow you to specify a separator string. - - The following code uses all four overloads. - -```csharp -string[] numbers = { "one", "two", "three" }; - -Console.WriteLine("{0}", numbers.StringConcatenate()); -Console.WriteLine("{0}", numbers.StringConcatenate(":")); - -int[] intNumbers = { 1, 2, 3 }; -Console.WriteLine("{0}", intNumbers.StringConcatenate(i => i.ToString())); -Console.WriteLine("{0}", intNumbers.StringConcatenate(i => i.ToString(), ":")); -``` - - This example produces the following output: - -```output -onetwothree -one:two:three: -123 -1:2:3: -``` - -## Example - Now, the example can be modified to take advantage of the new extension method: - -```csharp -public static class LocalExtensions -{ - public static string StringConcatenate(this IEnumerable source) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (string s in source) - sb.Append(s).Append(separator); - return sb.ToString(); - } - - public static string StringConcatenate(this IEnumerable source, - Func func, string separator) - { - StringBuilder sb = new StringBuilder(); - foreach (T item in source) - sb.Append(func(item)).Append(separator); - return sb.ToString(); - } -} - -class Program -{ - static void Main(string[] args) - { - const string fileName = "SampleDoc.docx"; - - const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; - const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; - const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; - XNamespace w = wordmlNamespace; - - XDocument xDoc = null; - XDocument styleDoc = null; - - using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) - { - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } - } - - string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph" && - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - - // Find all paragraphs in the document. - var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - - // Retrieve the text of each paragraph. - var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = para - .ParagraphNode - .Elements(w + "r") - .Elements(w + "t") - .StringConcatenate(e => (string)e) - }; - - foreach (var p in paraWithText) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); - } -} -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - -```output -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >using System;< -StyleName:Code >< -StyleName:Code >class Program {< -StyleName:Code > public static void (string[] args) {< -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code > }< -StyleName:Code >}< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - - Note that this refactoring is a variant of refactoring into a pure function. The next topic will introduce the idea of factoring into pure functions in more detail. - -## Next Steps - The next example shows how to refactor this code in another way, by using pure functions: - -- [Refactoring Using a Pure Function (C#)](./refactoring-using-a-pure-function.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) -- [Refactoring Into Pure Functions (C#)](./refactoring-into-pure-functions.md) diff --git a/docs/csharp/programming-guide/concepts/linq/reference-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/reference-linq-to-xml.md deleted file mode 100644 index 69a0014273a60..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/reference-linq-to-xml.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Reference (LINQ to XML)" -description: View links to LINQ to XML reference topics. These links include documentation for LINQ to XML classes and extension methods. -ms.date: 07/20/2015 -ms.assetid: 815b45e2-3527-4dee-9986-b1277a693cde ---- -# Reference (LINQ to XML) -This topic contains links to the LINQ to XML reference topics. - -## In This Section - For reference documentation for the LINQ to XML classes, see . - - For reference documentation for the extension methods that help you validate XML trees against an XSD file, see . - - For reference documentation for the extension methods that enable you to evaluate XPath queries on an XML tree, see . - -## See also - -- [LINQ to XML (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md b/docs/csharp/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md deleted file mode 100644 index d140a65ac22ec..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: "Removing Elements, Attributes, and Nodes from an XML Tree (C#)" -description: Learn how to remove elements, attributes, and nodes from an XML tree. See a list of removal methods and a code example. -ms.date: 07/20/2015 -ms.assetid: 07dd06d6-1117-4077-bf98-9120cf51176e ---- -# Removing Elements, Attributes, and Nodes from an XML Tree (C#) - -You can modify an XML tree, removing elements, attributes, and other types of nodes. - -Removing a single element or a single attribute from an XML document is straightforward. However, when removing collections of elements or attributes, you should first materialize a collection into a list, and then delete the elements or attributes from the list. The best approach is to use the extension method, which will do this for you. - -The main reason for doing this is that most of the collections you retrieve from an XML tree are yielded using deferred execution. If you do not first materialize them into a list, or if you do not use the extension methods, it is possible to encounter a certain class of bugs. For more information, see [Mixed Declarative Code/Imperative Code Bugs (LINQ to XML) (C#)](./mixed-declarative-code-imperative-code-bugs-linq-to-xml.md). - -The following methods remove nodes and attributes from an XML tree. - -|Method|Description| -|------------|-----------------| -||Removes an from its parent.| -||Removes the child nodes from an .| -||Removes content and attributes from an .| -||Removes the attributes of an .| -||If you pass `null` for value, then removes the attribute.| -||If you pass `null` for value, then removes the child element.| -||Removes an from its parent.| -||Removes every attribute or element in the source collection from its parent element.| - -## Example - -### Description - -This example demonstrates three approaches to removing elements. First, it removes a single element. Second, it retrieves a collection of elements, materializes them using the operator, and removes the collection. Finally, it retrieves a collection of elements and removes them using the extension method. - -For more information on the operator, see [Converting Data Types (C#)](./converting-data-types.md). - -### Code - -```csharp -XElement root = XElement.Parse(@" - - - - - - - - - - - - - - - -"); -root.Element("Child1").Element("GrandChild1").Remove(); -root.Element("Child2").Elements().ToList().Remove(); -root.Element("Child3").Elements().Remove(); -Console.WriteLine(root); -``` - -### Comments - -This code produces the following output: - -```xml - - - - - - - - -``` - -Notice that the first grandchild element has been removed from `Child1`. All grandchildren elements have been removed from `Child2` and from `Child3`. diff --git a/docs/csharp/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md b/docs/csharp/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md deleted file mode 100644 index d775a66f30e56..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: "Retrieving the Paragraphs and Their Styles (C#)" -description: Learn how to write a query that retrieves paragraphs, and then identifies the style of each paragraph. -ms.date: 07/20/2015 -ms.assetid: c2f767f8-57b1-4b4b-af04-89ffb1f7067d ---- -# Retrieving the Paragraphs and Their Styles (C#) -In this example, we write a query that retrieves the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. - - This query builds on the query in the previous example, [Finding the Default Paragraph Style (C#)](./finding-the-default-paragraph-style.md), which retrieves the default style from the list of styles. This information is required so that the query can identify the style of paragraphs that do not have a style explicitly set. Paragraph styles are set through the `w:pPr` element; if a paragraph does not contain this element, it is formatted with the default style. - - This topic explains the significance of some pieces of the query, then shows the query as part of a complete, working example. - -## Example - The source of the query to retrieve all the paragraphs in a document and their styles is as follows: - -```csharp -xDoc.Root.Element(w + "body").Descendants(w + "p") -``` - - This expression is similar to the source of the query in the previous example, [Finding the Default Paragraph Style (C#)](./finding-the-default-paragraph-style.md). The main difference is that it uses the axis instead of the axis. The query uses the axis because in documents that have sections, the paragraphs will not be the direct children of the body element; rather, the paragraphs will be two levels down in the hierarchy. By using the axis, the code will work of whether or not the document uses sections. - -## Example - The query uses a `let` clause to determine the element that contains the style node. If there is no element, then `styleNode` is set to `null`: - -```csharp -let styleNode = para.Elements(w + "pPr").Elements(w + "pStyle").FirstOrDefault() -``` - - The `let` clause first uses the axis to find all elements named `pPr`, then uses the extension method to find all child elements named `pStyle`, and finally uses the standard query operator to convert the collection to a singleton. If the collection is empty, `styleNode` is set to `null`. This is a useful idiom to look for the `pStyle` descendant node. Note that if the `pPr` child node does not exist, the code does nor fail by throwing an exception; instead, `styleNode` is set to `null`, which is the desired behavior of this `let` clause. - - The query projects a collection of an anonymous type with two members, `StyleName` and `ParagraphNode`. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - - You can find instructions for creating the source document for this example in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```csharp -const string fileName = "SampleDoc.docx"; - -const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; -const string stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; -const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; -XNamespace w = wordmlNamespace; - -XDocument xDoc = null; -XDocument styleDoc = null; - -using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) -{ - PackageRelationship docPackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } -} - -string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph"&& - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - -// Following is the new query that finds all paragraphs in the -// document and their styles. -var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - -foreach (var p in paragraphs) - Console.WriteLine("StyleName:{0}", p.StyleName); -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - -```output -StyleName:Heading1 -StyleName:Normal -StyleName:Normal -StyleName:Normal -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Normal -StyleName:Normal -StyleName:Normal -StyleName:Code -``` - -## Next Steps - In the next topic, [Retrieving the Text of the Paragraphs (C#)](./retrieving-the-text-of-the-paragraphs.md), you'll create a query to retrieve the text of paragraphs. - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) diff --git a/docs/csharp/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md b/docs/csharp/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md deleted file mode 100644 index b8c2bb5a0ac5f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: "Retrieving the Text of the Paragraphs (C#)" -description: Learn how to use LINQ queries to get the text of each paragraph in a WordprocessingML document as a string in C#. This example uses chained queries. -ms.date: 07/20/2015 -ms.assetid: 127d635e-e559-408f-90c8-2bb621ca50ac ---- -# Retrieving the Text of the Paragraphs (C#) -This example builds on the previous example, [Retrieving the Paragraphs and Their Styles (C#)](./retrieving-the-paragraphs-and-their-styles.md). This new example retrieves the text of each paragraph as a string. - - To retrieve the text, this example adds an additional query that iterates through the collection of anonymous types and projects a new collection of an anonymous type with the addition of a new member, `Text`. It uses the standard query operator to concatenate multiple strings into one string. - - This technique (that is, first projecting to a collection of an anonymous type, then using this collection to project to a new collection of an anonymous type) is a common and useful idiom. This query could have been written without projecting to the first anonymous type. However, because of lazy evaluation, doing so does not use much additional processing power. The idiom creates more short lived objects on the heap, but this does not substantially degrade performance. - - Of course, it would be possible to write a single query that contains the functionality to retrieve the paragraphs, the style of each paragraph, and the text of each paragraph. However, it often is useful to break up a more complicated query into multiple queries because the resulting code is more modular and easier to maintain. Furthermore, if you need to reuse a portion of the query, it is easier to refactor if the queries are written in this manner. - - These queries, which are chained together, use the processing model that is examined in detail in the topic [Tutorial: Chaining Queries Together (C#)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -## Example - This example processes a WordprocessingML document, determining the element node, the style name, and the text of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```csharp -const string fileName = "SampleDoc.docx"; - -const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; -const string stylesRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; -const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; -XNamespace w = wordmlNamespace; - -XDocument xDoc = null; -XDocument styleDoc = null; - -using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) -{ - PackageRelationship docPackageRelationship = - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); - if (docPackageRelationship != null) - { - Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), - docPackageRelationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); - - // Find the styles part. There will only be one. - PackageRelationship styleRelation = - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); - if (styleRelation != null) - { - Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); - PackagePart stylePart = wdPackage.GetPart(styleUri); - - // Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); - } - } -} - -string defaultStyle = - (string)( - from style in styleDoc.Root.Elements(w + "style") - where (string)style.Attribute(w + "type") == "paragraph"&& - (string)style.Attribute(w + "default") == "1" - select style - ).First().Attribute(w + "styleId"); - -// Find all paragraphs in the document. -var paragraphs = - from para in xDoc - .Root - .Element(w + "body") - .Descendants(w + "p") - let styleNode = para - .Elements(w + "pPr") - .Elements(w + "pStyle") - .FirstOrDefault() - select new - { - ParagraphNode = para, - StyleName = styleNode != null ? - (string)styleNode.Attribute(w + "val") : - defaultStyle - }; - -// Following is the new query that retrieves the text of -// each paragraph. -var paraWithText = - from para in paragraphs - select new - { - ParagraphNode = para.ParagraphNode, - StyleName = para.StyleName, - Text = para - .ParagraphNode - .Elements(w + "r") - .Elements(w + "t") - .Aggregate( - new StringBuilder(), - (s, i) => s.Append((string)i), - s => s.ToString() - ) - }; - -foreach (var p in paraWithText) - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (C#)](./creating-the-source-office-open-xml-document.md). - -```output -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >using System;< -StyleName:Code >< -StyleName:Code >class Program {< -StyleName:Code > public static void (string[] args) {< -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code > }< -StyleName:Code >}< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - -## Next Steps - The next example shows how to use an extension method, instead of , to concatenate multiple strings into a single string. - -- [Refactoring Using an Extension Method (C#)](./refactoring-using-an-extension-method.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](shape-of-wordprocessingml-documents.md) -- [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md deleted file mode 100644 index 5d472acc566e4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "Sample XML File: Books (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains information about books. -ms.date: 07/20/2015 -ms.assetid: b75ab1a2-fb76-4df9-bd01-c45ec22a29ef ---- -# Sample XML File: Books (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. The file contains information about books. - -## books.xml - -```xml - - - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md deleted file mode 100644 index e9f38ba53080f..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md +++ /dev/null @@ -1,140 +0,0 @@ ---- -title: "Sample XML File: Consolidated Purchase Orders2" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains purchase orders with different shapes from multiple companies. -ms.date: 07/20/2015 -ms.assetid: 9d9698a5-95f2-4564-813b-ba536cdf3bfb ---- -# Sample XML File: Consolidated Purchase Orders -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a set of purchase orders with different shapes from multiple companies. Purchase orders from each company are in separate namespaces. - -## ConsolidatedPurchaseOrders.xml - -```xml - - - -

- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - - - -
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
- Please notify by email before shipping. - - - Power Supply - 1 - 45.99 - - -
- -
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA -
- Please do not deliver on Saturday. - - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - -
- - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md deleted file mode 100644 index 129617387b0ad..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md +++ /dev/null @@ -1,426 +0,0 @@ ---- -title: "Sample XML File: Customers and Orders in a Namespace" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains customers and orders. The XML is in a namespace. -ms.date: 07/20/2015 -ms.assetid: 2da1c474-f658-4dca-a457-c35ef5ba4aff ---- -# Sample XML File: Customers and Orders in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains customers and orders. The XML is in a namespace. - -## CustomersOrdersInNamespace.xml - -```xml - - - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - (509) 555-6221 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
- - - GREAL - 6 - 1997-05-06T00:00:00 - 1997-05-20T00:00:00 - - 2 - 3.35 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 8 - 1997-07-04T00:00:00 - 1997-08-01T00:00:00 - - 2 - 4.42 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 1 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 116.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 18.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 6 - 1997-09-04T00:00:00 - 1997-10-02T00:00:00 - - 1 - 57.15 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1997-09-25T00:00:00 - 1997-10-23T00:00:00 - - 3 - 76.13 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-01-06T00:00:00 - 1998-02-03T00:00:00 - - 2 - 719.78 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-03-09T00:00:00 - 1998-04-06T00:00:00 - - 2 - 33.68 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-04-07T00:00:00 - 1998-05-05T00:00:00 - - 2 - 25.19 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-22T00:00:00 - 1998-05-20T00:00:00 - - 3 - 18.84 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-30T00:00:00 - 1998-06-11T00:00:00 - - 3 - 14.01 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - HUNGC - 3 - 1996-12-06T00:00:00 - 1997-01-03T00:00:00 - - 2 - 20.12 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 1 - 1996-12-25T00:00:00 - 1997-01-22T00:00:00 - - 3 - 30.34 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 3 - 1997-01-15T00:00:00 - 1997-02-12T00:00:00 - - 1 - 0.2 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 4 - 1997-07-16T00:00:00 - 1997-08-13T00:00:00 - - 1 - 45.13 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 8 - 1997-09-08T00:00:00 - 1997-10-06T00:00:00 - - 1 - 111.29 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - LAZYK - 1 - 1997-03-21T00:00:00 - 1997-04-18T00:00:00 - - 3 - 7.48 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LAZYK - 8 - 1997-05-22T00:00:00 - 1997-06-19T00:00:00 - - 2 - 11.92 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LETSS - 1 - 1997-06-25T00:00:00 - 1997-07-23T00:00:00 - - 2 - 13.73 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 8 - 1997-10-27T00:00:00 - 1997-11-24T00:00:00 - - 2 - 51.44 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 6 - 1997-11-10T00:00:00 - 1997-12-08T00:00:00 - - 2 - 45.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 4 - 1998-02-12T00:00:00 - 1998-03-12T00:00:00 - - 2 - 90.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - -
-``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml-2.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml-2.md deleted file mode 100644 index c956501b384d4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml-2.md +++ /dev/null @@ -1,430 +0,0 @@ ---- -title: "Sample XML File: Customers and Orders (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains customers and orders. -ms.date: 07/20/2015 -ms.assetid: d6d1c9ea-be74-4e6d-bfdd-d4bcc2d301cf ---- -# Sample XML File: Customers and Orders (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains customers and orders. - - The topic [Sample XSD File: Customers and Orders](./sample-xsd-file-customers-and-orders1.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - - For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to join two collections (LINQ to XML) (C#)](./how-to-join-two-collections-linq-to-xml.md). - -## CustomersOrders.xml - -```xml - - - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - (509) 555-6221 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
- - - GREAL - 6 - 1997-05-06T00:00:00 - 1997-05-20T00:00:00 - - 2 - 3.35 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 8 - 1997-07-04T00:00:00 - 1997-08-01T00:00:00 - - 2 - 4.42 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 1 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 116.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 18.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 6 - 1997-09-04T00:00:00 - 1997-10-02T00:00:00 - - 1 - 57.15 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1997-09-25T00:00:00 - 1997-10-23T00:00:00 - - 3 - 76.13 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-01-06T00:00:00 - 1998-02-03T00:00:00 - - 2 - 719.78 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-03-09T00:00:00 - 1998-04-06T00:00:00 - - 2 - 33.68 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-04-07T00:00:00 - 1998-05-05T00:00:00 - - 2 - 25.19 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-22T00:00:00 - 1998-05-20T00:00:00 - - 3 - 18.84 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-30T00:00:00 - 1998-06-11T00:00:00 - - 3 - 14.01 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - HUNGC - 3 - 1996-12-06T00:00:00 - 1997-01-03T00:00:00 - - 2 - 20.12 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 1 - 1996-12-25T00:00:00 - 1997-01-22T00:00:00 - - 3 - 30.34 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 3 - 1997-01-15T00:00:00 - 1997-02-12T00:00:00 - - 1 - 0.2 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 4 - 1997-07-16T00:00:00 - 1997-08-13T00:00:00 - - 1 - 45.13 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 8 - 1997-09-08T00:00:00 - 1997-10-06T00:00:00 - - 1 - 111.29 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - LAZYK - 1 - 1997-03-21T00:00:00 - 1997-04-18T00:00:00 - - 3 - 7.48 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LAZYK - 8 - 1997-05-22T00:00:00 - 1997-06-19T00:00:00 - - 2 - 11.92 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LETSS - 1 - 1997-06-25T00:00:00 - 1997-07-23T00:00:00 - - 2 - 13.73 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 8 - 1997-10-27T00:00:00 - 1997-11-24T00:00:00 - - 2 - 51.44 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 6 - 1997-11-10T00:00:00 - 1997-12-08T00:00:00 - - 2 - 45.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 4 - 1998-02-12T00:00:00 - 1998-03-12T00:00:00 - - 2 - 90.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - -
-``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md deleted file mode 100644 index 5a8354d5465d1..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: "Sample XML File: Multiple Purchase Orders in a Namespace2" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains several purchase orders. The XML is in a namespace. -ms.date: 07/20/2015 -ms.assetid: 595024f2-374a-4615-acb5-64fa1600f377 ---- -# Sample XML File: Multiple Purchase Orders in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains several purchase orders. The XML is in a namespace. - -## PurchaseOrdersInNamespace.xml - -```xml - - - - - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - - Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - - - - - Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA - - - Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA - - Please notify me before shipping. - - - Power Supply - 1 - 45.99 - - - - - - Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA - - - Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA - - - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md deleted file mode 100644 index 4b9cf89d1a96c..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md +++ /dev/null @@ -1,105 +0,0 @@ ---- -title: "Sample XML File: Multiple Purchase Orders (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains several purchase orders. -ms.date: 07/20/2015 -ms.assetid: 2d29fcaa-60df-43d4-8ccc-6cdba7c013e9 ---- -# Sample XML File: Multiple Purchase Orders (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains several purchase orders. - -## PurchaseOrders.xml - -```xml - - - -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - -
- -
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
- Please notify me before shipping. - - - Power Supply - 1 - 45.99 - - -
- -
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA -
- - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - -
-
-``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md deleted file mode 100644 index adb98a89f97da..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Sample XML File: Numerical Data in a Namespace3" -description: This XML file is used in various examples in the LINQ to XML documentation. It contains data for summing, averaging, and grouping. The XML is in a namespace. -ms.date: 07/20/2015 -ms.assetid: 51750cab-3c66-4511-90fb-b9d211308d31 ---- -# Sample XML File: Numerical Data in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains numerical data for summing, averaging, and grouping. The XML is in a namespace. - -## Data - -```xml - - 7.25 - - A - 3 - 24.50 - - - B - 1 - 89.99 - - - A - 5 - 4.95 - - - A - 3 - 66.00 - - - B - 10 - .99 - - - A - 15 - 29.00 - - - B - 8 - 6.99 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md deleted file mode 100644 index 1945f4ffb7457..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Sample XML File: Numerical Data (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file contains numerical data for summing, averaging, and grouping. -ms.date: 07/20/2015 -ms.assetid: 365cae86-a166-46df-b56a-0209d9771c27 ---- -# Sample XML File: Numerical Data (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains numerical data for summing, averaging, and grouping. - -## Data.xml - -```xml - - 7.25 - - A - 3 - 24.50 - - - B - 1 - 89.99 - - - A - 5 - 4.95 - - - A - 3 - 66.00 - - - B - 10 - .99 - - - A - 15 - 29.00 - - - B - 8 - 6.99 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace1.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace1.md deleted file mode 100644 index 7bbbbb18a7b90..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace1.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "Sample XML File: Test Configuration in a Namespace" -description: This XML file is used in various examples in the LINQ to XML documentation. The file is a test configuration file. The XML is in a namespace. -ms.date: 07/20/2015 -ms.assetid: e75ad1bc-5636-4623-9a34-a286a8c485d6 ---- -# Sample XML File: Test Configuration in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This is a test configuration file. The XML is in a namespace. - -## TestConfigInNamespace.xml - -```xml - - - - Convert number to string - Examp1.EXE - 1 - One - - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - - - Count characters - FinalExamp.EXE - This is a test - 14 - - - Another Test - Examp2.EXE - Test Input - 10 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md deleted file mode 100644 index df7877dd1ff06..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "Sample XML File: Test Configuration (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file is a test configuration file. -ms.date: 07/20/2015 -ms.assetid: 45bfb509-c1d4-4b4f-9690-1cb0c9816516 ---- -# Sample XML File: Test Configuration (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This is a test configuration file. - -## TestConfig.xml - -```xml - - - - Convert number to string - Examp1.EXE - 1 - One - - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - - - Count characters - FinalExamp.EXE - This is a test - 14 - - - Another Test - Examp2.EXE - Test Input - 10 - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md deleted file mode 100644 index b25d6484f0322..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Sample XML File: Typical Purchase Order in a Namespace" -description: This XML file is used in various examples in the LINQ to XML documentation. The file is a typical purchase order. The XML is in a namespace. -ms.date: 07/20/2015 -ms.assetid: 84dc3339-ea32-4ccc-9af6-ab38ddfecced ---- -# Sample XML File: Typical Purchase Order in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a typical purchase order. The XML is in a namespace. - -## PurchaseOrderInNamespace.xml - -```xml - - - - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - - Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1.md b/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1.md deleted file mode 100644 index e22fe9889be99..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Sample XML File: Typical Purchase Order (LINQ to XML)" -description: This XML file is used in various examples in the LINQ to XML documentation. The file is a typical purchase order. -ms.date: 07/20/2015 -ms.assetid: dcbfb859-24fc-4758-b01c-51d1b6f644e6 ---- -# Sample XML File: Typical Purchase Order (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a typical purchase order. - -## PurchaseOrder.xml - -```xml - - -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - -
-``` - \ No newline at end of file diff --git a/docs/csharp/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders1.md b/docs/csharp/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders1.md deleted file mode 100644 index a81531b73d7da..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders1.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: "Sample XSD File: Customers and Orders" -description: This XSD file is used in various examples in the LINQ to XML documentation. It is a schema definition for a sample XML file that contains customers and orders. -ms.date: 07/20/2015 -ms.assetid: ef9911a3-7ac4-44fd-b36e-a0c0ad0a157d ---- -# Sample XSD File: Customers and Orders -The following XSD file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains a schema definition for the [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). The schema uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - - For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to join two collections (LINQ to XML) (C#)](./how-to-join-two-collections-linq-to-xml.md). - -## CustomersOrders.xsd - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/scope-of-default-namespaces.md b/docs/csharp/programming-guide/concepts/linq/scope-of-default-namespaces.md deleted file mode 100644 index d25b52b7f444e..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/scope-of-default-namespaces.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: "Scope of Default Namespaces in C#" -description: Learn how query in default XML namespaces in LINQ to XML in C#. Use an XNamespace variable and the local name to make a qualified name for the query. -ms.date: 07/20/2015 -ms.assetid: fe826236-830f-457a-9027-7ad62c909fae ---- -# Scope of Default Namespaces in C\# -Default namespaces as represented in the XML tree are not in scope for queries. If you have XML that is in a default namespace, you still must declare an variable, and combine it with the local name to make a qualified name to be used in the query. - - One of the most common problems when querying XML trees is that if the XML tree has a default namespace, the developer sometimes writes the query as though the XML were not in a namespace. - - The first set of examples in this topic shows a typical way that XML in a default namespace is loaded, but is queried improperly. - - The second set of examples show the necessary corrections so that you can query XML in a namespace. - -## Example - This example shows the creation of XML in a namespace, and a query that returns an empty result set. - -### Code - -```csharp -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -IEnumerable c1 = - from el in root.Elements("Child") - select el; -Console.WriteLine("Result set follows:"); -foreach (XElement el in c1) - Console.WriteLine((int)el); -Console.WriteLine("End of result set"); -``` - -### Comments - This example produces the following result: - -```output -Result set follows: -End of result set -``` - -## Example - This example shows the creation of XML in a namespace, and a query that is coded properly. - - In contrast to the incorrectly coded example above, the correct approach when using C# is to declare and initialize an object, and to use it when specifying objects. In this case, the argument to the method is an object. - -### Code - -```csharp -XElement root = XElement.Parse( -@" - 1 - 2 - 3 - 4 - 5 - 6 -"); -XNamespace aw = "http://www.adventure-works.com"; -IEnumerable c1 = - from el in root.Elements(aw + "Child") - select el; -Console.WriteLine("Result set follows:"); -foreach (XElement el in c1) - Console.WriteLine((int)el); -Console.WriteLine("End of result set"); -``` - -### Comments - This example produces the following result: - -```output -Result set follows: -1 -2 -3 -End of result set -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md) diff --git a/docs/csharp/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md b/docs/csharp/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md deleted file mode 100644 index 54252d2f04fd6..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: "Serializing to an XmlReader (Invoking XSLT) (C#)" -description: Learn how to use CreateReader to create an XmlReader in C#. The module that reads from this XmlReader reads the nodes from the XML tree and processes them. -ms.date: 07/20/2015 -ms.assetid: 4cc3ee03-ef4c-429b-a408-fedd10b728cd ---- -# Serializing to an XmlReader (Invoking XSLT) (C#) -When you use the interoperability capabilities of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can use to create an . The module that reads from this reads the nodes from the XML tree and processes them accordingly. - -## Invoking an XSLT Transformation - One possible use for this method is when invoking an XSLT transformation. You can create an XML tree, create an from the XML tree, create a new document, and then create an to write into the new document. Then, you can invoke the XSLT transformation, passing in and . After the transformation successfully completes, the new XML tree is populated with the results of the transformation. - -```csharp -string xslMarkup = @" - - - - - - - - - - - -"; - -XDocument xmlTree = new XDocument( - new XElement("Parent", - new XElement("Child1", "Child1 data"), - new XElement("Child2", "Child2 data") - ) -); - -XDocument newTree = new XDocument(); -using (XmlWriter writer = newTree.CreateWriter()) { - // Load the style sheet. - XslCompiledTransform xslt = new XslCompiledTransform(); - xslt.Load(XmlReader.Create(new StringReader(xslMarkup))); - - // Execute the transformation and output the results to a writer. - xslt.Transform(xmlTree.CreateReader(), writer); -} - -Console.WriteLine(newTree); -``` - - This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- [Serializing XML Trees (C#)](serializing-to-files-textwriters-and-xmlwriters.md) diff --git a/docs/csharp/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md b/docs/csharp/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md deleted file mode 100644 index 869293e79dc14..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: "Serializing with an XML Declaration (C#)" -description: Learn about the configurations in which serialization in C# generates an XML declaration, including serializing to a file, TextWriter, and XmlWriter. -ms.date: 07/20/2015 -ms.assetid: c237fa4a-a042-40fd-886f-17b54c66bb75 ---- -# Serializing with an XML Declaration (C#) -This topic describes how to control whether serialization generates an XML declaration. - -## XML Declaration Generation - Serializing to a or a using the method or the method generates an XML declaration. When you serialize to an , the writer settings (specified in an object) determine whether an XML declaration is generated or not. - - If you are serializing to a string using the `ToString` method, the resulting XML will not include an XML declaration. - -### Serializing with an XML Declaration - The following example creates an , saves the document to a file, and then prints the file to the console: - -```csharp -XElement root = new XElement("Root", - new XElement("Child", "child content") -); -root.Save("Root.xml"); -string str = File.ReadAllText("Root.xml"); -Console.WriteLine(str); -``` - - This example produces the following output: - -```xml - - - child content - -``` - -### Serializing without an XML Declaration - The following example shows how to save an to an . - -```csharp -StringBuilder sb = new StringBuilder(); -XmlWriterSettings xws = new XmlWriterSettings(); -xws.OmitXmlDeclaration = true; - -using (XmlWriter xw = XmlWriter.Create(sb, xws)) { - XElement root = new XElement("Root", - new XElement("Child", "child content") - ); - root.Save(xw); -} -Console.WriteLine(sb.ToString()); -``` - - This example produces the following output: - -```xml -child content -``` - -## See also - -- [Serializing XML Trees (C#)](serializing-to-files-textwriters-and-xmlwriters.md) diff --git a/docs/csharp/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md b/docs/csharp/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md deleted file mode 100644 index 5c27858b6a819..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md +++ /dev/null @@ -1,94 +0,0 @@ ---- -title: "Shape of WordprocessingML Documents (C#)" -description: Learn about the format of a WordprocessingML document. Several C# examples use a WordprocessingML document. -ms.date: 07/20/2015 -ms.assetid: 3791b5e0-c502-469b-bb75-a7bf6fdd0a94 ---- -# Shape of WordprocessingML Documents (C#) -This topic introduces the XML shape of a WordprocessingML document. - -## Microsoft Office Formats - The native file format for the 2007 Microsoft Office system is Office Open XML (commonly called Open XML). Open XML is an XML-based format that an Ecma standard and is currently going through the ISO-IEC standards process. The markup language for word processing files within Open XML is called WordprocessingML. This tutorial uses WordprocessingML source files as input for the examples. - - If you are using Microsoft Office 2003, you can save documents in the Office Open XML format if you have installed the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. - -## The Shape of WordprocessingML Documents - The first thing to understand is the shape of WordprocessingML documents. A WordprocessingML document contains a body element (named `w:body`) that contains the paragraphs of the document. Each paragraph contains one or more text runs (named `w:r`). Each text run contains one or more text pieces (named `w:t`). - - The following is a very simple WordprocessingML document: - -```xml - - - - - - This is a paragraph. - - - - - This is another paragraph. - - - - -``` - - This document contains two paragraphs. They both contain a single text run, and each text run contains a single text piece. - - The easiest way to see the contents of a WordprocessingML document in XML form is to create one using Microsoft Word, save it, and then run the following program that prints the XML to the console. - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```csharp -const string documentRelationshipType = - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; -const string wordmlNamespace = - "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; -XNamespace w = wordmlNamespace; - -using (Package wdPackage = Package.Open("SampleDoc.docx", FileMode.Open, FileAccess.Read)) -{ - PackageRelationship relationship = - wdPackage - .GetRelationshipsByType(documentRelationshipType) - .FirstOrDefault(); - if (relationship != null) - { - Uri documentUri = - PackUriHelper.ResolvePartUri( - new Uri("/", UriKind.Relative), - relationship.TargetUri); - PackagePart documentPart = wdPackage.GetPart(documentUri); - - // Get the officeDocument part from the package. - // Load the XML in the part into an XDocument instance. - XDocument xdoc = - XDocument.Load(XmlReader.Create(documentPart.GetStream())); - Console.WriteLine(xdoc.Root); - } -} -``` - -## External resources - -- [Introducing the Office (2007) Open XML File Formats](https://docs.microsoft.com/previous-versions/office/developer/office-2007/aa338205%28v=office.12%29) -- [Overview of WordprocessingML](https://docs.microsoft.com/previous-versions/office/developer/office-2003/aa212812%28v=office.11%29) -- [Anatomy of a WordProcessingML File](http://officeopenxml.com/anatomyofOOXML.php) -- [Introduction to WordprocessingML](https://ericwhite.com/blog/introduction-to-wordprocessingml-series/) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (C#)](./shape-of-wordprocessingml-documents.md) diff --git a/docs/csharp/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md b/docs/csharp/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md deleted file mode 100644 index d8a9e217544be..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "Statically Compiled Queries (LINQ to XML) (C#)" -description: Learn about statically compiled queries in LINQ to XML in C# and how they differ from XPath queries, which must be interpreted at runtime. -ms.date: 07/20/2015 -ms.assetid: 3bf558fe-0705-479d-86d4-00188f5fcf9c ---- -# Statically Compiled Queries (LINQ to XML) (C#) -One of the most important performance benefits LINQ to XML, as opposed to , is that queries in LINQ to XML are statically compiled, whereas XPath queries must be interpreted at run time. This feature is built in to LINQ to XML, so you do not have to perform extra steps to take advantage of it, but it is helpful to understand the distinction when choosing between the two technologies. This topic explains the difference. - -## Statically Compiled Queries vs. XPath - The following example shows how to get the descendant elements with a specified name, and with an attribute with a specified value. - - The following is the equivalent XPath expression: `//Address[@Type='Shipping']` - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -IEnumerable list1 = - from el in po.Descendants("Address") - where (string)el.Attribute("Type") == "Shipping" - select el; - -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - The query expression in this example is re-written by the compiler to method-based query syntax. The following example, which is written in method-based query syntax, produces the same results as the previous one: - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -IEnumerable list1 = - po - .Descendants("Address") - .Where(el => (string)el.Attribute("Type") == "Shipping"); - -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - The method is an extension method. For more information, see [Extension Methods](../../classes-and-structs/extension-methods.md). Because is an extension method, the query above is compiled as though it were written as follows: - -```csharp -XDocument po = XDocument.Load("PurchaseOrders.xml"); - -IEnumerable list1 = - System.Linq.Enumerable.Where( - po.Descendants("Address"), - el => (string)el.Attribute("Type") == "Shipping"); - -foreach (XElement el in list1) - Console.WriteLine(el); -``` - - This example produces exactly the same results as the previous two examples. This illustrates the fact that queries are effectively compiled into statically linked method calls. This, combined with the deferred execution semantics of iterators, improves performance. For more information about the deferred execution semantics of iterators, see [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -> [!NOTE] -> These examples are representative of the code that the compiler might write. The actual implementation might differ slightly from these examples, but the performance will be the same or similar to these examples. - -## Executing XPath Expressions with XmlDocument - The following example uses to accomplish the same results as the previous examples: - -```csharp -XmlReader reader = XmlReader.Create("PurchaseOrders.xml"); -XmlDocument doc = new XmlDocument(); -doc.Load(reader); -XmlNodeList nl = doc.SelectNodes(".//Address[@Type='Shipping']"); -foreach (XmlNode n in nl) - Console.WriteLine(n.OuterXml); -reader.Close(); -``` - - This query returns the same output as the examples that use LINQ to XML; the only difference is that LINQ to XML indents the printed XML, whereas does not. - - However, the approach generally does not perform as well as LINQ to XML, because the method must do the following internally every time it is called: - -- It parses the string that contains the XPath expression, breaking the string into tokens. - -- It validates the tokens to make sure that the XPath expression is valid. - -- It translates the expression into an internal expression tree. - -- It iterates through the nodes, appropriately selecting the nodes for the result set based on the evaluation of the expression. - - This is significantly more than the work done by the corresponding LINQ to XML query. The specific performance difference varies for different types of queries, but in general LINQ to XML queries do less work, and therefore perform better, than evaluating XPath expressions using . diff --git a/docs/csharp/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md b/docs/csharp/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md deleted file mode 100644 index 78757601a47d9..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: "Style Part of a WordprocessingML Document" -description: Learn about the style part of an Office Open XML WordprocessingML document. Use the default style identifier to identify paragraphs that have the default style. -ms.date: 07/20/2015 -ms.assetid: 5458bccf-3898-4661-904b-7d280c9239a9 ---- -# Style Part of a WordprocessingML Document -This topic shows an example of the style part of the Office Open XML WordprocessingML document. - -## Example - The following example is the XML that makes up the style part of an Office Open XML WordprocessingML document. - - The default paragraph style has an element with the following opening tag: - -```xml - -``` - - You need to know this information when you write the query to find the default style identifier, so that the query can identify the style of paragraphs that have the default style. - - Note that these documents are very simple when compared to typical documents that Microsoft Word generates. In many cases, Word saves a great deal of additional information, additional formatting and metadata. Furthermore, Word does not format the lines to be easily readable as in this example; instead, the XML is saved without indentation. However, all WordprocessingML documents share the same basic XML shape. Because of this, the queries presented in this tutorial will work with more complicated documents. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md b/docs/csharp/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md deleted file mode 100644 index f918bd60c217b..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "Using XSLT to Transform an XML Tree (C#)" -description: Learn how to use XSLT to transform an XML tree in C# by invoking the XSLT transform on instances of XmlReader and XmlWriter. -ms.date: 07/20/2015 -ms.assetid: 373a2699-d4c5-471b-9bda-c1f0ab73b477 ---- -# Using XSLT to Transform an XML Tree (C#) -You can create an XML tree, create an from the XML tree, create a new document, and create an that will write into the new document. Then, you can invoke the XSLT transformation, passing the and to the transformation. After the transformation successfully completes, the new XML tree is populated with the results of the transform. - -## Example - -```csharp -string xslt = @" - - - - - - - - - - - - "; - -var oldDocument = new XDocument( - new XElement("Parent", - new XElement("Child1", "Child1 data"), - new XElement("Child2", "Child2 data") - ) -); - -var newDocument = new XDocument(); - -using (var stringReader = new StringReader(xslt)) -{ - using (XmlReader xsltReader = XmlReader.Create(stringReader)) - { - var transformer = new XslCompiledTransform(); - transformer.Load(xsltReader); - using (XmlReader oldDocumentReader = oldDocument.CreateReader()) - { - using (XmlWriter newDocumentWriter = newDocument.CreateWriter()) - { - transformer.Transform(oldDocumentReader, newDocumentWriter); - } - } - } -} - -string result = newDocument.ToString(); -Console.WriteLine(result); -``` - - This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- -- diff --git a/docs/csharp/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects3.md b/docs/csharp/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects3.md deleted file mode 100644 index d599021211fb4..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects3.md +++ /dev/null @@ -1,88 +0,0 @@ ---- -title: "Valid Content of XElement and XDocument Objects3" -description: Learn about the valid arguments that can be passed to constructors and methods that you use to add content to elements and documents. -ms.date: 07/20/2015 -ms.assetid: 0d253586-2b97-459f-b1a7-f30f38f3ed9f ---- -# Valid Content of XElement and XDocument Objects -This topic describes the valid arguments that can be passed to constructors and methods that you use to add content to elements and documents. - -## Valid Content - Queries often evaluate to of or of . You can pass collections of or objects to the constructor. Therefore, it is convenient to pass the results of a query as content into methods and constructors that you use to populate XML trees. - - When adding simple content, various types can be passed to this method. Valid types include the following: - -- - -- - -- - -- - -- - -- - -- - -- - -- Any type that implements `Object.ToString`. - -- Any type that implements . - - When adding complex content, various types can be passed to this method: - -- - -- - -- - -- Any type that implements - - If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. If the collection contains text (or objects that are converted to text), the text in the collection is concatenated and added as a single text node. - - If content is `null`, nothing is added. When passing a collection items in the collection can be `null`. A `null` item in the collection has no effect on the tree. - - An added attribute must have a unique name within its containing element. - - When adding or objects, if the new content has no parent, then the objects are simply attached to the XML tree. If the new content already is parented and is part of another XML tree, then the new content is cloned, and the newly cloned content is attached to the XML tree. - -## Valid Content for Documents - Attributes and simple content cannot be added to a document. - - There are not many scenarios that require you to create an . Instead, you can usually create your XML trees with an root node. Unless you have a specific requirement to create a document (for example, because you have to create processing instructions and comments at the top level, or you have to support document types), it is often more convenient to use as your root node. - - Valid content for a document includes the following: - -- Zero or one objects. The document types must come before the element. - -- Zero or one element. - -- Zero or more comments. - -- Zero or more processing instructions. - -- Zero or more text nodes that contain only white space. - -## Constructors and Functions that Allow Adding Content - The following methods allow you to add child content to an or an : - -|Method|Description| -|------------|-----------------| -||Constructs an .| -||Constructs a .| -||Adds to the end of the child content of the or .| -||Adds content after the .| -||Adds content before the .| -||Adds content at the beginning of the child content of the .| -||Replaces all content (child nodes and attributes) of an .| -||Replaces the attributes of an .| -||Replaces the children nodes with new content.| -||Replaces a node with new content.| - -## See also - -- [Creating XML Trees (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md b/docs/csharp/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md deleted file mode 100644 index b93680cbf35d1..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: "WordprocessingML Document with Styles" -description: This example WordprocessingML document has paragraphs that are formatted with styles. Learn about the document parts that pertain to styles. -ms.date: 07/20/2015 -ms.assetid: 40e35de6-ac93-4bba-88ab-a018cbe93873 ---- -# WordprocessingML Document with Styles -More complicated WordprocessingML documents have paragraphs that are formatted with styles. - - A few notes about the makeup of WordprocessingML documents are helpful. WordprocessingML documents are stored in packages. Packages have multiple parts (parts have an explicit meaning when used in the context of packages; essentially, parts are files that are zipped together to comprise a package). If a document contains paragraphs that are formatted with styles, there will be a document part that contains paragraphs that have styles applied to them. There will also be a style part that contains the styles that are referred to by the document. - - When accessing packages, it is important that you do so through the relationships between parts, rather than using an arbitrary path. This issue is beyond the scope of the Manipulating Content in a WordprocessingML Document tutorial, but the example programs that are included in this tutorial demonstrate the correct approach. - -## A Document that Uses Styles - The WordML example presented in the [Shape of WordprocessingML Documents (C#)](./shape-of-wordprocessingml-documents.md) topic is a very simple one. The following document is more complicated: It has paragraphs that are formatted with styles. The easiest way to see the XML that makes up an Office Open XML document is to run the [Example that Outputs Office Open XML Document Parts (C#)](./example-that-outputs-office-open-xml-document-parts.md). - - In the following document, the first paragraph has the style `Heading1`. There are a number of paragraphs that have the default style. There are also a number of paragraphs that have the style `Code`. Because of this relative complexity, this is a more interesting document to parse with LINQ to XML. - - In those paragraphs with non-default styles, the paragraph elements have a child element named `w:pPr`, which in turn has a child element `w:pStyle`. That element has an attribute, `w:val`, which contains the style name. If the paragraph has the default style, it means that the paragraph element does not have a `w:p.Pr` child element. - -```xml - - - - - - - - - Parsing WordprocessingML with LINQ to XML - - - - - - The following example prints to the console. - - - - - - - - - using System; - - - - - - - - - - - - - class Program { - - - - - - - - public static void - - - - Main - - - - (string[] args) { - - - - - - - - Console.WriteLine("Hello World"); - - - - - - - - } - - - - - - - - } - - - - - - This example produces the following output: - - - - - - - - - Hello World - - - - - - - - - - -``` diff --git a/docs/csharp/programming-guide/concepts/linq/xattribute-class-overview.md b/docs/csharp/programming-guide/concepts/linq/xattribute-class-overview.md deleted file mode 100644 index dbe724840a3f2..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/xattribute-class-overview.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "XAttribute Class Overview (C#)" -description: Attributes are name/value pairs associated with an element. XAttribute represents XML attributes. Learn about working with attributes in LINQ to XML in C#. -ms.date: 07/20/2015 -ms.assetid: 5a630f24-f9ad-400e-831e-c14ebfc9e142 ---- -# XAttribute Class Overview (C#) -Attributes are name/value pairs that are associated with an element. The class represents XML attributes. - -## Overview - Working with attributes in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is similar to working with elements. Their constructors are similar. The methods that you use to retrieve collections of them are similar. A LINQ query expression for a collection of attributes looks very similar to a LINQ query expression for a collection of elements. - - The order in which attributes were added to an element is preserved. That is, when you iterate through the attributes, you see them in the same order that they were added. - -## The XAttribute Constructor - The following constructor of the class is the one that you will most commonly use: - -|Constructor|Description| -|-----------------|-----------------| -|`XAttribute(XName name, object content)`|Creates an object. The `name` argument specifies the name of the attribute; `content` specifies the content of the attribute.| - -### Creating an Element with an Attribute - The following code shows the common task of creating an element that contains an attribute: - -```csharp -XElement phone = new XElement("Phone", - new XAttribute("Type", "Home"), - "555-555-5555"); -Console.WriteLine(phone); -``` - - This example produces the following output: - -```xml -555-555-5555 -``` - -### Functional Construction of Attributes - You can construct objects in-line with the construction of objects, as follows: - -```csharp -XElement c = new XElement("Customers", - new XElement("Customer", - new XElement("Name", "John Doe"), - new XElement("PhoneNumbers", - new XElement("Phone", - new XAttribute("type", "home"), - "555-555-5555"), - new XElement("Phone", - new XAttribute("type", "work"), - "666-666-6666") - ) - ) -); -Console.WriteLine(c); -``` - - This example produces the following output: - -```xml - - - John Doe - - 555-555-5555 - 666-666-6666 - - - -``` - -### Attributes Are Not Nodes - There are some differences between attributes and elements. objects are not nodes in the XML tree. They are name/value pairs associated with an XML element. In contrast to the Document Object Model (DOM), this more closely reflects the structure of XML. Although objects are not actually nodes in the XML tree, working with objects is very similar to working with objects. - - This distinction is primarily important only to developers who are writing code that works with XML trees at the node level. Many developers will not be concerned with this distinction. - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/xdocument-class-overview.md b/docs/csharp/programming-guide/concepts/linq/xdocument-class-overview.md deleted file mode 100644 index 3b209df959fad..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/xdocument-class-overview.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "XDocument Class Overview (C#)" -description: The XDocument class in C# contains the information necessary for a valid XML document, including an XML declaration, processing instructions, and comments. -ms.date: 07/20/2015 -ms.assetid: 63305603-ab54-49fc-84e4-f76eecc59549 ---- -# XDocument Class Overview (C#) -This topic introduces the class. - -## Overview of the XDocument class - The class contains the information necessary for a valid XML document. This includes an XML declaration, processing instructions, and comments. - - Note that you only have to create objects if you require the specific functionality provided by the class. In many circumstances, you can work directly with . Working directly with is a simpler programming model. - - derives from . Therefore, it can contain child nodes. However, objects can have only one child node. This reflects the XML standard that there can be only one root element in an XML document. - -## Components of XDocument - An can contain the following elements: - -- One object. enables you to specify the pertinent parts of an XML declaration: the XML version, the encoding of the document, and whether the XML document is stand-alone. - -- One object. This is the root node of the XML document. - -- Any number of objects. A processing instruction communicates information to an application that processes the XML. - -- Any number of objects. The comments will be siblings to the root element. The object cannot be the first argument in the list, because it is not valid for an XML document to start with a comment. - -- One for the DTD. - - When you serialize an , even if `XDocument.Declaration` is `null`, the output will have an XML declaration if the writer has `Writer.Settings.OmitXmlDeclaration` set to `false` (the default). - - By default, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] sets the version to "1.0", and sets the encoding to "utf-8". - -## Using XElement without XDocument - As previously mentioned, the class is the main class in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] programming interface. In many cases, your application will not require that you create a document. By using the class, you can create an XML tree, add other XML trees to it, modify the XML tree, and save it. - -## Using XDocument - To construct an , use functional construction, just like you do to construct objects. - - The following code creates an object and its associated contained objects. - -```csharp -XDocument d = new XDocument( - new XComment("This is a comment."), - new XProcessingInstruction("xml-stylesheet", - "href='mystyle.css' title='Compact' type='text/css'"), - new XElement("Pubs", - new XElement("Book", - new XElement("Title", "Artifacts of Roman Civilization"), - new XElement("Author", "Moreno, Jordao") - ), - new XElement("Book", - new XElement("Title", "Midieval Tools and Implements"), - new XElement("Author", "Gazit, Inbar") - ) - ), - new XComment("This is another comment.") -); -d.Declaration = new XDeclaration("1.0", "utf-8", "true"); -Console.WriteLine(d); - -d.Save("test.xml"); -``` - - When you examine the file test.xml, you get the following output: - -```xml - - - - - - Artifacts of Roman Civilization - Moreno, Jordao - - - Midieval Tools and Implements - Gazit, Inbar - - - -``` - -## See also - -- [LINQ to XML Programming Overview (C#)](./linq-to-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/xelement-class-overview.md b/docs/csharp/programming-guide/concepts/linq/xelement-class-overview.md deleted file mode 100644 index 865eabfc23755..0000000000000 --- a/docs/csharp/programming-guide/concepts/linq/xelement-class-overview.md +++ /dev/null @@ -1,95 +0,0 @@ ---- -title: "XElement Class Overview (C#)" -description: The XElement class represents an XML element in C#. It is one of the fundamental classes in LINQ to XML. Learn about the functionality provided by XElement. -ms.date: 07/20/2015 -ms.assetid: 2b9f0cd8-a1d1-4037-accf-0f38a410fa11 ---- -# XElement Class Overview (C#) -The class is one of the fundamental classes in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. It represents an XML element. You can use this class to create elements; change the content of the element; add, change, or delete child elements; add attributes to an element; or serialize the contents of an element in text form. You can also interoperate with other classes in , such as , , and . - -This topic describes the functionality provided by the class. - -## Constructing XML Trees - You can construct XML trees in a variety of ways, including the following: - -- You can construct an XML tree in code. For more information, see [Creating XML Trees (C#)](./linq-to-xml-overview.md). - -- You can parse XML from various sources, including a , text files, or a Web address (URL). For more information, see [Parsing XML (C#)](./how-to-parse-a-string.md). - -- You can use an to populate the tree. For more information, see . - -- If you have a module that can write content to an , you can use the method to create a writer, pass the writer to the module, and then use the content that is written to the to populate the XML tree. - - However, the most common way to create an XML tree is as follows: - -```csharp -XElement contacts = - new XElement("Contacts", - new XElement("Contact", - new XElement("Name", "Patrick Hines"), - new XElement("Phone", "206-555-0144"), - new XElement("Address", - new XElement("Street1", "123 Main St"), - new XElement("City", "Mercer Island"), - new XElement("State", "WA"), - new XElement("Postal", "68042") - ) - ) - ); -``` - - Another very common technique for creating an XML tree involves using the results of a LINQ query to populate an XML tree, as shown in the following example: - -```csharp -XElement srcTree = new XElement("Root", - new XElement("Element", 1), - new XElement("Element", 2), - new XElement("Element", 3), - new XElement("Element", 4), - new XElement("Element", 5) -); -XElement xmlTree = new XElement("Root", - new XElement("Child", 1), - new XElement("Child", 2), - from el in srcTree.Elements() - where (int)el > 2 - select el -); -Console.WriteLine(xmlTree); -``` - - This example produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - -``` - -## Serializing XML Trees - You can serialize the XML tree to a , a , or an . - - For more information, see [Serializing XML Trees (C#)](./preserving-white-space-while-serializing.md). - -## Retrieving XML Data via Axis Methods - You can use axis methods to retrieve attributes, child elements, descendant elements, and ancestor elements. LINQ queries operate on axis methods, and provide several flexible and powerful ways to navigate through and process an XML tree. - - For more information, see [LINQ to XML Axes (C#)](./linq-to-xml-axes-overview.md). - -## Querying XML Trees - You can write LINQ queries that extract data from an XML tree. - - For more information, see [Querying XML Trees (C#)](./how-to-find-an-element-with-a-specific-attribute.md). - -## Modifying XML Trees - You can modify an element in a variety of ways, including changing its content or attributes. You can also remove an element from its parent. - - For more information, see [Modifying XML Trees (LINQ to XML) (C#)](./in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md). - -## See also - -- [LINQ to XML Programming Overview (C#)](serializing-to-files-textwriters-and-xmlwriters.md) diff --git a/docs/csharp/toc.yml b/docs/csharp/toc.yml index b01aaf559efb3..d6e84314a3813 100644 --- a/docs/csharp/toc.yml +++ b/docs/csharp/toc.yml @@ -504,342 +504,6 @@ href: programming-guide/concepts/linq/how-to-query-an-arraylist-with-linq.md - name: "How to add custom methods for LINQ queries" href: programming-guide/concepts/linq/how-to-add-custom-methods-for-linq-queries.md - - name: LINQ to XML - items: - - name: Getting Started (LINQ to XML) - items: - - name: LINQ to XML Overview - href: programming-guide/concepts/linq/linq-to-xml-overview.md - - name: LINQ to XML vs. DOM - href: programming-guide/concepts/linq/linq-to-xml-vs-dom.md - - name: LINQ to XML vs. Other XML Technologies - href: programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md - - name: Programming Guide (LINQ to XML) - items: - - name: LINQ to XML Programming Overview - items: - - name: Functional vs. Procedural Programming (LINQ to XML) - href: programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md - - name: LINQ to XML Classes Overview - href: programming-guide/concepts/linq/linq-to-xml-classes-overview.md - - name: XElement Class Overview - href: programming-guide/concepts/linq/xelement-class-overview.md - - name: XAttribute Class Overview - href: programming-guide/concepts/linq/xattribute-class-overview.md - - name: XDocument Class Overview - href: programming-guide/concepts/linq/xdocument-class-overview.md - - name: "How to build LINQ to XML examples" - href: programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md - - name: XML Trees - items: - - name: Functional Construction (LINQ to XML) - href: programming-guide/concepts/linq/functional-construction-linq-to-xml.md - - name: Creating XML Trees in C# (LINQ to XML) - href: programming-guide/concepts/linq/creating-xml-trees-linq-to-xml-2.md - - name: Parsing XML - items: - - name: "How to parse a string" - href: programming-guide/concepts/linq/how-to-parse-a-string.md - - name: "How to load XML from a file" - href: programming-guide/concepts/linq/how-to-load-xml-from-a-file.md - - name: Preserving White Space while Loading or Parsing XML - href: programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml1.md - - name: "How to catch parsing errors" - href: programming-guide/concepts/linq/how-to-catch-parsing-errors.md - - name: "How to create a tree from an XmlReader" - href: programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md - - name: "How to stream XML fragments from an XmlReader" - href: programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md - - name: "How to populate an XML tree with an XmlWriter (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md - - name: "How to validate using XSD (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md - - name: Valid Content of XElement and XDocument Objects - href: programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects3.md - - name: Working with XML Namespaces - items: - - name: Namespaces Overview (LINQ to XML) - href: programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md - - name: "How to create a document with namespaces (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-create-a-document-with-namespaces-linq-to-xml.md - - name: "How to control namespace prefixes (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md - - name: Scope of Default Namespaces in C# - href: programming-guide/concepts/linq/scope-of-default-namespaces.md - - name: "How to write queries on XML in namespaces" - href: programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md - - name: Serializing XML Trees - items: - - name: Preserving White Space While Serializing - href: programming-guide/concepts/linq/preserving-white-space-while-serializing.md - - name: Serializing with an XML Declaration - href: programming-guide/concepts/linq/serializing-with-an-xml-declaration.md - - name: Serializing to Files, TextWriters, and XmlWriters - href: programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md - - name: Serializing to an XmlReader (Invoking XSLT) - href: programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md - - name: LINQ to XML Axes - items: - - name: LINQ to XML Axes Overview - href: programming-guide/concepts/linq/linq-to-xml-axes-overview.md - - name: "How to retrieve a collection of elements (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md - - name: "How to retrieve the value of an element (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md - - name: "How to filter on element names (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md - - name: "How to chain axis method calls (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md - - name: "How to retrieve a single child element (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md - - name: "How to retrieve a collection of attributes (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md - - name: "How to retrieve a single attribute (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md - - name: "How to retrieve the value of an attribute (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md - - name: "How to retrieve the shallow value of an element" - href: programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md - - name: Querying XML Trees - items: - - name: Basic Queries (LINQ to XML) - items: - - name: "How to find an element with a specific attribute" - href: programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md - - name: "How to find an element with a specific child element" - href: programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md - - name: Querying an XDocument vs. Querying an XElement - href: programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md - - name: "How to find descendants with a specific element same" - href: programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md - - name: "How to find a single descendant using the descendants method" - href: programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md - - name: "How to write queries with complex filtering" - href: programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md - - name: "How to filter on an optional element" - href: programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md - - name: "How to find all nodes in a namespace" - href: programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md - - name: "How to sort elements" - href: programming-guide/concepts/linq/how-to-sort-elements.md - - name: "How to sort elements on multiple keys" - href: programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md - - name: "How to calculate intermediate values" - href: programming-guide/concepts/linq/how-to-calculate-intermediate-values.md - - name: "How to write a query that finds elements based on context" - href: programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md - - name: "How to debug empty query results sets" - href: programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md - - name: Projections and Transformations (LINQ to XML) - items: - - name: "How to work with dictionaries using LINQ to XML" - href: programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md - - name: "How to transform the shape of an XML tree" - href: programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md - - name: "How to control the type of a projection" - href: programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md - - name: "How to project a new type (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md - - name: "How to project an object graph" - href: programming-guide/concepts/linq/how-to-project-an-object-graph.md - - name: "How to project an anonymous type" - href: programming-guide/concepts/linq/how-to-project-an-anonymous-type.md - - name: "How to generate text files from XML" - href: programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md - - name: "How to generate XML from CSV files" - href: programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md - - name: Advanced Query Techniques (LINQ to XML) - items: - - name: "How to join two collections (LINQ to XML)" - href: programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md - - name: "How to create hierarchy using grouping" - href: programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md - - name: "How to query LINQ to XML using XPath" - href: programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md - - name: "How to write a LINQ to XML axis method" - href: programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md - - name: "How to perform streaming transformations of text to XML" - href: programming-guide/concepts/linq/how-to-perform-streaming-transformations-of-text-to-xml.md - - name: "How to list all nodes in a tree" - href: programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md - - name: "How to retrieve paragraphs from an Office Open XML document" - href: programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md - - name: "How to modify an Office Open XML document" - href: programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md - - name: "How to populate an XML tree from the file system" - href: programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md - - name: LINQ to XML for XPath Users - items: - - name: Comparison of XPath and LINQ to XML - href: programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md - - name: "How to find a child element (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md - - name: "How to find a list of child elements (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md - - name: "How to find the root element (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md - - name: "How to find descendant elements (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md - - name: "How to filter on an attribute (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md - - name: "How to find related elements (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md - - name: "How to find elements in a namespace (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-elements-in-a-namespace-xpath-linq-to-xml.md - - name: "How to find preceding siblings (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md - - name: "How to find descendants of a child element (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md - - name: "How to find a union of two location paths (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath-linq-to-xml.md - - name: "How to find sibling nodes (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md - - name: "How to find an attribute of the parent (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md - - name: "How to find attributes of siblings with a specific name (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name-xpath-linq-to-xml.md - - name: "How to find elements with a specific attribute (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute-xpath-linq-to-xml.md - - name: "How to find child elements based on position (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-child-elements-based-on-position-xpath-linq-to-xml.md - - name: "How to find the immediate preceding sibling (XPath-LINQ to XML)" - href: programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md - - name: Pure Functional Transformations of XML - items: - - name: Introduction to Pure Functional Transformations - href: programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md - - name: Concepts and Terminology (Functional Transformation) - href: programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md - - name: Functional Programming vs. Imperative Programming - href: programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md - - name: Refactoring Into Pure Functions - href: programming-guide/concepts/linq/refactoring-into-pure-functions.md - - name: Applicability of Functional Transformation - href: programming-guide/concepts/linq/applicability-of-functional-transformation.md - - name: Functional Transformation of XML - href: programming-guide/concepts/linq/functional-transformation-of-xml.md - - name: "Tutorial: Chaining Queries Together" - items: - - name: Deferred Execution and Lazy Evaluation in LINQ to XML - href: programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md - - name: Deferred Execution Example - href: programming-guide/concepts/linq/deferred-execution-example.md - - name: Chaining Queries Example - href: programming-guide/concepts/linq/chaining-queries-example.md - - name: Intermediate Materialization - href: programming-guide/concepts/linq/intermediate-materialization.md - - name: Chaining Standard Query Operators Together - href: programming-guide/concepts/linq/chaining-standard-query-operators-together.md - - name: "Tutorial: Manipulating Content in a WordprocessingML Document" - items: - - name: Shape of WordprocessingML Documents - href: programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md - - name: Creating the Source Office Open XML Document - href: programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md - - name: Finding the Default Paragraph Style - href: programming-guide/concepts/linq/finding-the-default-paragraph-style.md - - name: Retrieving the Paragraphs and Their Styles - href: programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md - - name: Retrieving the Text of the Paragraphs - href: programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md - - name: Refactoring Using an Extension Method - href: programming-guide/concepts/linq/refactoring-using-an-extension-method.md - - name: Refactoring Using a Pure Function - href: programming-guide/concepts/linq/refactoring-using-a-pure-function.md - - name: Projecting XML in a Different Shape - href: programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md - - name: Finding Text in Word Documents - href: programming-guide/concepts/linq/finding-text-in-word-documents.md - - name: Details of Office Open XML WordprocessingML Documents - items: - - name: WordprocessingML Document with Styles - href: programming-guide/concepts/linq/wordprocessingml-document-with-styles.md - - name: Style Part of a WordprocessingML Document - href: programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md - - name: Example that Outputs Office Open XML Document Parts - href: programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md - - name: Modifying XML Trees (LINQ to XML) - items: - - name: In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) - href: programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction-linq-to-xml.md - - name: Adding Elements, Attributes, and Nodes to an XML Tree - href: programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md - - name: Modifying Elements, Attributes, and Nodes in an XML Tree - href: programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md - - name: Removing Elements, Attributes, and Nodes from an XML Tree - href: programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md - - name: Maintaining Name-Value Pairs - href: programming-guide/concepts/linq/maintaining-name-value-pairs.md - - name: "How to change the namespace for an entire XML tree" - href: programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md - - name: Performance (LINQ to XML) - items: - - name: Performance of Chained Queries (LINQ to XML) - href: programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md - - name: Atomized XName and XNamespace Objects (LINQ to XML) - href: programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md - - name: Pre-Atomization of XName Objects (LINQ to XML) - href: programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md - - name: Statically Compiled Queries (LINQ to XML) - href: programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md - - name: Advanced LINQ to XML Programming - items: - - name: LINQ to XML Annotations - href: programming-guide/concepts/linq/linq-to-xml-annotations.md - - name: LINQ to XML Events - href: programming-guide/concepts/linq/linq-to-xml-events.md - - name: Programming with Nodes - href: programming-guide/concepts/linq/programming-with-nodes.md - - name: Mixed Declarative Code-Imperative Code Bugs (LINQ to XML) - href: programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md - - name: "How to stream XML fragments with access to header information" - href: programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md - - name: "How to perform streaming transform of large XML documents" - href: programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md - - name: "How to read and write an encoded document" - href: programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md - - name: Using XSLT to Transform an XML Tree - href: programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md - - name: "How to use annotations to transform LINQ to XML trees in an XSLT style" - href: programming-guide/concepts/linq/how-to-use-annotations-to-transform-linq-to-xml-trees-in-an-xslt-style.md - - name: Serializing Object Graphs that Contain XElement Objects - items: - - name: "How to serialize using XmlSerializer" - href: programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md - - name: "How to serialize using DataContractSerializer" - href: programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md - - name: LINQ to XML Security - href: programming-guide/concepts/linq/linq-to-xml-security.md - - name: Sample XML Documents (LINQ to XML) - items: - - name: "Sample XML File: Typical Purchase Order (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml-1.md - - name: "Sample XML File: Typical Purchase Order in a Namespace" - href: programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md - - name: "Sample XML File: Multiple Purchase Orders (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md - - name: "Sample XML File: Multiple Purchase Orders in a Namespace" - href: programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md - - name: "Sample XML File: Test Configuration (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md - - name: "Sample XML File: Test Configuration in a Namespace" - href: programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace1.md - - name: "Sample XML File: Customers and Orders (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml-2.md - - name: "Sample XSD File: Customers and Orders" - href: programming-guide/concepts/linq/sample-xsd-file-customers-and-orders1.md - - name: "Sample XML File: Customers and Orders in a Namespace" - href: programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md - - name: "Sample XML File: Numerical Data (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md - - name: "Sample XML File: Numerical Data in a Namespace" - href: programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md - - name: "Sample XML File: Books (LINQ to XML)" - href: programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md - - name: "Sample XML File: Consolidated Purchase Orders" - href: programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md - - name: Reference (LINQ to XML) - href: programming-guide/concepts/linq/reference-linq-to-xml.md - name: LINQ to ADO.NET (Portal Page) href: programming-guide/concepts/linq/linq-to-adonet-portal-page.md - name: Enabling a Data Source for LINQ Querying diff --git a/docs/fundamentals/toc.yml b/docs/fundamentals/toc.yml index 4a49cba28b300..1133e751717a4 100644 --- a/docs/fundamentals/toc.yml +++ b/docs/fundamentals/toc.yml @@ -703,7 +703,7 @@ items: - name: Data access items: - name: LINQ - href: ../standard/using-linq.md + href: ../standard/linq/ - name: XML documents and data href: ../standard/data/xml/ - name: Microsoft.Data.Sqlite diff --git a/docs/standard/linq/add-elements-attributes-nodes-xml-tree.md b/docs/standard/linq/add-elements-attributes-nodes-xml-tree.md new file mode 100644 index 0000000000000..292e0ab21bd26 --- /dev/null +++ b/docs/standard/linq/add-elements-attributes-nodes-xml-tree.md @@ -0,0 +1,105 @@ +--- +title: Add elements, attributes, and nodes to an XML tree - LINQ to XML +description: Learn how to add content (elements, attributes, comments, processing instructions, text, and CDATA) to an XML tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: db911e4f-40aa-499a-9500-a9763bb6df56 +--- + +# Add elements, attributes, and nodes to an XML tree (LINQ to XML) + +You can add content (elements, attributes, comments, processing instructions, text, and CDATA) to an XML tree. + +## Methods for Adding Content + +The following methods add child content to an or an : + +|Method|Description| +|------------|-----------------| +||Adds content at the end of the child content of the .| +||Adds content at the beginning of the child content of the .| + +The following methods add content as sibling nodes of an . The most common node to which you add sibling content is , although you can add valid sibling content to other types of nodes such as or . + +|Method|Description| +|------------|-----------------| +||Adds content after the .| +||Adds content before the .| + +## Example: Create two XML trees and modify one of them + +The following example creates two XML trees, and then modifies one of them. + +```csharp +XElement srcTree = new XElement("Root", + new XElement("Element1", 1), + new XElement("Element2", 2), + new XElement("Element3", 3), + new XElement("Element4", 4), + new XElement("Element5", 5) +); +XElement xmlTree = new XElement("Root", + new XElement("Child1", 1), + new XElement("Child2", 2), + new XElement("Child3", 3), + new XElement("Child4", 4), + new XElement("Child5", 5) +); +xmlTree.Add(new XElement("NewChild", "new content")); +xmlTree.Add( + from el in srcTree.Elements() + where (int)el > 3 + select el +); +// Even though Child9 doesn't exist in srcTree, the following statement won't +// throw an exception, and nothing will be added to xmlTree. +xmlTree.Add(srcTree.Element("Child9")); +Console.WriteLine(xmlTree); +``` + +```vb +Dim srcTree As XElement = _ + + 1 + 2 + 3 + 4 + 5 + +Dim xmlTree As XElement = _ + + 1 + 2 + 3 + 4 + 5 + + +xmlTree.Add(new content) +xmlTree.Add( _ + From el In srcTree.Elements() _ + Where CInt(el) > 3 _ + Select el) + +' Even though Child9 doesn't exist in srcTree, the following statement +' won't throw an exception, and nothing will be added to xmlTree. +xmlTree.Add(srcTree.Element("Child9")) +Console.WriteLine(xmlTree) +``` + +This example produces the following output: + +```xml + + 1 + 2 + 3 + 4 + 5 + new content + 4 + 5 + +``` diff --git a/docs/standard/linq/applicability-functional-transformation.md b/docs/standard/linq/applicability-functional-transformation.md new file mode 100644 index 0000000000000..32de27d0131d7 --- /dev/null +++ b/docs/standard/linq/applicability-functional-transformation.md @@ -0,0 +1,32 @@ +--- +title: Applicability of functional transformation - LINQ to XML +description: Learn when you can make use of functional transformations. +ms.date: 07/20/2015 +ms.assetid: c78107bd-b006-4574-a3d4-bbf808388ff3 +--- + +# Applicability of functional transformation (LINQ to XML) + +Pure functional transformations are applicable in a wide variety of situations. + +The functional transformation approach is ideally suited for querying and manipulating structured data; therefore it fits well with LINQ technologies. However, functional transformation has a much wider applicability than use with LINQ. Any process where the main focus is on transforming data from one form to another should probably be considered as a candidate for functional transformation. + +This approach is applicable to many problems that might not appear at first glance to be a candidate. Used in conjunction with or separately from LINQ, functional transformation should be considered for the following areas: + +- XML-based documents. Well-formed data of any XML dialect can be easily manipulated through functional transformation. For more information, see [Functional transformation of XML](functional-transformation-xml.md). +- Other structured file formats. From Windows.ini files to plain text documents, most files have some structure that lends itself to analysis and transformation. +- Data streaming protocols. Encoding data into and decoding data from communication protocols can often be represented by a simple functional transform. +- RDBMS and OODBMS data. Relational and object-oriented databases, just like XML, are widely-used structured data sources. +- Mathematic, statistic, and science solutions. These fields tend to manipulate large data sets to assist the user in visualizing, estimating, or actually solving non-trivial problems. + +As described in [Refactor into pure functions](refactor-pure-functions.md), using pure functions is an example of functional programming. In additional to their immediate benefits, using pure functions provides valuable experience in thinking about problems from a functional transformation perspective. This approach can also have major impact on program and class design. This is especially true when a problem lends itself to a data transformation solution as described above. + +Although they're beyond the scope of this tutorial, designs that are influenced by the functional transformation perspective tend to center on processes more than on objects as actors, and the resulting solution tends to be implemented as a series of large-scale transformations, rather than individual object state changes. + + Again, remember that C# and Visual Basic support both imperative and functional approaches, so the best design for your application might incorporate elements of both. + +## See also + +- [Introduction to pure functional transformations](introduction-pure-functional-transformations.md) +- [Functional transformation of XML](functional-transformation-xml.md) +- [Refactor into pure functions](refactor-pure-functions.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md b/docs/standard/linq/atomized-xname-xnamespace-objects.md similarity index 58% rename from docs/visual-basic/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md rename to docs/standard/linq/atomized-xname-xnamespace-objects.md index bcfdcfb189c58..3fdb16ac167fd 100644 --- a/docs/visual-basic/programming-guide/concepts/linq/atomized-xname-and-xnamespace-objects-linq-to-xml.md +++ b/docs/standard/linq/atomized-xname-xnamespace-objects.md @@ -1,25 +1,46 @@ --- -title: "Atomized XName and XNamespace Objects (LINQ to XML)" +title: Atomized XName and XNamespace objects - LINQ to XML +description: Learn how atomized XName and XNamespace objects of the same name share an instance. ms.date: 07/20/2015 -ms.assetid: 21ee7585-7df9-40b4-8c76-a12bb5f29bb3 +dev_langs: + - "csharp" + - "vb" +ms.assetid: a5b21433-b49d-415c-b00e-bcbfb0d267d7 --- -# Atomized XName and XNamespace Objects (LINQ to XML) (Visual Basic) +# Atomized XName and XNamespace objects (LINQ to XML) - and objects are *atomized*; that is, if they contain the same qualified name, they refer to the same object. This yields performance benefits for queries: When you compare two atomized names for equality, the underlying intermediate language only has to determine whether the two references point to the same object. The underlying code does not have to do string comparisons, which would be time consuming. + and objects are *atomized*; that is, if they contain the same qualified name, they refer to the same object. This yields performance benefits for queries: when you compare two atomized names for equality, the underlying intermediate language only has to determine whether the two references point to the same object. The underlying code doesn't have to do string comparisons, which would take longer. -## Atomization Semantics +## Atomization semantics -Atomization means that if two objects have the same local name, and they are in the same namespace, they share the same instance. In the same way, if two objects have the same namespace URI, they share the same instance. +Atomization means that if two objects have the same local name, and they're in the same namespace, they share the same instance. In the same way, if two objects have the same namespace URI, they share the same instance. -For a class to enable atomized objects, the constructor for the class must be private, not public. This is because if the constructor were public, you could create a non-atomized object. The and classes implement an implicit conversion operator to convert a string into an or . This is how you get an instance of these objects. You cannot get an instance by using a constructor, because the constructor is inaccessible. +For a class to enable atomized objects, the constructor for the class must be private, not public. This is because if the constructor were public, you could create a non-atomized object. The and classes implement an implicit conversion operator to convert a string into an or . This is how you get an instance of these objects. You can't get an instance by using a constructor, because the constructor is inaccessible. - and also implement the equality and inequality operators, to determine whether the two objects being compared are references to the same instance. + and also implement the equality and inequality operators, which determine whether the two objects being compared are references to the same instance. -## Example +## Example: Create objects and show that identical names share an instance The following code creates some objects and demonstrates that identical names share the same instance. +```csharp +XElement r1 = new XElement("Root", "data1"); +XElement r2 = XElement.Parse("data2"); + +if ((object)r1.Name == (object)r2.Name) + Console.WriteLine("r1 and r2 have names that refer to the same instance."); +else + Console.WriteLine("Different"); + +XName n = "Root"; + +if ((object)n == (object)r1.Name) + Console.WriteLine("The name of r1 and the name in 'n' refer to the same instance."); +else + Console.WriteLine("Different"); +``` + ```vb Dim r1 As New XElement("Root", "data1") Dim r2 As XElement = XElement.Parse("data2") @@ -41,7 +62,7 @@ End If This example produces the following output: -```console +```output r1 and r2 have names that refer to the same instance. The name of r1 and the name in 'n' refer to the same instance. ``` @@ -50,6 +71,23 @@ As mentioned earlier, the benefit of atomized objects is that when you use one o The following example passes an to the method call, which then has better performance because of the atomization pattern. +```csharp +XElement root = new XElement("Root", + new XElement("C1", 1), + new XElement("Z1", + new XElement("C1", 2), + new XElement("C1", 1) + ) +); + +var query = from e in root.Descendants("C1") + where (int)e == 1 + select e; + +foreach (var z in query) + Console.WriteLine(z); +``` + ```vb Dim root As New XElement("Root", New XElement("C1", 1), New XElement("Z1", New XElement("C1", 2), New XElement("C1", 1))) @@ -66,7 +104,3 @@ This example produces the following output: 1 1 ``` - -## See also - -- [Performance (LINQ to XML) (Visual Basic)](performance-linq-to-xml.md) diff --git a/docs/standard/linq/build-linq-xml-examples.md b/docs/standard/linq/build-linq-xml-examples.md new file mode 100644 index 0000000000000..28231fa81acbb --- /dev/null +++ b/docs/standard/linq/build-linq-xml-examples.md @@ -0,0 +1,57 @@ +--- +title: How to build LINQ to XML examples +description: The C# and Visual Basic code in this documentation uses classes and types from various namespaces. To compile and run the code you must provide appropriate directives and statements to access the namespaces. +ms.date: 07/20/2015 +ms.assetid: e5d18fa1-2704-48fe-a44b-1564f97c9e9c +--- + +# How to build LINQ to XML examples + +The snippets and examples in this documentation use classes and types from various namespaces. When compiling C# code you need to supply appropriate `using` directives, and when compiling Visual Basic code you need to supply appropriate `Imports` statements. + +## Example + +The following code contains the `using` directives that the C# examples require to build and run. Not all `using` directives are required for every example. + +```csharp +using System; +using System.Diagnostics; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Text; +using System.Linq; +using System.Xml; +using System.Xml.Linq; +using System.Xml.Schema; +using System.Xml.XPath; +using System.Xml.Xsl; +using System.IO; +using System.Threading; +using System.Reflection; +using System.IO.Packaging; +``` + +The following code contains the `Imports` statements that the Visual Basic examples require to build and run. Not all `Imports` statements are required for every example. + +```vb +Imports System.Diagnostics +Imports System.Collections +Imports System.Collections.Generic +Imports System.Collections.Specialized +Imports System.Text +Imports System.Linq +Imports System.Xml +Imports System.Xml.Linq +Imports System.Xml.Schema +Imports System.Xml.XPath +Imports System.Xml.Xsl +Imports System.IO +Imports System.Threading +Imports System.Reflection +Imports System.IO.Packaging +``` + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/calculate-intermediate-values.md b/docs/standard/linq/calculate-intermediate-values.md new file mode 100644 index 0000000000000..4ed3cf7f864ae --- /dev/null +++ b/docs/standard/linq/calculate-intermediate-values.md @@ -0,0 +1,104 @@ +--- +title: How to calculate intermediate values - LINQ to XML +description: Calculate intermediate values for use in sorting, filtering, and selecting. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 7fd3001f-f8f9-4bce-879f-d4c7af8a04fe +--- + +# How to calculate intermediate values (LINQ to XML) + +This article shows how to calculate intermediate values for use in sorting, filtering, and selecting in C# and Visual Basic. + +## Example: Use the `let` clause to calculate based on element data + +The following example uses the `let` clause to calculate products of numerical values from elements. It uses XML document [Sample XML file: Numerical data](sample-xml-file-numerical-data.md). + +```csharp +XElement root = XElement.Load("Data.xml"); +IEnumerable extensions = + from el in root.Elements("Data") + let extension = (decimal)el.Element("Quantity") * (decimal)el.Element("Price") + where extension >= 25 + orderby extension + select extension; +foreach (decimal ex in extensions) + Console.WriteLine(ex); +``` + +```vb +Dim root As XElement = XElement.Load("Data.xml") +Dim extensions As IEnumerable(Of Decimal) = _ + From el In root. _ + Let extension = CDec(el..Value) * CDec(el..Value) _ + Where extension > 25 _ + Order By extension _ + Select extension +For Each ex As Decimal In extensions + Console.WriteLine(ex) +Next +``` + +This example produces the following output: + +```output +55.92 +73.50 +89.99 +198.00 +435.00 +``` + +## Example: Calculate from XML that's in a namespace + +The following example shows the same query as before, but for XML that's in a namespace. It uses the XML document [Sample XML file: Numerical data in a namespace](sample-xml-file-numerical-data-namespace.md). + +For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Load("DataInNamespace.xml"); +XNamespace ad = "http://www.adatum.com"; +IEnumerable extensions = + from el in root.Elements(ad + "Data") + let extension = (decimal)el.Element(ad + "Quantity") * (decimal)el.Element(ad + "Price") + where extension >= 25 + orderby extension + select extension; +foreach (decimal ex in extensions) + Console.WriteLine(ex); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = XElement.Load("DataInNamespace.xml") + Dim extensions As IEnumerable(Of Decimal) = _ + From el In root. _ + Let extension = CDec(el..Value) * CDec(el..Value) _ + Where extension > 25 _ + Order By extension _ + Select extension + For Each ex As Decimal In extensions + Console.WriteLine(ex) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +55.92 +73.50 +89.99 +198.00 +435.00 +``` + +## See also + +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) diff --git a/docs/standard/linq/catch-parsing-errors.md b/docs/standard/linq/catch-parsing-errors.md new file mode 100644 index 0000000000000..b8d9eb19672fc --- /dev/null +++ b/docs/standard/linq/catch-parsing-errors.md @@ -0,0 +1,62 @@ +--- +title: How to catch parsing errors - LINQ to XML +description: An exception can occur in your C# or Visual Basic program if it tries to parse invalid XML with a method such as XElement.Parse. You can write the program to catch and respond to such exceptions. +ms.date: 7/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: bfb612d4-5605-48ef-8c93-915cf9d5dcfb +--- + +# How to catch parsing errors (LINQ to XML) + +This article shows how to detect badly formed or invalid XML in C# or Visual Basic. + +LINQ to XML is implemented using . If badly formed or invalid XML is passed to LINQ to XML, the underlying class will throw an exception. The various methods that parse XML, such as , don't catch the exception; the exception can then be caught by your application. + +## Example: Parse invalid XML + +The following code tries to parse invalid XML. + +```csharp +try { + XElement contacts = XElement.Parse( + @" + + Jim Wilson + + "); + + Console.WriteLine(contacts); +} +catch (System.Xml.XmlException e) +{ + Console.WriteLine(e.Message); +} +``` + +```vb +Try + Dim contacts As XElement = XElement.Parse("" & vbCrLf & _ + " " & vbCrLf & _ + " Jim Wilson" & vbCrLf & _ + " " & vbCrLf & _ + "") + + Console.WriteLine(contacts) +Catch e As System.Xml.XmlException + Console.WriteLine(e.Message) +End Try +``` + +Because of the invalid end tag ``, the example throws the following exception: + +```output +The 'Contacts' start tag on line 1 doesn't match the end tag of 'Contcts'. Line 5, position 13. +``` + +For information about the exceptions that the , , , and methods throw, see the documentation. + +## See also + +- [How to parse a string](parse-string.md) diff --git a/docs/standard/linq/chain-axis-method-calls.md b/docs/standard/linq/chain-axis-method-calls.md new file mode 100644 index 0000000000000..a4d9789202a49 --- /dev/null +++ b/docs/standard/linq/chain-axis-method-calls.md @@ -0,0 +1,159 @@ +--- +title: How to chain axis method calls - LINQ to XML +description: Learn how to use the XContainer.Elements and Extensions.Elements methods to find all elements of a specified name at a given depth in the tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 067e6da2-ee32-486d-803c-e611b328e39a +--- + +# How to chain axis method calls (LINQ to XML) + +A common pattern that you will use in your code is to call an axis method, then call one of the extension method axes. + +There are two axes with the name of `Elements` that return a collection of elements: the method and the method. You can combine these two axes to find all elements of a specified name at a given depth in the tree. + +## Example: Retrieve all name elements + +This example uses and to retrieve all `Name` elements in all `Address` elements in all `PurchaseOrder` elements. + +This example uses XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). + +```csharp +XElement purchaseOrders = XElement.Load("PurchaseOrders.xml"); +IEnumerable names = + from el in purchaseOrders + .Elements("PurchaseOrder") + .Elements("Address") + .Elements("Name") + select el; +foreach (XElement e in names) + Console.WriteLine(e); +``` + +```vb +Dim purchaseOrders As XElement = XElement.Load("PurchaseOrders.xml") +Dim names As IEnumerable(Of XElement) = _ + From el In purchaseOrders..
. _ + Select el +For Each e As XElement In names + Console.WriteLine(e) +Next +``` + +This example produces the following output: + +```xml +Ellen Adams +Tai Yee +Cristian Osorio +Cristian Osorio +Jessica Arnold +Jessica Arnold +``` + +This works because one of the implementations of the `Elements` axis is as an extension method on of . derives from , so you can call the method on the results of a call to the method. + +## Example: Retrieve all elements at a particular depth + +Sometimes you want to retrieve all elements at a particular element depth when there may not be intervening ancestors. For example, in the following document, you might want to retrieve all the `ConfigParameter` elements that are children of the `Customer` element, but not the `ConfigParameter` that's a child of the `Root` element. + +```xml + + RootConfigParameter + + Frank + + FirstConfigParameter + + + + Bob + + + + Bill + + SecondConfigParameter + + + +``` + + To do this, you can use the axis, as follows: + +```csharp +XElement root = XElement.Load("Irregular.xml"); +IEnumerable configParameters = + root.Elements("Customer").Elements("Config"). + Elements("ConfigParameter"); +foreach (XElement cp in configParameters) + Console.WriteLine(cp); +``` + +```vb +Dim root As XElement = XElement.Load("Irregular.xml") +Dim configParameters As IEnumerable(Of XElement) = _ + root... +For Each cp As XElement In configParameters + Console.WriteLine(cp) +Next +``` + +This example produces the following output: + +```xml +FirstConfigParameter +SecondConfigParameter +``` + +## Example: Retrieve elements for XML that's in a namespace + +The following example shows the same technique for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +This example uses XML document [Sample XML file: Multiple purchase orders in a namespace](sample-xml-file-multiple-purchase-orders-namespace.md). + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement purchaseOrders = XElement.Load("PurchaseOrdersInNamespace.xml"); +IEnumerable names = + from el in purchaseOrders + .Elements(aw + "PurchaseOrder") + .Elements(aw + "Address") + .Elements(aw + "Name") + select el; +foreach (XElement e in names) + Console.WriteLine(e); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim purchaseOrders As XElement = XElement.Load("PurchaseOrdersInNamespace.xml") + Dim names As IEnumerable(Of XElement) = _ + From el In purchaseOrders... _ + Select el + For Each e As XElement In names + Console.WriteLine(e) + Next + End Sub +End Module +``` + +This example produces the following output: + +```xml +Ellen Adams +Tai Yee +Cristian Osorio +Cristian Osorio +Jessica Arnold +Jessica Arnold +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/chain-queries-example.md b/docs/standard/linq/chain-queries-example.md new file mode 100644 index 0000000000000..27bbb20240c89 --- /dev/null +++ b/docs/standard/linq/chain-queries-example.md @@ -0,0 +1,89 @@ +--- +title: Chain queries example (C#) - LINQ to XML +description: Learn what happens when you chain together two queries that both use deferred execution and lazy evaluation. +ms.date: 07/20/2015 +ms.assetid: abbca162-d95e-43af-b92c-e46e6aa2540e +--- + +# Chain queries example (C#) (LINQ to XML) + +This example builds on the example in [Deferred execution example](deferred-execution-example.md) and shows what happens when you chain together two queries that both use deferred execution and lazy evaluation. + +## Example: Add a second extension method that uses `yield return` to defer execution + +In this example, another extension method is introduced, `AppendString`, which appends a specified string onto every string in the source collection, and then yields the changed string. + +```csharp +public static class LocalExtensions +{ + public static IEnumerable + ConvertCollectionToUpperCase(this IEnumerable source) + { + foreach (string str in source) + { + Console.WriteLine("ToUpper: source >{0}<", str); + yield return str.ToUpper(); + } + } + + public static IEnumerable + AppendString(this IEnumerable source, string stringToAppend) + { + foreach (string str in source) + { + Console.WriteLine("AppendString: source >{0}<", str); + yield return str + stringToAppend; + } + } +} + +class Program +{ + static void Main(string[] args) + { + string[] stringArray = { "abc", "def", "ghi" }; + + IEnumerable q1 = + from s in stringArray.ConvertCollectionToUpperCase() + select s; + + IEnumerable q2 = + from s in q1.AppendString("!!!") + select s; + + foreach (string str in q2) + { + Console.WriteLine("Main: str >{0}<", str); + Console.WriteLine(); + } + } +} +``` + + This example produces the following output: + +```output +ToUpper: source >abc< +AppendString: source >ABC< +Main: str >ABC!!!< + +ToUpper: source >def< +AppendString: source >DEF< +Main: str >DEF!!!< + +ToUpper: source >ghi< +AppendString: source >GHI< +Main: str >GHI!!!< +``` + +In this example, you can see that each extension method operates one at a time for each item in the source collection. + +What should be clear from this example is that even though we have chained together queries that yield collections, no intermediate collections are materialized. Instead, each item is passed from one lazy method to the next. This results in a much smaller memory footprint than an approach that would first take one array of strings, then create a second array of strings that have been converted to uppercase, and finally create a third array of strings where each string has the exclamation points appended to it. + +The next article in this tutorial illustrates intermediate materialization: + +- [Intermediate materialization (C#)](intermediate-materialization.md) + +## See also + +- [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md) diff --git a/docs/standard/linq/chain-standard-query-operators-together.md b/docs/standard/linq/chain-standard-query-operators-together.md new file mode 100644 index 0000000000000..ca3ad77753124 --- /dev/null +++ b/docs/standard/linq/chain-standard-query-operators-together.md @@ -0,0 +1,87 @@ +--- +title: Chain standard query operators together (C#) - LINQ to XML +description: Learn how to chain query operators together. +ms.date: 07/20/2015 +dev_langs: + - "csharp" +ms.assetid: 66f2b0a9-2c23-4735-988e-bbc9dfb55c7b +--- + +# Chain standard query operators together (C#) (LINQ to XML) + +The standard query operators can be chained together. For example, you can interject the operator (invoked by the `where` clause), and it operates in a lazy fashion; that is, no intermediate results are materialized by it. + +## Example: Interject a where clause + +In this example, the method is called before calling `ConvertCollectionToUpperCase`. The method operates in almost exactly the same way as the lazy methods used in previous examples in this tutorial, `ConvertCollectionToUpperCase` and `AppendString`. + +One difference is that in this case, the method iterates through its source collection, determines that the first item doesn't pass the predicate, and then gets the next item, which does pass. It then yields the second item. + +However, the basic idea is the same: intermediate collections aren't materialized unless they have to be. + +When query expressions are used, they're converted to calls to the standard query operators, and the same principles apply. + +All of the examples in this section that are querying Office Open XML documents use the same principle. Deferred execution and lazy evaluation are some of the fundamental concepts that you must understand to use LINQ, and LINQ to XML, effectively. + +```csharp +public static class LocalExtensions +{ + public static IEnumerable + ConvertCollectionToUpperCase(this IEnumerable source) + { + foreach (string str in source) + { + Console.WriteLine("ToUpper: source >{0}<", str); + yield return str.ToUpper(); + } + } + + public static IEnumerable + AppendString(this IEnumerable source, string stringToAppend) + { + foreach (string str in source) + { + Console.WriteLine("AppendString: source >{0}<", str); + yield return str + stringToAppend; + } + } +} + +class Program +{ + static void Main(string[] args) + { + string[] stringArray = { "abc", "def", "ghi" }; + + IEnumerable q1 = + from s in stringArray.ConvertCollectionToUpperCase() + where s.CompareTo("D") >= 0 + select s; + + IEnumerable q2 = + from s in q1.AppendString("!!!") + select s; + + foreach (string str in q2) + { + Console.WriteLine("Main: str >{0}<", str); + Console.WriteLine(); + } + } +} +``` + +This example produces the following output: + +```output +ToUpper: source >abc< +ToUpper: source >def< +AppendString: source >DEF< +Main: str >DEF!!!< + +ToUpper: source >ghi< +AppendString: source >GHI< +Main: str >GHI!!!< +``` + +This is the final article in the [Tutorial: Chaining Queries Together (C#)](chain-queries-example.md) tutorial. diff --git a/docs/standard/linq/change-namespace-entire-xml-tree.md b/docs/standard/linq/change-namespace-entire-xml-tree.md new file mode 100644 index 0000000000000..823e999df1c26 --- /dev/null +++ b/docs/standard/linq/change-namespace-entire-xml-tree.md @@ -0,0 +1,125 @@ +--- +title: How to change the namespace for an entire XML tree - LINQ to XML +description: Learn how to change the namespace for an entire XML tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 1584ff3b-c77d-4241-ab62-80adfb7bfc1b +--- + +# How to change the namespace for an entire XML tree (LINQ to XML) + +You sometimes have to programmatically change the namespace for an element or an attribute. LINQ to XML makes this easy. The property can be set. The property can't be set, but you can easily copy the attributes into a , remove the existing attributes, and then add new attributes that are in the new desired namespace. + +For more information, see [Namespaces overview](namespaces-overview.md). + +## Example: Create two XML trees, change the namespaces, and combine the trees + +The following code creates two XML trees in no namespace. It then changes the namespace of each of the trees, and combines them into a single tree. + +```csharp +XElement tree1 = new XElement("Data", + new XElement("Child", "content", + new XAttribute("MyAttr", "content") + ) +); +XElement tree2 = new XElement("Data", + new XElement("Child", "content", + new XAttribute("MyAttr", "content") + ) +); +XNamespace aw = "http://www.adventure-works.com"; +XNamespace ad = "http://www.adatum.com"; +// Change the namespace of every element and attribute in the first tree. +foreach (XElement el in tree1.DescendantsAndSelf()) +{ + el.Name = aw.GetName(el.Name.LocalName); + List atList = el.Attributes().ToList(); + el.Attributes().Remove(); + foreach (XAttribute at in atList) + el.Add(new XAttribute(aw.GetName(at.Name.LocalName), at.Value)); +} +// Change the namespace of every element and attribute in the second tree. +foreach (XElement el in tree2.DescendantsAndSelf()) +{ + el.Name = ad.GetName(el.Name.LocalName); + List atList = el.Attributes().ToList(); + el.Attributes().Remove(); + foreach (XAttribute at in atList) + el.Add(new XAttribute(ad.GetName(at.Name.LocalName), at.Value)); +} +// Add attribute namespaces so that the tree will be serialized with +// the aw and ad namespace prefixes. +tree1.Add( + new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com") +); +tree2.Add( + new XAttribute(XNamespace.Xmlns + "ad", "http://www.adatum.com") +); +// Create a new composite tree. +XElement root = new XElement("Root", + tree1, + tree2 +); +Console.WriteLine(root); +``` + +```vb +Dim tree1 As XElement = _ + + content + +Dim tree2 As XElement = _ + + content + +Dim aw As XNamespace = "http://www.adventure-works.com" +Dim ad As XNamespace = "http://www.adatum.com" +' Change the namespace of every element and attribute in the first tree. +For Each el As XElement In tree1.DescendantsAndSelf + el.Name = aw.GetName(el.Name.LocalName) + Dim atList As List(Of XAttribute) = el.Attributes().ToList() + el.Attributes().Remove() + For Each at As XAttribute In atList + el.Add(New XAttribute(aw.GetName(at.Name.LocalName), at.Value)) + Next +Next +' Change the namespace of every element and attribute in the second tree. +For Each el As XElement In tree2.DescendantsAndSelf() + el.Name = ad.GetName(el.Name.LocalName) + Dim atList As List(Of XAttribute) = el.Attributes().ToList() + el.Attributes().Remove() + For Each at As XAttribute In atList + el.Add(New XAttribute(ad.GetName(at.Name.LocalName), at.Value)) + Next +Next +' Add attribute namespaces so that the tree will be serialized with +' the aw and ad namespace prefixes. +tree1.Add( _ + New XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com") _ +) +tree2.Add( _ + New XAttribute(XNamespace.Xmlns + "ad", "http://www.adatum.com") _ +) +' Create a new composite tree. +Dim root As XElement = _ + + <%= tree1 %> + <%= tree2 %> + +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + + content + + + content + + +``` diff --git a/docs/standard/linq/comparison-xpath-linq-xml.md b/docs/standard/linq/comparison-xpath-linq-xml.md new file mode 100644 index 0000000000000..17ada1cf9a4a2 --- /dev/null +++ b/docs/standard/linq/comparison-xpath-linq-xml.md @@ -0,0 +1,107 @@ +--- +title: Comparison of XPath and LINQ to XML - LINQ to XML +description: Both XPath and LINQ to XML queries can query XML trees. This articles compares the two options, and finds LINQ to XML queries to be, on the whole, the more powerful, versatile, faster, safer, and more convenient choice. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 87d361b1-daa9-4fd4-a53a-cbfa40111ad3 +--- + +# Comparison of XPath and LINQ to XML + +XPath and LINQ to XML are similar in some ways. Both can be used to query an XML tree, returning such results as a collection of elements, a collection of attributes, a collection of nodes, or the value of an element or attribute. However, there are significant differences between the two options. + +## Differences between XPath and LINQ to XML + +XPath doesn't allow projection of new types. It can only return collections of nodes from the tree, whereas LINQ to XML can execute a query and project an object graph or an XML tree in a new shape. LINQ to XML queries can do much more than XPath expressions. + +XPath expressions exist in isolation within a string. The C# compiler can't help parse the XPath expression at compile time. By contrast, LINQ to XML queries are parsed and compiled by the C# compiler. The compiler can catch many query errors. + +XPath results aren't strongly typed. In a number of circumstances, the result of evaluating an XPath expression is an object, and it's up to the developer to determine the proper type and cast the result as necessary. By contrast, the projections from a LINQ to XML query are strongly typed. + +## Result ordering + +The XPath 1.0 Recommendation states that a collection that's the result of evaluating an XPath expression is unordered. + +However, when iterating through a collection returned by a LINQ to XML XPath axis method, the nodes in the collection are returned in document order. This is the case even when accessing the XPath axes where predicates are expressed in terms of reverse document order, such as `preceding` and `preceding-sibling`. + +By contrast, most of the LINQ to XML axes return collections in document order. However, two of them, and , return collections in reverse document order. The following table enumerates the axes, and indicates the collection order for each: + +|LINQ to XML axis|Ordering| +|----------------------|--------------| +|XContainer.DescendantNodes|Document order| +|XContainer.Descendants|Document order| +|XContainer.Elements|Document order| +|XContainer.Nodes|Document order| +|XContainer.NodesAfterSelf|Document order| +|XContainer.NodesBeforeSelf|Document order| +|XElement.AncestorsAndSelf|Reverse document order| +|XElement.Attributes|Document order| +|XElement.DescendantNodesAndSelf|Document order| +|XElement.DescendantsAndSelf|Document order| +|XNode.Ancestors|Reverse document order| +|XNode.ElementsAfterSelf|Document order| +|XNode.ElementsBeforeSelf|Document order| +|XNode.NodesAfterSelf|Document order| +|XNode.NodesBeforeSelf|Document order| + +## Positional predicates + +Within an XPath expression, positional predicates are expressed in terms of document order for many axes, but are expressed in reverse document order for reverse axes. The reverse axes are: `preceding`, `preceding-sibling`, `ancestor`, and `ancestor-or-self`. For example, the XPath expression `preceding-sibling::*[1]` returns the immediately preceding sibling. This is the case even though the final result set is presented in document order. + +By contrast, all positional predicates in LINQ to XML are always expressed in terms of the order of the axis. For example, `anElement.ElementsBeforeSelf().ElementAt(0)` returns the first child element of the parent of the queried element, not the immediate preceding sibling. Another example: `anElement.Ancestors().ElementAt(0)` returns the parent element. + +If you wanted to find the immediately preceding element in LINQ to XML, you would write the following expression: + +```csharp +ElementsBeforeSelf().Last() +``` + +```vb +ElementsBeforeSelf().Last() +``` + +## Performance differences + +XPath queries that use the XPath functionality in LINQ to XML will be slower than LINQ to XML queries. + +## Comparison of composition + +Composition of a LINQ to XML query is similar to composition of an XPath expression, but the syntax is very different. + +For example, if you have an element in a variable named `customers`, and you want to find a grandchild element named `CompanyName` under all child elements named `Customer`, you would write this XPath expression: + +```csharp +customers.XPathSelectElements("./Customer/CompanyName") +``` + +```vb +customers.XPathSelectElements("./Customer/CompanyName") +``` + +The equivalent LINQ to XML query is: + +```csharp +customers.Elements("Customer").Elements("CompanyName") +``` + +```vb +customers.Elements("Customer").Elements("CompanyName") +``` + +There are similar parallels for each of the XPath axes. + +|XPath axis|LINQ to XML axis| +|----------------|----------------------| +|child (the default axis)|| +|Parent (..)|| +|attribute axis (@)|

or

| +|ancestor axis|| +|ancestor-or-self axis|| +|descendant axis (//)|

or

| +|descendant-or-self|

or

| +|following-sibling|

or

| +|preceding-sibling|

or

| +|following|No direct equivalent.| +|preceding|No direct equivalent.| diff --git a/docs/standard/linq/concepts-terminology-functional-transformation.md b/docs/standard/linq/concepts-terminology-functional-transformation.md new file mode 100644 index 0000000000000..baf69e372e5d4 --- /dev/null +++ b/docs/standard/linq/concepts-terminology-functional-transformation.md @@ -0,0 +1,79 @@ +--- +title: Concepts and terminology (functional transformation) - LINQ to XML +description: Learn the concepts and terminology of pure functional transformations. +ms.date: 07/20/2015 +ms.assetid: 03defb3a-7e17-4ab1-8efa-4dd66621e860 +--- + +# Concepts and terminology (functional transformation) (LINQ to XML) + +This article introduces the concepts and terminology of pure functional transformations. The functional transformation approach to transforming data yields code that's often quicker to program, more expressive, and easier to debug and maintain than more traditional, imperative programming. + +Note that the articles in this section aren't intended to fully explain functional programming. Instead, these articles identify some of the functional programming capabilities that make it easier to transform XML from one shape to another. + +## What is pure functional transformation + +In *pure functional transformation*, a set of functions, called *pure functions*, define how to transform a set of structured data from its original form into another form. The word "pure" indicates that the functions are *composable*, which requires that they're: + +- *Self-contained*, so that they can be freely ordered and rearranged without entanglement or interdependencies with the rest of the program. Pure transformations have no knowledge of or effect upon their environment. That is, the functions used in the transformation have no *side effects*. +- *Stateless*, so that executing the same function or specific set of functions on the same input will always result in the same output. Pure transformations have no memory of their prior use. + +> [!IMPORTANT] +> In the rest of this tutorial, the term "pure function" is used in a general sense to indicate a programming approach, and not a specific language feature. +> +> Note that pure functions must be implemented as methods in C#, and as functions in Visual Basic. +> +> You shouldn't confuse pure functions with pure virtual methods in C++. The latter indicates that the containing class is abstract and that no method body is supplied. + +### Functional programming + +*Functional programming* is a programming approach that directly supports pure functional transformation. + +Historically, general-purpose functional programming languages, such as ML, Scheme, Haskell, and F#, have been primarily of interest to the academic community. Although it has always been possible to write pure functional transformations in C# and Visual Basic, the difficulty of doing so has not made it an attractive option to most programmers. In recent versions of these languages, however, new language constructs such as lambda expressions and type inference make functional programming much easier and more productive. + +For more information about functional programming, see [Functional programming vs. imperative programming](functional-vs-imperative-programming.md). + +#### Domain-specific functional programming languages + +Although general functional programming languages haven't been widely adopted, some domain-specific functional programming languages have had better success. For example, Cascading Style Sheets (CSS) are used to determine the look and feel of many web pages, and Extensible Stylesheet Language Transformations (XSLT) style sheets are used extensively in XML data manipulation. For more information about XSLT, see [XSLT Transformations](../data/xml/xslt-transformations.md). + +## Terminology + +The following list defines some terms related to functional transformations. + +higher-order (first-class) function \ +A function that can be treated as a programmatic object. For example, a higher-order function can be passed to or returned from other functions. In C# and Visual Basic, delegates and lambda expressions are language features that support higher-order functions. To write a higher-order function, you declare one or more arguments to take delegates, and you often use lambda expressions when calling it. Many of the standard query operators are higher-order functions. + +For more information, see [Standard Query Operators Overview (C#)](../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) and [Standard Query Operators Overview (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md). + +lambda expression \ +Essentially, an inline anonymous function that can be used wherever a delegate type is expected. This is a simplified definition of lambda expressions, but it's adequate for the purposes of this tutorial. + +For more information, see [Lambda expressions (C# Programming Guide)](../../csharp/programming-guide/statements-expressions-operators/lambda-expressions.md) and [Lambda Expressions (Visual Basic))](../../visual-basic/programming-guide/language-features/procedures/lambda-expressions.md). + +collection \ +A structured set of data, usually of a uniform type. To be compatible with LINQ, a collection must implement the interface or the interface (or one of their generic counterparts, or ). + +tuple (anonymous types) \ +A mathematical concept, a tuple is a finite sequence of objects, each of a specific type. A tuple is also known as an ordered list. Anonymous types are a language implementation of this concept, which enable an unnamed class type to be declared and an object of that type to be instantiated at the same time. + +For more information, see [Anonymous Types (C# Programming Guide)](../../csharp/programming-guide/classes-and-structs/anonymous-types.md) and [Anonymous Types (Visual Basic)](../../visual-basic/programming-guide/language-features/objects-and-classes/anonymous-types.md). + +type inference (implicit typing) \ +The ability of a compiler to determine the type of a variable in the absence of an explicit type declaration. + +For more information, see [Implicitly typed local variables (C# Programming Guide)](../../csharp/programming-guide/classes-and-structs/implicitly-typed-local-variables.md) and [Local Type Inference (Visual Basic)](../../visual-basic/programming-guide/language-features/variables/local-type-inference.md). + +deferred execution and lazy evaluation \ +The delaying of evaluation of an expression until its resolved value is actually required. Deferred execution is supported in collections. + +For more C# information, see [Introduction to LINQ Queries (C#)](../../csharp/programming-guide/concepts/linq/introduction-to-linq-queries.md) and [Deferred Execution and Lazy Evaluation in LINQ to XML (C#)](../../csharp/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). + +For more Visual Basic information, see [Basic Query Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-query-operations.md) and [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). + +These language features will be used in code samples throughout this section. + +## See also + +- [Introduction to pure functional transformations](introduction-pure-functional-transformations.md) +- [Functional programming vs. imperative programming](functional-vs-imperative-programming.md) diff --git a/docs/standard/linq/control-namespace-prefixes.md b/docs/standard/linq/control-namespace-prefixes.md new file mode 100644 index 0000000000000..8704a47252dfb --- /dev/null +++ b/docs/standard/linq/control-namespace-prefixes.md @@ -0,0 +1,74 @@ +--- +title: How to control namespace prefixes - LINQ to XML +description: You can control namespace prefixes when serializing an XML tree in C# and Visual Basic. To do this, insert attributes that declare namespaces. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 64de5186-b81a-4ddd-8327-8693df59a01b +--- + +# How to control namespace prefixes (LINQ to XML) + +This article describes how to control namespace prefixes when serializing an XML tree in C# and Visual Basic. + +In many situations, it's not necessary to control namespace prefixes. However, certain XML programming tools require it. For example, you might be manipulating an XSLT style sheet or a XAML document that contains embedded XPath expressions that refer to specific namespace prefixes. In such a case, it's important that the document be serialized with those prefixes. This is a common reason for controlling namespace prefixes. + +Another reason is that you want users to edit the XML document manually, and you want to create namespace prefixes that are convenient for the user to type. For example, you might be generating an XSD document. Conventions for schemas suggest that you use either `xs` or `xsd` as the prefix for the schema namespace. + +To control namespace prefixes, you insert attributes that declare namespaces. If you declare the namespaces with specific prefixes, LINQ to XML will attempt to honor the namespace prefixes when serializing. + +To create an attribute that declares a namespace with a prefix, you create an attribute where the namespace of the name of the attribute is , and the name of the attribute is the namespace prefix. The value of the attribute is the URI of the namespace. + +## Example: Create two namespaces that have prefixes + +This example declares two namespaces. It specifies the prefix `aw` for the `http://www.adventure-works.com` namespace, and the prefix `fc` for the `www.fourthcoffee.com` namespace. + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XNamespace fc = "www.fourthcoffee.com"; +XElement root = new XElement(aw + "Root", + new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), + new XAttribute(XNamespace.Xmlns + "fc", "www.fourthcoffee.com"), + new XElement(fc + "Child", + new XElement(aw + "DifferentChild", "other content") + ), + new XElement(aw + "Child2", "c2 content"), + new XElement(fc + "Child3", "c3 content") +); +Console.WriteLine(root); +``` + +```vb +Imports +Imports + +Module Module1 + + Sub Main() + Dim root As XElement = _ + + + other content + + c2 content + c3 content + + Console.WriteLine(root) + End Sub + +This example produces the following output: + +```xml + + + other content + + c2 content + c3 content + +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/control-type-projection.md b/docs/standard/linq/control-type-projection.md new file mode 100644 index 0000000000000..30c2411276b3b --- /dev/null +++ b/docs/standard/linq/control-type-projection.md @@ -0,0 +1,135 @@ +--- +title: How to control the type of a projection - LINQ to XML +description: You can control the type of collection that your query returns; it need not be an IEnumerable of XElements. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: e4db6b7e-4cc9-4c8f-af85-94acf32aa348 +--- +# How to control the type of a projection (LINQ to XML) + +*Projection* is the process of filtering a set of data, changing its shape and perhaps its type. Most query expressions do projections. Most of the query expressions in this section evaluate to of , but you can create collections of other types. This article shows how to do this. + +## Example: Define a new type and create a query that creates an IEnumerable of that type + +The following example defines a new type, `Customer`, and the query expression instantiates new `Customer` objects in the `Select` clause. This causes the type of the query expression to be of `Customer`. The example uses XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md). + +```csharp +public class Customer +{ + private string customerID; + public string CustomerID{ get{return customerID;} set{customerID = value;}} + + private string companyName; + public string CompanyName{ get{return companyName;} set{companyName = value;}} + + private string contactName; + public string ContactName { get{return contactName;} set{contactName = value;}} + + public Customer(string customerID, string companyName, string contactName) + { + CustomerID = customerID; + CompanyName = companyName; + ContactName = contactName; + } + + public override string ToString() + { + return $"{this.customerID}:{this.companyName}:{this.contactName}"; + } +} + +class Program +{ + static void Main(string[] args) + { + XElement custOrd = XElement.Load("CustomersOrders.xml"); + IEnumerable custList = + from el in custOrd.Element("Customers").Elements("Customer") + select new Customer( + (string)el.Attribute("CustomerID"), + (string)el.Element("CompanyName"), + (string)el.Element("ContactName") + ); + foreach (Customer cust in custList) + Console.WriteLine(cust); + } + + +} +``` + +```vb +Public Class Customer + Private customerIDValue As String + Public Property CustomerID() As String + Get + Return customerIDValue + End Get + Set(ByVal value As String) + customerIDValue = value + End Set + End Property + + Private companyNameValue As String + Public Property CompanyName() As String + Get + Return companyNameValue + End Get + Set(ByVal value As String) + companyNameValue = value + End Set + End Property + + Private contactNameValue As String + Public Property ContactName() As String + Get + Return contactNameValue + End Get + Set(ByVal value As String) + contactNameValue = value + End Set + End Property + + Public Sub New(ByVal customerID As String, _ + ByVal companyName As String, _ + ByVal contactName As String) + CustomerIDValue = customerID + CompanyNameValue = companyName + ContactNameValue = contactName + End Sub + + Public Overrides Function ToString() As String + Return String.Format("{0}:{1}:{2}", Me.CustomerID, Me.CompanyName, Me.ContactName) + End Function +End Class + +Sub Main() + Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") + Dim custList As IEnumerable(Of Customer) = _ + From el In custOrd.. _ + Select New Customer( _ + el.@, _ + el..Value, _ + el..Value _ + ) + For Each cust In custList + Console.WriteLine(cust) + Next +End Sub +``` + +This example produces the following output: + +```output +GREAL:Great Lakes Food Market:Howard Snyder +HUNGC:Hungry Coyote Import Store:Yoshi Latimer +LAZYK:Lazy K Kountry Store:John Steel +LETSS:Let's Stop N Shop:Jaime Yorres +``` + +## See also + +- +- [Projections and Transformations (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md) diff --git a/docs/standard/linq/create-document-namespaces-csharp.md b/docs/standard/linq/create-document-namespaces-csharp.md new file mode 100644 index 0000000000000..88bbdab7ec8ec --- /dev/null +++ b/docs/standard/linq/create-document-namespaces-csharp.md @@ -0,0 +1,149 @@ +--- +title: How to create a document with namespaces in C# - LINQ to XML +description: Use the XNamespace object in C# to create documents that have default namespaces or namespaces with a prefix. +ms.date: 07/20/2015 +ms.assetid: 37e63c57-f86d-47ac-88a7-2c2d107def30 +--- + +# How to create a document with namespaces in C# (LINQ to XML) + +This article shows how to create documents in C# that have namespaces. + +## Example: Declare and initialize a default namespace + +To create an element or an attribute that's in a namespace, you first declare and initialize an object. You then use the addition operator overload to combine the namespace with the local name, expressed as a string. + +The following example creates a document with one namespace. By default, LINQ to XML serializes this document with a default namespace. + +```csharp +// Create an XML tree in a namespace. +XNamespace aw = "http://www.adventure-works.com"; +XElement root = new XElement(aw + "Root", + new XElement(aw + "Child", "child content") +); +Console.WriteLine(root); +``` + +This example produces the following output: + +```xml + + child content + +``` + +## Example: Create a document that has a namespace and an attribute + +The following example creates a document with one namespace. It also creates an attribute that declares the namespace with a namespace prefix. To create an attribute that declares a namespace with a prefix, you create an attribute where the name of the attribute is the namespace prefix, and this name is in the namespace. The value of this attribute is the URI of the namespace. + +```csharp +// Create an XML tree in a namespace, with a specified prefix +XNamespace aw = "http://www.adventure-works.com"; +XElement root = new XElement(aw + "Root", + new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), + new XElement(aw + "Child", "child content") +); +Console.WriteLine(root); +``` + +This example produces the following output: + +```xml + + child content + +``` + +## Example: Create a document that has two namespaces, one with a prefix + +The following example shows the creation of a document that contains two namespaces. One is the default namespace, the other is a namespace with a prefix. + +By including namespace attributes in the root element, the namespaces are serialized so that `http://www.adventure-works.com` is the default namespace, and `www.fourthcoffee.com` is serialized with a prefix of `fc`. To create an attribute that declares a default namespace, you create an attribute with the name `xmlns`, without a namespace. The value of the attribute is the default namespace URI. + +```csharp +// The http://www.adventure-works.com namespace is forced to be the default namespace. +XNamespace aw = "http://www.adventure-works.com"; +XNamespace fc = "www.fourthcoffee.com"; +XElement root = new XElement(aw + "Root", + new XAttribute("xmlns", "http://www.adventure-works.com"), + new XAttribute(XNamespace.Xmlns + "fc", "www.fourthcoffee.com"), + new XElement(fc + "Child", + new XElement(aw + "DifferentChild", "other content") + ), + new XElement(aw + "Child2", "c2 content"), + new XElement(fc + "Child3", "c3 content") +); +Console.WriteLine(root); +``` + +This example produces the following output: + +```xml + + + other content + + c2 content + c3 content + +``` + +## Example: Create a document that has two namespaces, both with prefixes + +The following example creates a document that contains two namespaces, both with namespace prefixes. + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XNamespace fc = "www.fourthcoffee.com"; +XElement root = new XElement(aw + "Root", + new XAttribute(XNamespace.Xmlns + "aw", aw.NamespaceName), + new XAttribute(XNamespace.Xmlns + "fc", fc.NamespaceName), + new XElement(fc + "Child", + new XElement(aw + "DifferentChild", "other content") + ), + new XElement(aw + "Child2", "c2 content"), + new XElement(fc + "Child3", "c3 content") +); +Console.WriteLine(root); +``` + +This example produces the following output: + +```xml + + + other content + + c2 content + c3 content + +``` + +## Example: Create a namespace using expanded names + +Another way to accomplish the same result is to use expanded names instead of declaring and creating an object. + +This approach has performance implications. Each time you pass a string that contains an expanded name to LINQ to XML, LINQ to XML must parse the name, find the atomized namespace, and find the atomized name. This process takes CPU time. If performance is important, you might want to declare and use an object explicitly. + +If performance is an important issue, see [Pre-Atomization of XName Objects](pre-atomization-xname-objects.md) for more information. + +```csharp +// Create an XML tree in a namespace, with a specified prefix +XElement root = new XElement("{http://www.adventure-works.com}Root", + new XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com"), + new XElement("{http://www.adventure-works.com}Child", "child content") +); +Console.WriteLine(root); +``` + +This example produces the following output: + +```xml + + child content + +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/create-document-namespaces-visual-basic.md b/docs/standard/linq/create-document-namespaces-visual-basic.md new file mode 100644 index 0000000000000..2a7fbec939ab3 --- /dev/null +++ b/docs/standard/linq/create-document-namespaces-visual-basic.md @@ -0,0 +1,117 @@ +--- +title: How to create a document with namespaces in Visual Basic - LINQ to XML +description: Use XML literals in Visual Basic to create documents that have default namespaces or namespaces with a prefix. +ms.date: 07/20/2015 +ms.assetid: cc5b0d4d-360c-4ada-94fa-2d2916e989be +--- + +# How to create a document with namespaces in Visual Basic (LINQ to XML) + +This article shows how to create a document with namespaces in Visual Basic. + +When using XML literals in Visual Basic, users can define one global default XML namespace. This namespace is the default namespace for both XML literals and XML properties. The default XML namespace can be defined at either the project level or the file level. If it's defined at the file level, it overrides the default namespace at the project level. + +You can also define other namespaces, and specify the namespace prefixes for those namespaces. You use the `Imports` keyword to define both types of namespace. + +For more information, see [XML literals in Visual Basic](xml-literals.md). + +Note that the default XML namespace only applies to elements and not to attributes. Attributes are by default in the default namespace. However, you can use a namespace prefix to put an attribute in a namespace. + +## Example: Create a document that has a namespace + +This example creates a document that contains a namespace. + +```vb +Imports +Module Module1 + Sub Main() + Dim root As XElement = _ + + + + Console.WriteLine(root) + End Sub +End Module +``` + +This example produces the following output: + +```xml + + + +``` + +## Example: Create a document that has two namespaces, one with a prefix + +This example creates a document that contains two namespaces. One is the default namespace, the other has a prefix. + +```vb +Imports +Imports + +Module Module1 + + Sub Main() + Dim root As XElement = _ + + + child2 content + + Console.WriteLine(root) + End Sub + +End Module +``` + +This example produces the following output: + +```xml + + + child2 content + +``` + +## Example: Create a document that has two namespaces, both with prefixes + +The following example creates a document that contains two namespaces, both having namespace prefixes. + +When serializing an XML tree, LINQ to XML emits namespace declarations as required so that each element is in its designated namespace. + +```vb +Imports +Imports + +Module Module1 + + Sub Main() + Dim root As XElement = _ + + + other content + + c2 content + c3 content + + Console.WriteLine(root) + End Sub + +End Module +``` + +This example produces the following output: + +```xml + + + other content + + c2 content + c3 content + +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/create-hierarchy-grouping.md b/docs/standard/linq/create-hierarchy-grouping.md new file mode 100644 index 0000000000000..5a8482c288ec4 --- /dev/null +++ b/docs/standard/linq/create-hierarchy-grouping.md @@ -0,0 +1,99 @@ +--- +title: How to create hierarchy using grouping - LINQ to XML +description: See an example on how data can be grouped based on related values in different elements, then reordered to place related elements together under an element that reflects the relationship. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 0213d59e-5f76-438c-9cab-4bf11f7b971d +--- + +# How to create hierarchy using grouping (LINQ to XML) + +Data can be grouped based on related values in different elements, then reordered to place related elements together under an element that reflects the relationship. This article provides an example for C# and Visual Basic. + +## Example: Create a new XML document in which data is grouped by category + +The following example shows how to group data, and generate XML based on the grouping. It first groups data by equality of value of the `` elements, then generates a new XML file in which the XML hierarchy reflects the grouping. + +This example uses XML document [Sample XML file: Numerical data](sample-xml-file-numerical-data.md). + +```csharp +XElement doc = XElement.Load("Data.xml"); +var newData = + new XElement("Root", + from data in doc.Elements("Data") + group data by (string)data.Element("Category") into groupedData + select new XElement("Group", + new XAttribute("ID", groupedData.Key), + from g in groupedData + select new XElement("Data", + g.Element("Quantity"), + g.Element("Price") + ) + ) + ); +Console.WriteLine(newData); +``` + +```vb +Dim doc As XElement = XElement.Load("Data.xml") +Dim newData As XElement = _ + + <%= _ + From data In doc. _ + Group By category = data.(0).Value _ + Into groupedData = Group _ + Select > + <%= _ + From g In groupedData _ + Select _ + + <%= g.(0) %> + <%= g.(0) %> + _ + %> + _ + %> + +Console.WriteLine(newData) +``` + +This example produces the following output: + +```xml + + + + 3 + 24.50 + + + 5 + 4.95 + + + 3 + 66.00 + + + 15 + 29.00 + + + + + 1 + 89.99 + + + 10 + .99 + + + 8 + 6.99 + + + +``` diff --git a/docs/standard/linq/create-source-office-open-xml-document.md b/docs/standard/linq/create-source-office-open-xml-document.md new file mode 100644 index 0000000000000..98875a6feb6b3 --- /dev/null +++ b/docs/standard/linq/create-source-office-open-xml-document.md @@ -0,0 +1,76 @@ +--- +title: Create the source Office Open XML document - LINQ to XML +description: Learn how to create the Office Open XML WordprocessingML document used by the other examples in this tutorial. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 653c8cdb-73be-4dc2-927f-924cfb4ed9ed +--- + +# Create the source Office Open XML document (LINQ to XML) + +This article shows how to create the Office Open XML WordprocessingML document used by the other examples in this tutorial. If you follow these instructions, your output will match the output provided in each example. + +However, the examples in this tutorial will work with any valid WordprocessingML document. + +To create the document that this tutorial uses, you must either have Microsoft Office 2007 or later installed, or you must have Microsoft Office 2003 with the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. + +## Create the WordprocessingML document + +Use the following steps to create the WordprocessingML document: + +1. Create a new Microsoft Word document. +1. Paste the following text into the new document. + 1. For C#, use this text: + + ```text + Parsing WordprocessingML with LINQ to XML + + The following example prints to the console. + + using System; + + class Program { + public static void Main(string[] args) { + Console.WriteLine("Hello World"); + } + } + + This example produces the following output: + + Hello World + ``` + + 1. For Visual Basic, use this text: + + ```text + Parsing WordprocessingML with LINQ to XML + + The following example prints to the console. + + Imports System + + Class Program + Public Shared Sub Main(ByVal args() As String) + Console.WriteLine("Hello World") + End Sub + End Class + + This example produces the following output: + + Hello World + ``` + +1. Format the first line with the style "Heading 1". +1. For C#, select the lines that contain the C# code. The first line starts with the `using` keyword. The last line is the last closing brace. Format the lines with the courier font. Format them with a new style, and name the new style "Code". +1. For Visual Basic, select the lines that contain the Visual Basic code. The first line starts with the `Imports` keyword. The last line is "End Class". Format the lines with the courier font. Format them with a new style, and name the new style "Code". +1. Finally, select the entire line that contains the output, and format it with the `Code` style. +1. Save the document, and name it SampleDoc.docx. + +> [!NOTE] +> If you're using Microsoft Word 2003, select **Word 2007 Document** in the **Save as Type** drop-down list. + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) diff --git a/docs/standard/linq/create-tree-xmlreader.md b/docs/standard/linq/create-tree-xmlreader.md new file mode 100644 index 0000000000000..4ab0ba6cbc77c --- /dev/null +++ b/docs/standard/linq/create-tree-xmlreader.md @@ -0,0 +1,66 @@ +--- +title: How to create a tree from an XmlReader - LINQ to XML +description: You can use an XmlReader in C# or Visual Basic to read XML and create an XML tree. You must properly position the XmlReader on an element node. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 60951c9c-7087-406c-b5bb-c60e58609b21 +--- + +# How to create a tree from an XmlReader (LINQ to XML) + +This article shows how to create an XML tree directly from an in C# or Visual Basic. To create an from an , you position the on an element node. The will skip comments and processing instructions, but if the is positioned on a text node, an error will be thrown. To avoid such errors, position the on an element before you create an XML tree from the . + +## Example: Load XElement object from an XmlReader object + +This example uses the XML document [Sample XML file: Books](sample-xml-file-books.md). + +The following code creates a object, reads nodes until it finds the first element node, and loads the object. + +```csharp +XmlReader r = XmlReader.Create("books.xml"); +while (r.NodeType != XmlNodeType.Element) + r.Read(); +XElement e = XElement.Load(r); +Console.WriteLine(e); +``` + +```vb +Dim r As XmlReader = XmlReader.Create("books.xml") +Do While r.NodeType <> XmlNodeType.Element + r.Read() +Loop +Dim e As XElement = XElement.Load(r) +Console.WriteLine(e) +``` + +This example produces the following output: + +```xml + + + Garghentini, Davide + XML Developer's Guide + Computer + 44.95 + 2000-10-01 + An in-depth look at creating applications + with XML. + + + Garcia, Debra + Midnight Rain + Fantasy + 5.95 + 2000-12-16 + A former architect battles corporate zombies, + an evil sorceress, and her own childhood to become queen + of the world. + + +``` + +## See also + +- [Parse XML](parse-string.md) diff --git a/docs/standard/linq/create-xml-trees.md b/docs/standard/linq/create-xml-trees.md new file mode 100644 index 0000000000000..06c7586559f6b --- /dev/null +++ b/docs/standard/linq/create-xml-trees.md @@ -0,0 +1,239 @@ +--- +title: Create XML Trees in C# - LINQ to XML +description: You can create an XML tree in C# using the LINQ to XML XElement and XAttribute constructors, and you can make the code resemble the structure of the underlying XML. +ms.date: 08/31/2018 +ms.assetid: cc74234a-0bac-4327-9c8c-5a2ead15b595 +--- + +# Create XML trees in C# (LINQ to XML) + +This article provides information about creating XML trees in C#. + +For information about using the results of LINQ queries as the content for an , see [Functional construction](functional-construction.md). + +## Construct elements + +The signatures of the and constructors let you pass the contents of the element or attribute as arguments to the constructor. Because one of the constructors takes a variable number of arguments, you can pass any number of child elements. Of course, each of those child elements can contain their own child elements. For any element, you can add any number of attributes. + +When adding (including ) or objects, if the new content has no parent, the objects are simply attached to the XML tree. If the new content already is parented, and is part of another XML tree, the new content is cloned, and the newly cloned content is attached to the XML tree. The last example in this article demonstrates this. + +To create a `contacts` , you could use the following code: + +```csharp +XElement contacts = + new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144"), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) + ); +``` + +If indented properly, the code to construct objects closely resembles the structure of the underlying XML. + +## XElement constructors + +The class uses the following constructors for functional construction. Note that there are some other constructors for , but because they're not used for functional construction they're not listed here. + +|Constructor|Description| +|-----------------|-----------------| +|`XElement(XName name, object content)`|Creates an . The `name` parameter specifies the name of the element; `content` specifies the content of the element.| +|`XElement(XName name)`|Creates an with its initialized to the specified name.| +|`XElement(XName name, params object[] content)`|Creates an with its initialized to the specified name. The attributes and/or child elements are created from the contents of the parameter list.| + +The `content` parameter is extremely flexible. It supports any type of object that's a valid child of an . The following rules apply to different types of objects passed in this parameter: + +- A string is added as text content. +- An is added as a child element. +- An is added as an attribute. +- An , , or is added as child content. +- An is enumerated, and these rules are applied recursively to the results. +- For any other type, its `ToString` method is called and the result is added as text content. + +## Example: Create an XElement with content + +You can create an that contains simple content with a single method call. To do this, specify the content as the second parameter, as follows: + +```csharp +XElement n = new XElement("Customer", "Adventure Works"); +Console.WriteLine(n); +``` + +This example produces the following output: + +```xml +Adventure Works +``` + +You can pass any type of object as the content. For example, the following code creates an element that contains a floating point number as content: + +```csharp +XElement n = new XElement("Cost", 324.50); +Console.WriteLine(n); +``` + +This example produces the following output: + +```xml +324.5 +``` + +The floating point number is boxed and passed in to the constructor. The boxed number is converted to a string and used as the content of the element. + +## Example: Create an XElement with a child element + +If you pass an instance of the class for the content argument, the constructor creates an element with a child element: + +```csharp +XElement shippingUnit = new XElement("ShippingUnit", + new XElement("Cost", 324.50) +); +Console.WriteLine(shippingUnit); +``` + +This example produces the following output: + +```xml + + 324.5 + +``` + +## Example: Create an XElement with multiple child elements + +You can pass in a number of objects for the content. Each of the objects is included as a child element. + +```csharp +XElement address = new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") +); +Console.WriteLine(address); +``` + +This example produces the following output: + +```xml +
+ 123 Main St + Mercer Island + WA + 68042 +
+``` + +By extending the previous example, you can create an entire XML tree, as follows: + +```csharp +XElement contacts = + new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144"), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) + ); +Console.WriteLine(contacts); +``` + +This example produces the following output: + +```xml + + + Patrick Hines + 206-555-0144 +
+ 123 Main St + Mercer Island + WA + 68042 +
+
+
+``` + +## Example: Create an XElement with an XAttribute + +If you pass an instance of the class for the content argument, the constructor creates an element with an attribute: + +```csharp +XElement phone = new XElement("Phone", + new XAttribute("Type", "Home"), + "555-555-5555"); +Console.WriteLine(phone); +``` + +This example produces the following output: + +```xml +555-555-5555 +``` + +## Example: Create an empty element + +To create an empty , don't pass any content to the constructor. The following example creates an empty element: + +```csharp +XElement n = new XElement("Customer"); +Console.WriteLine(n); +``` + +This example produces the following output: + +```xml + +``` + +## Example: Attach vs. clone + +As mentioned previously, when adding (including ) or objects, if the new content has no parent, the objects are simply attached to the XML tree. If the new content already is parented and is part of another XML tree, the new content is cloned, and the newly cloned content is attached to the XML tree. + +The following example demonstrates the behavior when you add a parented element to a tree, and when you add an element with no parent to a tree: + +```csharp +// Create a tree with a child element. +XElement xmlTree1 = new XElement("Root", + new XElement("Child1", 1) +); + +// Create an element that's not parented. +XElement child2 = new XElement("Child2", 2); + +// Create a tree and add Child1 and Child2 to it. +XElement xmlTree2 = new XElement("Root", + xmlTree1.Element("Child1"), + child2 +); + +// Compare Child1 identity. +Console.WriteLine("Child1 was {0}", + xmlTree1.Element("Child1") == xmlTree2.Element("Child1") ? + "attached" : "cloned"); + +// Compare Child2 identity. +Console.WriteLine("Child2 was {0}", + child2 == xmlTree2.Element("Child2") ? + "attached" : "cloned"); + +// This example produces the following output: +// Child1 was cloned +// Child2 was attached +``` + +## See also + +- [Functional construction](functional-construction.md) diff --git a/docs/standard/linq/debug-empty-query-results-sets.md b/docs/standard/linq/debug-empty-query-results-sets.md new file mode 100644 index 0000000000000..9db7fedd14878 --- /dev/null +++ b/docs/standard/linq/debug-empty-query-results-sets.md @@ -0,0 +1,135 @@ +--- +title: How to debug empty query results sets - LINQ to XML +description: When you query an XML tree in a default namespace, avoid the common error of querying as though the XML were not in a namespace. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b569f0dc-425e-45a6-acbf-770fb761c981 +--- + +# How to debug empty query results sets (LINQ to XML) + +One of the most common problems when querying XML trees is that if the XML tree has a default namespace, the developer sometimes writes the query as though the XML were not in a namespace. + +The first set of examples in this article shows a typical way that XML in a default namespace is loaded, and then queried improperly. + +The second set of examples show the necessary corrections so that you can query XML in a namespace. + +For more information, see [Namespaces overview](namespaces-overview.md). + +## Example: An improper query on XML in a namespace + +This example shows creation of XML in a namespace, and a query that returns an empty result set. + +```csharp +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +IEnumerable c1 = + from el in root.Elements("Child") + select el; +Console.WriteLine("Result set follows:"); +foreach (XElement el in c1) + Console.WriteLine((int)el); +Console.WriteLine("End of result set"); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + +Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el +Console.WriteLine("Result set follows:") +For Each el As XElement In c1 + Console.WriteLine(el.Value) +Next +Console.WriteLine("End of result set") +``` + +The example produces this result: + +```output +Result set follows: +End of result set +``` + +## Example: A proper query on XML in a namespace + +This example shows creation of XML in a namespace, and a query that's coded properly. + +The solution is to declare and initialize an object, and to use it when specifying objects. In this case, the argument to the method is an object. + +```csharp +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +XNamespace aw = "http://www.adventure-works.com"; +IEnumerable c1 = + from el in root.Elements(aw + "Child") + select el; +Console.WriteLine("Result set follows:"); +foreach (XElement el in c1) + Console.WriteLine((int)el); +Console.WriteLine("End of result set"); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el + Console.WriteLine("Result set follows:") + For Each el As XElement In c1 + Console.WriteLine(CInt(el)) + Next + Console.WriteLine("End of result set") + End Sub +End Module +``` + +The example produces this result: + +```output +Result set follows: +1 +2 +3 +End of result set +``` + +## See also + +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) diff --git a/docs/standard/linq/deferred-execution-example.md b/docs/standard/linq/deferred-execution-example.md new file mode 100644 index 0000000000000..d0dc7ccad002d --- /dev/null +++ b/docs/standard/linq/deferred-execution-example.md @@ -0,0 +1,95 @@ +--- +title: Deferred execution example - LINQ to XML +description: Learn how deferred execution and lazy evaluation affect the execution of your LINQ to XML queries. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 50f4fbac-81fe-4f26-aedf-506e21419b19 +--- + +# Deferred execution example (LINQ to XML) + +This article shows how deferred execution and lazy evaluation affect the execution of your LINQ to XML queries. + +## Example: Use the `yield return` construct in an extension method to defer execution + +The following example shows the order of execution when using an extension method that uses deferred execution. The example declares an array of three strings. It then iterates through the collection returned by `ConvertCollectionToUpperCase`. + +```csharp +public static class LocalExtensions +{ + public static IEnumerable + ConvertCollectionToUpperCase(this IEnumerable source) + { + foreach (string str in source) + { + Console.WriteLine("ToUpper: source {0}", str); + yield return str.ToUpper(); + } + } +} + +class Program +{ + static void Main(string[] args) + { + string[] stringArray = { "abc", "def", "ghi" }; + + var q = from str in stringArray.ConvertCollectionToUpperCase() + select str; + + foreach (string str in q) + Console.WriteLine("Main: str {0}", str); + } +} +``` + +```vb +Imports System.Runtime.CompilerServices + +Module Module1 + + + Private Iterator Function ConvertCollectionToUpperCase( + ByVal source As IEnumerable(Of String)) _ + As IEnumerable(Of String) + For Each str As String In source + Console.WriteLine("ToUpper: source {0}", str) + Yield str.ToUpper() + Next + End Function + + Sub Main() + Dim stringArray = New String() {"abc", "def", "ghi"} + + Dim q = From str In stringArray.ConvertCollectionToUpperCase() + Select str + + For Each Str As String In q + Console.WriteLine("Main: str {0}", Str) + Next + End Sub + +End Module +``` + +This example produces the following output: + +```output +ToUpper: source abc +Main: str ABC +ToUpper: source def +Main: str DEF +ToUpper: source ghi +Main: str GHI +``` + +Notice that when iterating through the collection returned by `ConvertCollectionToUpperCase`, each item is retrieved from the source string array and converted to uppercase before the next item is retrieved from the source string array. + +You can see that the entire array of strings isn't converted to uppercase before each item in the returned collection is processed in the `foreach` loop in `Main`. + +## See also + +- [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md) +- [Tutorial: Chain queries together (C#)](chain-queries-example.md) diff --git a/docs/standard/linq/deferred-execution-lazy-evaluation.md b/docs/standard/linq/deferred-execution-lazy-evaluation.md new file mode 100644 index 0000000000000..b0cdb63685d30 --- /dev/null +++ b/docs/standard/linq/deferred-execution-lazy-evaluation.md @@ -0,0 +1,37 @@ +--- +title: Deferred execution and lazy evaluation - LINQ to XML +description: Learn the advantages and requirements of deferred execution, and how to implement it using query and axis operations. +ms.date: 07/20/2015 +ms.assetid: 8683d1b4-b7ec-407b-be12-906ebe958a09 +--- + +# Deferred execution and lazy evaluation (LINQ to XML) + +Query and axis operations are often implemented to use deferred execution. This article explains the requirements and advantages of deferred execution, and some implementation considerations. + +## Deferred execution + +Deferred execution means that the evaluation of an expression is delayed until its *realized* value is actually required. Deferred execution can greatly improve performance when you have to manipulate large data collections, especially in programs that contain a series of chained queries or manipulations. In the best case, deferred execution enables only a single iteration through the source collection. + +The LINQ technologies make extensive use of deferred execution in both the members of core classes and in the extension methods in the various LINQ namespaces, such as . + +Deferred execution is supported directly in the C# language by the [yield (C# Reference)](../../csharp/language-reference/keywords/yield.md) keyword (in the form of the `yield-return` statement) when used within an iterator block. Such an iterator must return a collection of type or (or a derived type). + +## Eager vs. lazy evaluation + +When you write a method that implements deferred execution, you also have to decide whether to implement the method using lazy evaluation or eager evaluation. + +- In *lazy evaluation*, a single element of the source collection is processed during each call to the iterator. This is the typical way in which iterators are implemented. +- In *eager evaluation*, the first call to the iterator will result in the entire collection being processed. A temporary copy of the source collection might also be required. For example, the method has to sort the entire collection before it returns the first element. + +Lazy evaluation usually yields better performance because it distributes overhead processing evenly throughout the evaluation of the collection and minimizes the use of temporary data. Of course, for some operations, there is no other option than to materialize intermediate results. + +See [Deferred execution example](deferred-execution-example.md) for an example of programming deferred execution in C# and Visual Basic. + +## See also + +- [Tutorial: Chain Queries Together in C#](chain-queries-example.md) +- [Concepts and terminology (functional transformation)](concepts-terminology-functional-transformation.md) +- [Aggregation Operations (C#)](../../csharp/programming-guide/concepts/linq/aggregation-operations.md) +- [Aggregation Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/aggregation-operations.md) +- [yield (C# Reference)](../../csharp/language-reference/keywords/yield.md) diff --git a/docs/standard/linq/example-outputs-office-open-xml-document-parts.md b/docs/standard/linq/example-outputs-office-open-xml-document-parts.md new file mode 100644 index 0000000000000..b29e506c9639f --- /dev/null +++ b/docs/standard/linq/example-outputs-office-open-xml-document-parts.md @@ -0,0 +1,115 @@ +--- +title: Example that outputs Office Open XML document parts - LINQ to XML +description: Learn how to open an Office Open XML document and access its parts. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 6cd37055-89b4-42e8-bf27-5a29717e35f3 +--- + +# Example that outputs Office Open XML document parts (LINQ to XML) + +This article shows how to open an Office Open XML document and access its parts. + +## Example: Print the document and style parts of an Office Open XML document + +The following example opens an Office Open XML document and prints the document and styles parts. + +This example uses classes from the WindowsBase assembly, and types from the namespace. + +```csharp +const string fileName = "SampleDoc.docx"; + +const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; +const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; +const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; +XNamespace w = wordmlNamespace; + +using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) +{ + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + XDocument xdoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + Console.WriteLine("TargetUri:{0}", docPackageRelationship.TargetUri); + Console.WriteLine("=================================================================="); + Console.WriteLine(xdoc.Root); + Console.WriteLine(); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + XDocument styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + + Console.WriteLine("TargetUri:{0}", styleRelation.TargetUri); + Console.WriteLine("=================================================================="); + Console.WriteLine(styleDoc.Root); + Console.WriteLine(); + } + } +} +``` + +```vb +Const fileName As String = "SampleDoc.docx" + +Const documentRelationshipType As String = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" +Const stylesRelationshipType As String = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" +Const wordmlNamespace As String = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" +Dim w As XNamespace = wordmlNamespace + +Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If docPackageRelationship IsNot Nothing Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + Dim xdoc As XDocument = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + Console.WriteLine("TargetUri:{0}", docPackageRelationship.TargetUri) + Console.WriteLine("==================================================================") + Console.WriteLine(xdoc.Root) + Console.WriteLine() + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If styleRelation IsNot Nothing Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + Dim styleDoc As XDocument = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + + Console.WriteLine("TargetUri:{0}", styleRelation.TargetUri) + Console.WriteLine("==================================================================") + Console.WriteLine(styleDoc.Root) + Console.WriteLine() + End If + End If +End Using +``` diff --git a/docs/standard/linq/filter-attribute.md b/docs/standard/linq/filter-attribute.md new file mode 100644 index 0000000000000..0375b514c84d7 --- /dev/null +++ b/docs/standard/linq/filter-attribute.md @@ -0,0 +1,96 @@ +--- +title: How to filter on an attribute - LINQ to XML +description: This article shows how to use LINQ to XML query and XPath, in C# and Visual Basic, to find descendant elements that have a specified name and attribute value. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 208d6256-1bd7-4237-b2c9-909f26dfd0e2 +--- + +# How to filter on an attribute (LINQ to XML) + +This article shows how to use LINQ to XML query and XPath, in C# and Visual Basic, to find descendant elements that have a specified name and attribute value. + +## Example: Find all descendant elements that have a specified name and attribute value + +This example uses LINQ to XML query and XPath to find, in XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md), all descendant elements that have the name `Address`, and a `Type` attribute whose value is "Shipping". The XPath expression is `.//Address[@Type='Shipping']` + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +// LINQ to XML query +IEnumerable list1 = + from el in po.Descendants("Address") + where (string)el.Attribute("Type") == "Shipping" + select el; + +// XPath expression +IEnumerable list2 = po.XPathSelectElements(".//Address[@Type='Shipping']"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = _ + From el In po...
_ + Where el.@Type = "Shipping" _ + Select el + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = _ + po.XPathSelectElements(".//Address[@Type='Shipping']") + +If (list1.Count = list2.Count And _ + list1.Intersect(list2).Count() = list1.Count()) Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+
+ Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA +
+``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](/../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/filter-element-names.md b/docs/standard/linq/filter-element-names.md new file mode 100644 index 0000000000000..a62c6bbf7bc50 --- /dev/null +++ b/docs/standard/linq/filter-element-names.md @@ -0,0 +1,98 @@ +--- +title: How to filter on element names - LINQ to XML +description: Learn how to filter on the element name when you call a method that returns an IEnumerable of XElement. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 1849fb03-f075-421f-863c-e8fb32773cdf +--- + +# How to filter on element names (LINQ to XML) + +When you call one of the methods that return of , you can filter on the element name. + +## Example: Retrieve descendants filtered to a specified name + +This example retrieves a collection of descendants that's filtered to contain only descendants with the specified name. + +This example uses XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +XElement po = XElement.Load("PurchaseOrder.xml"); +IEnumerable items = + from el in po.Descendants("ProductName") + select el; +foreach(XElement prdName in items) + Console.WriteLine(prdName.Name + ":" + (string) prdName); +``` + +```vb +Dim po As XElement = XElement.Load("PurchaseOrder.xml") +Dim items As IEnumerable(Of XElement) = _ + From el In po... _ + Select el +For Each prdName As XElement In items + Console.WriteLine(prdName.Name.ToString & ":" & prdName.Value) +Next +``` + +This example produces the following output: + +```output +ProductName:Lawnmower +ProductName:Baby Monitor +``` + +The other methods that return of collections follow the same pattern. Their signatures are similar to and . The following is the complete list of methods that have similar method signatures: + +- +- +- +- +- +- +- + +## Example: Retrieve from XML that's in a namespace + +The following example shows the same query for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +The example uses XML document [Sample XML file: Typical purchase order in a namespace](sample-xml-file-typical-purchase-order-namespace.md). + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement po = XElement.Load("PurchaseOrderInNamespace.xml"); +IEnumerable items = + from el in po.Descendants(aw + "ProductName") + select el; +foreach (XElement prdName in items) + Console.WriteLine(prdName.Name + ":" + (string)prdName); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim po As XElement = XElement.Load("PurchaseOrderInNamespace.xml") + Dim items As IEnumerable(Of XElement) = _ + From el In po... _ + Select el + For Each prdName As XElement In items + Console.WriteLine(prdName.Name.ToString & ":" & prdName.Value) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +{http://www.adventure-works.com}ProductName:Lawnmower +{http://www.adventure-works.com}ProductName:Baby Monitor +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/filter-optional-element.md b/docs/standard/linq/filter-optional-element.md new file mode 100644 index 0000000000000..e3c21fab48ee2 --- /dev/null +++ b/docs/standard/linq/filter-optional-element.md @@ -0,0 +1,184 @@ +--- +title: How to filter on an optional element - LINQ to XML +description: You can write a search for a child element in such a way that the search doesn't trigger an exception when the element doesn't exist. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: f99e2f93-fca5-403f-8a0c-770761d4905a +--- + +# How to filter on an optional element (LINQ to XML) + +Sometimes you want to filter for an element even though you're not sure it exists in your XML document. You can write your search so that, even if the particular element doesn't have the child element, you don't trigger a null reference exception by filtering for it. + +## Example: Search that doesn't trigger an exception when the target element doesn't exist + +In the following example, the `Child5` element doesn't have a `Type` child element, but the query still executes correctly. The example uses the extension method. + +```csharp +XElement root = XElement.Parse(@" + + Child One Text + + + + Child Two Text + + + + Child Three Text + + + + Child Four Text + + + + Child Five Text + +"); +var cList = + from typeElement in root.Elements().Elements("Type") + where (string)typeElement.Attribute("Value") == "Yes" + select (string)typeElement.Parent.Element("Text"); +foreach(string str in cList) + Console.WriteLine(str); +``` + +```vb +Dim root As XElement = _ + + + Child One Text + + + + Child Two Text + + + + Child Three Text + + + + Child Four Text + + + + Child Five Text + + +Dim cList As IEnumerable(Of String) = _ + From typeElement In root.Elements(). _ + Where typeElement.@Value = "Yes" _ + Select typeElement.Parent..Value +Dim str As String +For Each str In cList + Console.WriteLine(str) +Next +``` + +This example produces the following output: + +```output +Child One Text +Child Two Text +Child Four Text +``` + +## Example: Same search but for XML in a namespace + +The following example is the same query but for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Parse(@" + + Child One Text + + + + Child Two Text + + + + Child Three Text + + + + Child Four Text + + + + Child Five Text + +"); +XNamespace ad = "http://www.adatum.com"; +var cList = + from typeElement in root.Elements().Elements(ad + "Type") + where (string)typeElement.Attribute("Value") == "Yes" + select (string)typeElement.Parent.Element(ad + "Text"); +foreach (string str in cList) + Console.WriteLine(str); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + + Child One Text + + + + Child Two Text + + + + Child Three Text + + + + Child Four Text + + + + Child Five Text + + + Dim cList As IEnumerable(Of String) = _ + From typeElement In root.Elements(). _ + Where typeElement.@Value = "Yes" _ + Select typeElement.Parent..Value + Dim str As String + For Each str In cList + Console.WriteLine(str) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +Child One Text +Child Two Text +Child Four Text +``` + +## See also + +- +- +- +- [Standard Query Operators Overview (C#)](../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) +- [Projection Operations (C#)](../../csharp/programming-guide/concepts/linq/projection-operations.md) +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) +- [XML Child Axis Property (Visual Basic)](../../visual-basic/language-reference/xml-axis/xml-child-axis-property.md) +- [XML Attribute Axis Property (Visual Basic)](../../visual-basic/language-reference/xml-axis/xml-attribute-axis-property.md) +- [XML Value Property](../../visual-basic/language-reference/xml-axis/xml-value-property.md) +- [Standard Query Operators Overview (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md) +- [Projection Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projection-operations.md) diff --git a/docs/standard/linq/find-all-nodes-namespace.md b/docs/standard/linq/find-all-nodes-namespace.md new file mode 100644 index 0000000000000..83f29e9fc8379 --- /dev/null +++ b/docs/standard/linq/find-all-nodes-namespace.md @@ -0,0 +1,141 @@ +--- +title: How to find all nodes in a namespace - LINQ to XML +description: You can filter on the namespace of each element or attribute to find all nodes in that particular namespace. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3a38b913-a53e-4d0e-a19d-8782bffd3364 +--- + +# How to find all nodes in a namespace (LINQ to XML) + +You can filter on the namespace of each element or attribute to find all nodes in that particular namespace. + +## Example: Create an XML tree with two namespaces, and print contents of one + +The following example creates an XML tree with two namespaces. It then iterates through the tree and prints the names of all the elements and attributes in one of those namespaces. + +```csharp +string markup = @" + abc + def + ghi + + jkl + mno + +"; +XElement xmlTree = XElement.Parse(markup); +Console.WriteLine("Nodes in the http://www.adventure-works.com namespace"); +IEnumerable awElements = + from el in xmlTree.Descendants() + where el.Name.Namespace == "http://www.adventure-works.com" + select el; +foreach (XElement el in awElements) + Console.WriteLine(el.Name.ToString()); +``` + +```vb +Imports +Imports + +Module Module1 + Sub Main() + Dim xmlTree As XElement = _ + + abc + def + ghi + + jkl + mno + + + Console.WriteLine("Nodes in the http://www.adventure-works.com namespace") + Dim awElements As IEnumerable(Of XElement) = _ + From el In xmlTree.Descendants() _ + Where (el.Name.Namespace = GetXmlNamespace(aw)) _ + Select el + For Each el As XElement In awElements + Console.WriteLine(el.Name.ToString()) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +Nodes in the http://www.adventure-works.com namespace +{http://www.adventure-works.com}Child3 +{http://www.adventure-works.com}GrandChild2 +``` + +## Example: Create an XML tree from one of two namespaces contained in a file + +XML document [Sample XML file: Consolidated purchase orders](sample-xml-file-consolidated-purchase-orders.md) contains purchase orders in two different namespaces. The following query creates a new tree from the elements of one of them. + +```csharp +XDocument cpo = XDocument.Load("ConsolidatedPurchaseOrders.xml"); +XNamespace aw = "http://www.adventure-works.com"; +XElement newTree = new XElement("Root", + from el in cpo.Root.Elements() + where el.Name.Namespace == aw + select el +); +Console.WriteLine(newTree); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim cpo As XDocument = XDocument.Load("ConsolidatedPurchaseOrders.xml") + Dim newTree As XElement = _ + + <%= From el In cpo.Root.Elements() _ + Where el.Name.Namespace = GetXmlNamespace(aw) _ + Select el %> + + Console.WriteLine(newTree) + End Sub +End Module +``` + +This example produces the following output: + +```xml + + + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + Ship only complete order. + + Litware Networking Card + 1 + 20.99 + + + Litware 17in LCD Monitor + 1 + 199.99 + + + +``` diff --git a/docs/standard/linq/find-attribute-parent.md b/docs/standard/linq/find-attribute-parent.md new file mode 100644 index 0000000000000..ade243c82261c --- /dev/null +++ b/docs/standard/linq/find-attribute-parent.md @@ -0,0 +1,74 @@ +--- +title: How to find an attribute of the parent - LINQ to XML +description: "Learn how to navigate to an element and find an attribute of its parent. Two methods are shown: one uses XPathEvaluate, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: dbef9d89-a5c4-431f-80cc-7a2ebf323f86 +--- + +# How to find an attribute of the parent (LINQ to XML) + +This article shows how to use to find an attribute of a parent element, and how to use LINQ to XML query to do the same thing. + +## Example: Find the `Author` element, and then find the `id` attribute of its parent + +This example first finds an `Author` element in XML document [Sample XML file: Books](sample-xml-file-books.md), and then finds the `id` attribute of its parent element. + +The XPath expression is `../@id`. + +```csharp +XDocument books = XDocument.Load("Books.xml"); + +XElement author = + books + .Root + .Element("Book") + .Element("Author"); + +// LINQ to XML query +XAttribute att1 = + author + .Parent + .Attribute("id"); + +// XPath expression +XAttribute att2 = ((IEnumerable)author.XPathEvaluate("../@id")).Cast().First(); + +if (att1 == att2) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(att1); +``` + +```vb +Dim books As XDocument = XDocument.Load("Books.xml") +Dim author As XElement = books.Root...FirstOrDefault() + +' LINQ to XML query +Dim att1 As XAttribute = author.Parent.Attribute("id") + +' XPath expression +Dim att2 As XAttribute = DirectCast(author.XPathEvaluate("../@id"), _ + IEnumerable).Cast(Of XAttribute)().First() + +If att1 Is att2 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(att1) +``` + +This example produces the following output: + +```output +Results are identical +id="bk101" +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-attributes-siblings-specific-name.md b/docs/standard/linq/find-attributes-siblings-specific-name.md new file mode 100644 index 0000000000000..218513b810b50 --- /dev/null +++ b/docs/standard/linq/find-attributes-siblings-specific-name.md @@ -0,0 +1,82 @@ +--- +title: How to find attributes of siblings with a specific name - LINQ to XML +description: "Learn how to find every attribute that has a specific name and that also belongs to a sibling of the context node. Two methods are shown: one uses XPathEvaluate, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: c3133d64-523f-422d-8838-73d36b945ca0 +--- + +# How to find attributes of siblings with a specific name (LINQ to XML) + +This article shows how to use to find every attribute that has a specific name and that also belongs to a sibling of the context node. The article also shows how to use LINQ to XML query to do the same thing. + +## Example: Find all sibling elements named `Book`, and then find all attributes named `id` + +This example finds a `Book` element in XML document [Sample XML file: Books](sample-xml-file-books.md). It then finds all sibling elements named `Book`, and all attributes named `id` of those elements. The result is a collection of attributes. + +The XPath expression is `../Book/@id`. + +```csharp +XDocument books = XDocument.Load("Books.xml"); + +XElement book = + books + .Root + .Element("Book"); + +// LINQ to XML query +IEnumerable list1 = + from el in book.Parent.Elements("Book") + select el.Attribute("id"); + +// XPath expression +IEnumerable list2 = + ((IEnumerable)book.XPathEvaluate("../Book/@id")).Cast(); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XAttribute el in list1) + Console.WriteLine(el); +``` + +```vb +Dim books as XDocument = XDocument.Load("Books.xml") +Dim book As XElement = books.Root.(0) + +' LINQ to XML query +Dim list1 As IEnumerable(Of XAttribute) = _ + From el In book.Parent. _ + Select el.Attribute("id") + +' XPath expression +Dim list2 As IEnumerable(Of XAttribute) = DirectCast(book. _ + XPathEvaluate("../Book/@id"), IEnumerable).Cast(Of XAttribute)() + +If list1.Count() = list2.Count() And _ + (list1.Intersect(list2)).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If + +For Each el As XAttribute In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +id="bk101" +id="bk102" +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-child-element.md b/docs/standard/linq/find-child-element.md new file mode 100644 index 0000000000000..00da59f12de75 --- /dev/null +++ b/docs/standard/linq/find-child-element.md @@ -0,0 +1,69 @@ +--- +title: How to find a child element - LINQ to XML +description: This article compares the XPath child element axis to the LINQ to XML method. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4fa6182d-6196-4ed1-9c9e-82949ff89c71 +--- + +# How to find a child element (LINQ to XML) + +This article compares the XPath child element axis to the LINQ to XML method. + +## Example: Find a child element in an XML document + +This example finds the child element `DeliveryNotes` in XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). + +The XPath expression is `DeliveryNotes`. + +```csharp +XDocument cpo = XDocument.Load("PurchaseOrders.xml"); +XElement po = cpo.Root.Element("PurchaseOrder"); + +// LINQ to XML query +XElement el1 = po.Element("DeliveryNotes"); + +// XPath expression +XElement el2 = po.XPathSelectElement("DeliveryNotes"); +// same as "child::DeliveryNotes" +// same as "./DeliveryNotes" + +if (el1 == el2) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(el1); +``` + +```vb +Dim cpo As XDocument = XDocument.Load("PurchaseOrders.xml") +Dim po As XElement = cpo.Root..FirstOrDefault + +'LINQ to XML query +Dim el1 As XElement = po..FirstOrDefault + +' XPath expression +Dim el2 As XElement = po.XPathSelectElement("DeliveryNotes") +' same as "child::DeliveryNotes" +' same as "./DeliveryNotes" + +If el1 Is el2 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(el1) +``` + +This example produces the following output: + +```output +Results are identical +Please leave packages in shed by driveway. +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-child-elements-based-position.md b/docs/standard/linq/find-child-elements-based-position.md new file mode 100644 index 0000000000000..10c4cebb2984f --- /dev/null +++ b/docs/standard/linq/find-child-elements-based-position.md @@ -0,0 +1,111 @@ +--- +title: How to find child elements based on position - LINQ to XML +description: "Learn how to find find elements based on element position. Three methods are shown: one that uses XPathEvaluate, two that use LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: e35bb269-ec86-4c96-8321-12491a0eb2c3 +--- + +# How to find child elements based on position (LINQ to XML) + +This article shows how to use to find elements based on element position – for example, to find the second element, or the third through the fifth. It also shows two ways to use LINQ to XML query to do the same thing. + +There are two approaches to writing this LINQ to XML query in a lazy way. You can use the and operators, or you can use the overload that takes an index. When you use the overload, you use a lambda expression that takes two arguments. The following example shows both methods of selecting based on position. + +## Example: Find the second through the fourth `Test` elements + +This example finds the second through the fourth `Test` element in the [Sample XML file: Test configuration](sample-xml-file-test-configuration.md). The result is a collection of elements. + +The XPath expression is `Test[position() >= 2 and position() <= 4]`. + +```csharp +XElement testCfg = XElement.Load("TestConfig.xml"); + +// LINQ to XML query +IEnumerable list1 = + testCfg + .Elements("Test") + .Skip(1) + .Take(3); + +// LINQ to XML query +IEnumerable list2 = + testCfg + .Elements("Test") + .Where((el, idx) => idx >= 1 && idx <= 3); + +// XPath expression +IEnumerable list3 = + testCfg.XPathSelectElements("Test[position() >= 2 and position() <= 4]"); + +if (list1.Count() == list2.Count() && + list1.Count() == list3.Count() && + list1.Intersect(list2).Count() == list1.Count() && + list1.Intersect(list3).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim testCfg As XElement = XElement.Load("TestConfig.xml") + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = _ + testCfg.Elements("Test").Skip(1).Take(3) + +'LINQ to XML query +Dim list2 As IEnumerable(Of XElement) = _ + testCfg.Elements("Test"). _ + Where(Function(ByVal el, ByVal idx) idx >= 1 And idx <= 3) + +' XPath expression +Dim list3 As IEnumerable(Of XElement) = _ + testCfg.XPathSelectElements("Test[position() >= 2 and position() <= 4]") + +If list1.Count() = list2.Count() And _ + list1.Count() = list3.Count() And _ + list1.Intersect(list2).Count() = list1.Count() And _ + list1.Intersect(list3).Count() = list1.Count() Then + + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If + +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical + + Find succeeding characters + Examp2.EXE + abc + def + + + Convert multiple numbers to strings + Examp2.EXE /Verbose + 123 + One Two Three + + + Find correlated key + Examp3.EXE + a1 + b1 + +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-default-paragraph-style.md b/docs/standard/linq/find-default-paragraph-style.md new file mode 100644 index 0000000000000..3773d6dd4a039 --- /dev/null +++ b/docs/standard/linq/find-default-paragraph-style.md @@ -0,0 +1,143 @@ +--- +title: Find the default paragraph style - LINQ to XML +description: Learn how to find the default style of paragraphs in a WordprocessingML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: be102177-8ab0-444a-b671-7023e555ffdb +--- +# Find the default paragraph style (LINQ to XML) + +The first task in [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) is to find the default style of paragraphs in the document. + +## Example: Find the default style name + +The following example opens an Office Open XML WordprocessingML document, finds the document and style parts of the package, and then executes a query that finds the default style name. For information about Office Open XML document packages, and the parts they comprise, see [Details of Office Open XML WordprocessingML documents](wordprocessingml-document-styles.md). + +The query finds a node named `w:style` that has an attribute named `w:type` with a value of "paragraph", and also has an attribute named `w:default` with a value of "1". Because there will be only one XML node with these attributes, the query uses the operator to convert a collection to a singleton. It then gets the value of the attribute with the name `w:styleId`. + +This example uses classes from the WindowsBase assembly. It uses types in the namespace. + +```csharp +const string fileName = "SampleDoc.docx"; + +const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; +const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; +const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; +XNamespace w = wordmlNamespace; + +XDocument xDoc = null; +XDocument styleDoc = null; + +using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) +{ + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } +} + +// The following query finds all the paragraphs that have the default style. +string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph"&& + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + +Console.WriteLine("The default style is: {0}", defaultStyle); +``` + +```vb +Imports + +Module Module1 + + Sub Main() + + Const fileName As String = "SampleDoc.docx" + + Const documentRelationshipType As String = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Const stylesRelationshipType As String = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If docPackageRelationship IsNot Nothing Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If styleRelation IsNot Nothing Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + ' The following query finds all the paragraphs that have the default style. + Dim defParas As IEnumerable(Of XElement) = _ + From style In styleDoc.Root. _ + Where style.@w:type.Equals("paragraph") And _ + style.@w:default.Equals("1") _ + Select style + ' Then find the style of the first. + Dim defaultStyle As String = defParas.First().@w:styleId + + Console.WriteLine("The default style is: " & defaultStyle) + End Sub +End Module +``` + +This example produces the following output: + +```output +The default style is: Normal +``` + +In the next article in this tutorial you'll create a similar query that finds all the paragraphs in a document and their styles: + +- [Retrieve the paragraphs and their styles](retrieve-paragraphs-styles.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) diff --git a/docs/standard/linq/find-descendant-elements.md b/docs/standard/linq/find-descendant-elements.md new file mode 100644 index 0000000000000..40c18238fb0c4 --- /dev/null +++ b/docs/standard/linq/find-descendant-elements.md @@ -0,0 +1,71 @@ +--- +title: How to find descendant elements - LINQ to XML +description: This article shows how to use XPath and LINQ to XML query, in C# and Visual Basic, to find all descendant elements that have a specified name. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b318da39-bb8b-4c56-a019-e13b12b01831 +--- + +# How to find descendant elements (LINQ to XML) + +This article shows how to use XPath and LINQ to XML query, in C# and Visual Basic, to find all descendant elements that have a specified name. + +## Example Find descendant elements that have a specified name + + This example shows how to use LINQ to XML query and XPath to find all descendant elements named `Name` in XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). The XPath expression is `//Name`. + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +// LINQ to XML query +IEnumerable list1 = po.Root.Descendants("Name"); + +// XPath expression +IEnumerable list2 = po.XPathSelectElements("//Name"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = po... + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = po.XPathSelectElements("//Name") + +If (list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count()) Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +Ellen Adams +Tai Yee +Cristian Osorio +Cristian Osorio +Jessica Arnold +Jessica Arnold +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-descendants-child-element.md b/docs/standard/linq/find-descendants-child-element.md new file mode 100644 index 0000000000000..876336329898b --- /dev/null +++ b/docs/standard/linq/find-descendants-child-element.md @@ -0,0 +1,122 @@ +--- +title: How to find descendants of a child element - LINQ to XML +description: "Learn how to find descendants of a child element or a sequence of child elements. Two methods are shown: one uses XPathEvaluate, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 505b7512-bb8b-4f85-abbf-491f039c961e +--- + +# How to find descendants of a child element (LINQ to XML) + +This article shows how to use to find the descendant elements of a sequence of child elements, and how to use LINQ to XML query to find the same elements. + +## Example: Find all the `Text` descendant elements of all the `Paragraph` elements + +This example extracts text from an XML representation of a simple word processing document. It first selects all `Paragraph` elements, ignoring the `Comment` element, and then it selects all the `Text` descendant elements of each `Paragraph` element. It does this task in two ways: with and with LINQ to XML query. It then compares the results and finds them identical. + +The XPath expression is `./Paragraph//Text/text()`. + +```csharp +XElement root = XElement.Parse( +@" + + This is the start of + + + This comment isn't part of the paragraph text. + + + + a sentence. + + + + This is the second sentence. + +"); + +// LINQ to XML query +string str1 = + root + .Elements("Paragraph") + .Descendants("Text") + .Select(s => s.Value) + .Aggregate( + new StringBuilder(), + (s, i) => s.Append(i), + s => s.ToString() + ); + +// XPath expression +string str2 = + ((IEnumerable)root.XPathEvaluate("./Paragraph//Text/text()")) + .Cast() + .Select(s => s.Value) + .Aggregate( + new StringBuilder(), + (s, i) => s.Append(i), + s => s.ToString() + ); + +if (str1 == str2) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(str2); +``` + +```vb +Dim root As XElement = _ + + + This is the start of + + + This comment isn't part of the paragraph text. + + + + a sentence. + + + + This is the second sentence. + + + +' LINQ to XML query +Dim str1 As String = _ + root.....Select(Function(ByVal s) s.Value). _ + Aggregate( _ + New StringBuilder(), _ + Function(ByVal s, ByVal i) s.Append(i), _ + Function(ByVal s) s.ToString()) + +' XPath expression +Dim str2 As String = DirectCast(root.XPathEvaluate("./Paragraph//Text/text()"), IEnumerable) _ + .Cast(Of XText)().Select(Function(ByVal s) s.Value) _ + .Aggregate( _ + New StringBuilder(), _ + Function(ByVal s, ByVal i) s.Append(i), _ + Function(ByVal s) s.ToString()) + +If str1 = str2 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(str2) +``` + +This example produces the following output: + +```output +Results are identical +This is the start of a sentence. This is the second sentence. +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-descendants-specific-element-name.md b/docs/standard/linq/find-descendants-specific-element-name.md new file mode 100644 index 0000000000000..b1dfc19b55225 --- /dev/null +++ b/docs/standard/linq/find-descendants-specific-element-name.md @@ -0,0 +1,164 @@ +--- +title: How to find descendants with a specific element name - LINQ to XML +description: To find all descendants that have a specific name, it's easier to use XContainer.Descendants than to iterate through all the descendants. +ms.date: 07/20/2015 +ms.assetid: f684da20-bee9-47f5-9607-7e3fd7e67470 +--- + +# How to find descendants with a specific element name (LINQ to XML) + +Sometimes you want to find all descendants with a specific name. You could write code to iterate through all of the descendants, but it's easier to use the axis. + +## Example: Find descendants with a specific element name + +The following example shows how to find descendants with a specific element name. + +```csharp +XElement root = XElement.Parse(@" + + + Some text + + + + that's broken up into + + + + + multiple segments. + + + +"); +IEnumerable textSegs = + from seg in root.Descendants("t") + select (string)seg; + +string str = textSegs.Aggregate(new StringBuilder(), + (sb, i) => sb.Append(i), + sp => sp.ToString() +); + +Console.WriteLine(str); +``` + +```vb +Dim root As XElement = _ + + + + Some text + + + + that's broken up into + + + + + multiple segments. + + + + + +Dim textSegs As IEnumerable(Of String) = _ + From seg In root... _ + Select seg.Value + +Dim str As String = textSegs.Aggregate( _ + New StringBuilder, _ + Function(sb, i) sb.Append(i), _ + Function(sb) sb.ToString) + +Console.WriteLine(str) +``` + +This example produces the following output: + +```output +Some text that's broken up into multiple segments. + +## Example: Find when the XML is in a namespace + +The following example shows the same query for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Parse(@" + + + Some text + + + + that's broken up into + + + + + multiple segments. + + + +"); +XNamespace ad = "http://www.adatum.com"; +IEnumerable textSegs = + from seg in root.Descendants(ad + "t") + select (string)seg; + +string str = textSegs.Aggregate(new StringBuilder(), + (sb, i) => sb.Append(i), + sp => sp.ToString() +); + +Console.WriteLine(str); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + + + Some text + + + + that's broken up into + + + + + multiple segments. + + + + + + Dim textSegs As IEnumerable(Of String) = _ + From seg In root... _ + Select seg.Value + + Dim str As String = textSegs.Aggregate( _ + New StringBuilder, _ + Function(sb, i) sb.Append(i), _ + Function(sb) sb.ToString) + + Console.WriteLine(str) + End Sub +End Module +``` + +This example produces the following output: + +```output +Some text that's broken up into multiple segments. +``` + +## See also + +- diff --git a/docs/standard/linq/find-element-specific-attribute.md b/docs/standard/linq/find-element-specific-attribute.md new file mode 100644 index 0000000000000..7838840851662 --- /dev/null +++ b/docs/standard/linq/find-element-specific-attribute.md @@ -0,0 +1,108 @@ +--- +title: How to find an element with a specific attribute - LINQ to XML +description: Learn how to find an element whose attribute has a specific value. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b92591aa-3cfb-490e-99f6-da8de335e362 +--- + +# How to find an element with a specific attribute (LINQ to XML) + +This article provides examples of how to find an element whose attribute has a specific value. + +## Example: Find an element whose attribute has a specific value + +The following example shows how to find the `Address` element that has a `Type` attribute with a value of "Billing". The example uses XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +XElement root = XElement.Load("PurchaseOrder.xml"); +IEnumerable address = + from el in root.Elements("Address") + where (string)el.Attribute("Type") == "Billing" + select el; +foreach (XElement el in address) + Console.WriteLine(el); +``` + +```vb +Dim root As XElement = XElement.Load("PurchaseOrder.xml") +Dim address As IEnumerable(Of XElement) = _ + From el In root.
_ + Where el.@Type = "Billing" _ + Select el +For Each el As XElement In address + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```xml +
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+``` + +## Example: Find an element in XML that's in a namespace + +The following example shows the same query, but for XML that's in a namespace. It uses XML document [Sample XML file: typical purchase order in a namespace](sample-xml-file-typical-purchase-order-namespace.md). + +For more information about namespaces, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Load("PurchaseOrderInNamespace.xml"); +XNamespace aw = "http://www.adventure-works.com"; +IEnumerable address = + from el in root.Elements(aw + "Address") + where (string)el.Attribute(aw + "Type") == "Billing" + select el; +foreach (XElement el in address) + Console.WriteLine(el); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = XElement.Load("PurchaseOrderInNamespace.xml") + Dim address As IEnumerable(Of XElement) = _ + From el In root. _ + Where el.@aw:Type = "Billing" _ + Select el + For Each el As XElement In address + Console.WriteLine(el) + Next + End Sub +End Module +``` + +This example produces the following output:: + +```xml + + Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA + +``` + +## See also + +- +- +- [Standard Query Operators Overview (C#)](../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) +- [Projection Operations (C#)](../../csharp/programming-guide/concepts/linq/projection-operations.md) +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) +- [Standard Query Operators Overview (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md) +- [Projection Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projection-operations.md) diff --git a/docs/standard/linq/find-element-specific-child-element.md b/docs/standard/linq/find-element-specific-child-element.md new file mode 100644 index 0000000000000..1457ba11d5a3c --- /dev/null +++ b/docs/standard/linq/find-element-specific-child-element.md @@ -0,0 +1,96 @@ +--- +title: How to find an element with a specific child element - LINQ to XML +description: Find an element whose child element has a specific value +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 00cf5555-374e-4369-bf93-7bd2e7f21db3 +--- + +# How to find an element with a specific child element (LINQ to XML) + +This article shows how to find an element whose child element has a specific value. + +## Example: Find an element whose child element has a specific value + +The example finds the `Test` element whose `CommandLine` child element has a value of "Examp2.EXE". The example uses XML document [Sample XML file: Test configuration](sample-xml-file-test-configuration.md). + +```csharp +XElement root = XElement.Load("TestConfig.xml"); +IEnumerable tests = + from el in root.Elements("Test") + where (string)el.Element("CommandLine") == "Examp2.EXE" + select el; +foreach (XElement el in tests) + Console.WriteLine((string)el.Attribute("TestId")); +``` + +```vb +Dim root As XElement = XElement.Load("TestConfig.xml") +Dim tests As IEnumerable(Of XElement) = _ + From el In root. _ + Where el..Value = "Examp2.EXE" _ + Select el +For Each el as XElement In tests + Console.WriteLine(el.@TestId) +Next +``` + +This example produces the following output: + +```output +0002 +0006 +``` + +Note that the Visual Basic version of the code uses the [XML Child axis property](../../visual-basic/language-reference/xml-axis/xml-child-axis-property.md), the [XML Attribute axis property](../../visual-basic/language-reference/xml-axis/xml-attribute-axis-property.md), and the [XML Value property](../../visual-basic/language-reference/xml-axis/xml-value-property.md). + +## Example: Find when the XML is in a namespace + +The following example does the same as the previous one, but for XML that's in a namespace. The example uses XML document [Sample XML file: Test configuration in a namespace](sample-xml-file-test-configuration-namespace.md). + +For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Load("TestConfigInNamespace.xml"); +XNamespace ad = "http://www.adatum.com"; +IEnumerable tests = + from el in root.Elements(ad + "Test") + where (string)el.Element(ad + "CommandLine") == "Examp2.EXE" + select el; +foreach (XElement el in tests) + Console.WriteLine((string)el.Attribute("TestId")); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = XElement.Load("TestConfigInNamespace.xml") + Dim tests As IEnumerable(Of XElement) = _ + From el In root. _ + Where el..Value = "Examp2.EXE" _ + Select el + For Each el As XElement In tests + Console.WriteLine(el.@TestId) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +0002 +0006 +``` + +## See also + +- +- +- [Standard Query Operators Overview (C#)](../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) +- [Projection Operations (C#)](../../csharp/programming-guide/concepts/linq/projection-operations.md) +- [Standard Query Operators Overview (Visual Basic)](/../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md) diff --git a/docs/standard/linq/find-elements-namespace.md b/docs/standard/linq/find-elements-namespace.md new file mode 100644 index 0000000000000..33228d5e402fa --- /dev/null +++ b/docs/standard/linq/find-elements-namespace.md @@ -0,0 +1,104 @@ +--- +title: How to find elements in a namespace - LINQ to XML +description: Learn how to find elements in a particular namespace by using namespace prefixes in XPath expressions. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: cae1c4ac-6cd5-46cf-9b1c-bd85bc9b7ea9m +--- + +# How to find elements in a namespace (LINQ to XML) + +Use namespace prefixes in XPath expressions to find nodes in a particular namespace. To parse an XPath expression that contains namespace prefixes, you pass an object to the XPath methods that implement . + +## Example: Find purchase orders from a specific namespace in a document that has two namespaces + +The following example uses an to read XML document [Sample XML file: Consolidated purchase orders](sample-xml-file-consolidated-purchase-orders.md), which has purchase orders in two namespaces. It then gets an from the , and an from the . It uses the when selecting elements. + +The XPath expression is: `./aw:*` + +```csharp +XmlReader reader = XmlReader.Create("ConsolidatedPurchaseOrders.xml"); +XElement root = XElement.Load(reader); +XmlNameTable nameTable = reader.NameTable; +XmlNamespaceManager namespaceManager = new XmlNamespaceManager(nameTable); +namespaceManager.AddNamespace("aw", "http://www.adventure-works.com"); +IEnumerable list1 = root.XPathSelectElements("./aw:*", namespaceManager); +IEnumerable list2 = + from el in root.Elements() + where el.Name.Namespace == "http://www.adventure-works.com" + select el; +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list2) + Console.WriteLine(el); +``` + +```vb +Dim reader As XmlReader = _ + XmlReader.Create("ConsolidatedPurchaseOrders.xml") +Dim root As XElement = XElement.Load(reader) +Dim nameTable As XmlNameTable = reader.NameTable +Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(nameTable) +namespaceManager.AddNamespace("aw", "http://www.adventure-works.com") + +Dim list1 As IEnumerable(Of XElement) = _ + root.XPathSelectElements("./aw:*", namespaceManager) +Dim list2 As IEnumerable(Of XElement) = _ + From el In root.Elements() _ + Where el.Name.Namespace = "http://www.adventure-works.com" _ + Select el + +If list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list2 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical + + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + Ship only complete order. + + Litware Networking Card + 1 + 20.99 + + + Litware 17in LCD Monitor + 1 + 199.99 + + +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-elements-specific-attribute.md b/docs/standard/linq/find-elements-specific-attribute.md new file mode 100644 index 0000000000000..924e2c3f0382c --- /dev/null +++ b/docs/standard/linq/find-elements-specific-attribute.md @@ -0,0 +1,92 @@ +--- +title: How to find elements with a specific attribute - LINQ to XML +description: "Learn how to find all elements that have a specific attribute (regardless of value). Two methods are shown: one uses XPathEvaluate, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: daed00dd-923a-43be-8a90-eee406f6f574 +--- + +# How to find elements with a specific attribute (LINQ to XML) + +This article shows how to use to find all elements that have a specific attribute (regardless of value), and how to use LINQ to XML query to do the same thing. + +## Example: Find all elements that have the `Select` attribute + +The following example creates an XML tree and then finds the elements that have the `Select` attribute. + +The XPath expression is `./*[@Select]`. + +```csharp +XElement doc = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 +"); + +// LINQ to XML query +IEnumerable list1 = + from el in doc.Elements() + where el.Attribute("Select") != null + select el; + +// XPath expression +IEnumerable list2 = + ((IEnumerable)doc.XPathEvaluate("./*[@Select]")).Cast(); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim doc As XElement = _ + + 1 + 2 + 3 + 4 + 5 + + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = _ + From el In doc.Elements() _ + Where el.@Select <> Nothing _ + Select el + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = DirectCast(doc.XPathEvaluate _ + ("./*[@Select]"), IEnumerable).Cast(Of XElement)() + +If list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If + +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +2 +4 +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-immediate-preceding-sibling.md b/docs/standard/linq/find-immediate-preceding-sibling.md new file mode 100644 index 0000000000000..479fc26b5c4fc --- /dev/null +++ b/docs/standard/linq/find-immediate-preceding-sibling.md @@ -0,0 +1,84 @@ +--- +title: How to find the immediate preceding sibling - LINQ to XML +description: "Learn how to find find the sibling that immediately precedes a node. Two methods are shown: one uses XPathEvaluate, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 74c06201-0b1b-4b5e-b3ac-0092980614e6 +--- + +# How to find the immediate preceding sibling (LINQ to XML) + +This article shows how to use to find the sibling that immediately precedes a node, and how to use LINQ to XML query to do the same thing. Due to the difference in the semantics of positional predicates for the preceding sibling axes in XPath as opposed to LINQ to XML, this is one of the more interesting comparisons. + +## Example: Find the next to last element + +In this example, the LINQ to XML query uses the operator to find the last node in the collection returned by . By contrast, the XPath expression uses a predicate with a value of 1 to find the immediately preceding element. + +```csharp +XElement root = XElement.Parse( + @" + + + + +"); +XElement child4 = root.Element("Child4"); + +// LINQ to XML query +XElement el1 = + child4 + .ElementsBeforeSelf() + .Last(); + +// XPath expression +XElement el2 = + ((IEnumerable)child4 + .XPathEvaluate("preceding-sibling::*[1]")) + .Cast() + .First(); + +if (el1 == el2) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(el1); +``` + +```vb +Dim root As XElement = _ + + + + + + +Dim child4 As XElement = root.Element("Child4") + +' LINQ to XML query +Dim el1 As XElement = child4.ElementsBeforeSelf().Last() + +' XPath expression +Dim el2 As XElement = _ + DirectCast(child4.XPathEvaluate("preceding-sibling::*[1]"), _ + IEnumerable).Cast(Of XElement)().First() + +If el1 Is el2 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(el1) +``` + +This example produces the following output: + +```output +Results are identical + +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-list-child-elements.md b/docs/standard/linq/find-list-child-elements.md new file mode 100644 index 0000000000000..ac5894a1c1729 --- /dev/null +++ b/docs/standard/linq/find-list-child-elements.md @@ -0,0 +1,75 @@ +--- +title: How to find a list of child elements - LINQ to XML +description: This article compares the XPath child elements axis to the LINQ to XML XContainer.Elements axis. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 7c589dd8-f680-4cdb-9d6a-78d57e2555e8 +--- + +# How to find a list of child elements (LINQ to XML) + +This article compares the XPath child elements axis to the LINQ to XML axis. + +## Example: Find all child elements of an element + +This example finds all of the child elements of the `Address` element in XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). + +The XPath expression is: `./*` + +```csharp +XDocument cpo = XDocument.Load("PurchaseOrders.xml"); +XElement po = cpo.Root.Element("PurchaseOrder").Element("Address"); + +// LINQ to XML query +IEnumerable list1 = po.Elements(); + +// XPath expression +IEnumerable list2 = po.XPathSelectElements("./*"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim cpo As XDocument = XDocument.Load("PurchaseOrders.xml") +Dim po As XElement = cpo.Root..
.FirstOrDefault + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = po.Elements() + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = po.XPathSelectElements("./*") + +If (list1.Count() = list2.Count()) AndAlso _ + (list1.Intersect(list2).Count() = list1.Count()) Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +Ellen Adams +123 Maple Street +Mill Valley +CA +10999 +USA +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-preceding-siblings.md b/docs/standard/linq/find-preceding-siblings.md new file mode 100644 index 0000000000000..5d56fc5d9ad8f --- /dev/null +++ b/docs/standard/linq/find-preceding-siblings.md @@ -0,0 +1,78 @@ +--- +title: How to find preceding siblings - LINQ to XML +description: "Learn how to to find sibling elements that precede a given element. Two methods are shown: one uses XPathSelectElements along the preceding-sibling axis, the other uses XNode.ElementsBeforeSelf." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b281ff99-d08a-43d0-bea1-eff831b2f8ae +--- + +# How to find preceding siblings (LINQ to XML) + +This article shows how to use along the preceding-sibling axis to find sibling elements that precede a given element, and how to use to find the same elements. + +## Example: Use two methods to find sibling elements that precede an element + +The following example finds the `FullAddress` element in XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md), and retrieves the preceding sibling elements in two different ways. It then compares the results and finds them identical. + +> [!NOTE] +> Both methods provide results that are in document order. + +The XPath expression used is `preceding-sibling::*`. + +```csharp +XElement co = XElement.Load("CustomersOrders.xml"); + +XElement add = co.Element("Customers").Element("Customer").Element("FullAddress"); + +// LINQ to XML query +IEnumerable list1 = add.ElementsBeforeSelf(); + +// XPath expression +IEnumerable list2 = add.XPathSelectElements("preceding-sibling::*"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list2) + Console.WriteLine(el); +``` + +```vb +Dim co As XElement = XElement.Load("CustomersOrders.xml") +Dim add As XElement = co... _ + .FirstOrDefault + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = add.ElementsBeforeSelf() + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = add.XPathSelectElements("preceding-sibling::*") + +If list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list2 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +Great Lakes Food Market +Howard Snyder +Marketing Manager +(503) 555-7555 +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-related-elements.md b/docs/standard/linq/find-related-elements.md new file mode 100644 index 0000000000000..3d15f45203c72 --- /dev/null +++ b/docs/standard/linq/find-related-elements.md @@ -0,0 +1,115 @@ +--- +title: How to find related elements - LINQ to XML +description: Learn how to use LINQ to XML query and XPath, in C# and Visual Basic, to find the value of one element and an element whose attribute has the same value. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 41b386ee-562d-4841-bd6b-e44a7eb69f26 +--- + +# How to find related elements (LINQ to XML) + +This article shows how to use LINQ to XML query and XPath, in C# and Visual Basic, to find the value of one element and an element whose attribute has the same value. + +## Example: Find the value of one element and an element whose attribute has the same value + +This example finds the 12th `Order` element in XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md), and then finds the customer for that order. The XPath expression is `.//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]`. + +> [!NOTE] +> In .NET, the indexing into a list is zero-based; that is, an index of 0 refers to the initial element. Indexing into a collection of nodes in an XPath predicate is one-based. This example accounts for this difference. + +```csharp +XDocument co = XDocument.Load("CustomersOrders.xml"); + +// LINQ to XML query +XElement customer1 = + (from el in co.Descendants("Customer") + where (string)el.Attribute("CustomerID") == + (string)(co + .Element("Root") + .Element("Orders") + .Elements("Order") + .ToList()[11] + .Element("CustomerID")) + select el) + .First(); + +// An alternate way to write the query that avoids creation +// of a System.Collections.Generic.List: +XElement customer2 = + (from el in co.Descendants("Customer") + where (string)el.Attribute("CustomerID") == + (string)(co + .Element("Root") + .Element("Orders") + .Elements("Order") + .Skip(11).First() + .Element("CustomerID")) + select el) + .First(); + +// XPath expression +XElement customer3 = co.XPathSelectElement( + ".//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]"); + +if (customer1 == customer2 && customer1 == customer3) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(customer1); +``` + +```vb +Dim co As XDocument = XDocument.Load("CustomersOrders.xml") + +' LINQ to XML query +Dim customer1 As XElement = ( _ + From el In co... _ + Where el.@CustomerID = co.... _ + ToList()(11).(0).Value _ + Select el).First() + +' An alternate way to write the query that avoids creation +' of a System.Collections.Generic.List: +Dim customer2 As XElement = ( _ + From el In co... _ + Where el.@CustomerID = co.... _ + Skip(11).First().(0).Value _ + Select el).First() + +' XPath expression +Dim customer3 As XElement = co.XPathSelectElement _ + (".//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]") + +If customer1 Is customer2 And customer1 Is customer3 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(customer1) +``` + +This example produces the following output: + +```output +Results are identical + + Hungry Coyote Import Store + Yoshi Latimer + Sales Representative + (503) 555-6874 + (503) 555-2376 + +
City Center Plaza 516 Main St.
+ Elgin + OR + 97827 + USA +
+
+``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-root-element.md b/docs/standard/linq/find-root-element.md new file mode 100644 index 0000000000000..60f11b397605d --- /dev/null +++ b/docs/standard/linq/find-root-element.md @@ -0,0 +1,61 @@ +--- +title: How to find the root element - LINQ to XML +description: Learn how to use XPath and LINQ to XML, in C# and Visual Basic, to find the root element of an XML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4fd824e0-4d39-429b-b092-f6a5c046ee6c +--- + +# How to find the root element (LINQ to XML) + +This article provides an example that shows how to use XPath and LINQ to XML, in C# and Visual Basic, to find the root element of an XML document. + +## Example: Find the root element + +This example uses LINQ to XML query and XPath to find the root element in XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). The XPath expression is `/PurchaseOrders`. + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +// LINQ to XML query +XElement el1 = po.Root; + +// XPath expression +XElement el2 = po.XPathSelectElement("/PurchaseOrders"); + +if (el1 == el2) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +Console.WriteLine(el1.Name); +``` + +```vb +Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") + +' LINQ to XML query +Dim el1 As XElement = po.Root + +' XPath expression +Dim el2 As XElement = po.XPathSelectElement("/PurchaseOrders") + +If el1 Is el2 Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +Console.WriteLine(el1.Name) +``` + +This example produces the following output: + +```output +Results are identical +PurchaseOrders +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](/../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-sibling-nodes.md b/docs/standard/linq/find-sibling-nodes.md new file mode 100644 index 0000000000000..b12dc3aced43b --- /dev/null +++ b/docs/standard/linq/find-sibling-nodes.md @@ -0,0 +1,100 @@ +--- +title: How to find sibling nodes - LINQ to XML +description: "Learn how to find all siblings of a node that have a specific name. Two methods are shown: one uses XPathSelectElements, the other uses LINQ to XML query." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: e2c73d10-a8ca-4e11-b5aa-d055de285874 +--- + +# How to find sibling nodes (LINQ to XML) + +This article shows how to use to find all siblings of a node that have a specific name, and how to use LINQ to XML query to do the same thing. + +> [!NOTE] +> The resulting collection includes the context node if it also has the specific name. + +## Example: Find an element named `Book`, and all sibling elements named `Book` + +This example first finds a `Book` element in XML document [Sample XML file: Books](sample-xml-file-books.md), and then finds all sibling elements named `Book`. The resulting collection includes the context node. + +The XPath expression is `../Book` + +```csharp +XDocument books = XDocument.Load("Books.xml"); + +XElement book = + books + .Root + .Elements("Book") + .Skip(1) + .First(); + +// LINQ to XML query +IEnumerable list1 = + book + .Parent + .Elements("Book"); + +// XPath expression +IEnumerable list2 = book.XPathSelectElements("../Book"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim books As XDocument = XDocument.Load("Books.xml") +Dim book As XElement = books.Root..Skip(1).First() + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = book.Parent. + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = book.XPathSelectElements("../Book") + +If list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical + + Garghentini, Davide + XML Developer's Guide + Computer + 44.95 + 2000-10-01 + An in-depth look at creating applications + with XML. + + + Garcia, Debra + Midnight Rain + Fantasy + 5.95 + 2000-12-16 + A former architect battles corporate zombies, + an evil sorceress, and her own childhood to become queen + of the world. + +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/find-single-descendant-descendants-method.md b/docs/standard/linq/find-single-descendant-descendants-method.md new file mode 100644 index 0000000000000..29ef49a66ad15 --- /dev/null +++ b/docs/standard/linq/find-single-descendant-descendants-method.md @@ -0,0 +1,126 @@ +--- +title: How to find a single descendant using the Descendants method - LINQ to XML +description: Use the XContainer.Descendants axis method to find a single uniquely-named descendant element. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 6f735be9-0293-4680-8007-ca9d96bfebed +--- + +# How to find a single descendant using the Descendants method (LINQ to XML) + +You can use the axis method to find a single uniquely-named descendant element. This technique is especially useful when you want to find a particular descendant with a specific name, and may be faster and easier to use than navigating the XML tree. + +## Example: Use XContainer.Descendants to find a single uniquely-named descendant element + +This example uses the standard query operator. + +```csharp +XElement root = XElement.Parse(@" + + GC1 Value + + + GC2 Value + + + GC3 Value + + + GC4 Value + +"); +string grandChild3 = (string) + (from el in root.Descendants("GrandChild3") + select el).First(); +Console.WriteLine(grandChild3); +``` + +```vb +Dim root As XElement = _ + + + GC1 Value + + + GC2 Value + + + GC3 Value + + + GC4 Value + + +Dim grandChild3 As String = _ + (From el In root... _ + Select el).First() +Console.WriteLine(grandChild3) +``` + +This example produces the following output: + +```output +GC3 Value +``` + +## Example: Find when the XML is in a namespace + +The following example does the same as the previous one, but for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Parse(@" + + GC1 Value + + + GC2 Value + + + GC3 Value + + + GC4 Value + +"); +XNamespace aw = "http://www.adventure-works.com"; +string grandChild3 = (string) + (from el in root.Descendants(aw + "GrandChild3") + select el).First(); +Console.WriteLine(grandChild3); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + + GC1 Value + + + GC2 Value + + + GC3 Value + + + GC4 Value + + + Dim grandChild3 As String = _ + (From el In root... _ + Select el).First() + Console.WriteLine(grandChild3) + End Sub +End Module +``` + +This example produces the following output: + +```output +GC3 Value +``` diff --git a/docs/standard/linq/find-text-word-documents.md b/docs/standard/linq/find-text-word-documents.md new file mode 100644 index 0000000000000..146f8e05fb912 --- /dev/null +++ b/docs/standard/linq/find-text-word-documents.md @@ -0,0 +1,600 @@ +--- +title: Find text in Word documents - LINQ to XML +description: Learn how to find all occurrences of a string in a WordProcessingML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 82f86677-560b-49dc-a089-610409939b2a +--- + +# Find text in Word documents (LINQ to XML) + +This article extends the previous queries to find all occurrences of a string in a WordProcessingML document. + +## Example: Find all occurrences of a string in a WordProcessingML document + +This example finds all occurrences in a WordprocessingML document of a specific piece of text (the string "Hello"). The example builds on the previous examples in this tutorial. The added query is pointed out by comments in the code. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes found in the WindowsBase assembly. It uses types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = ParagraphText(para.ParagraphNode) + }; + + // Following is the new query that retrieves all paragraphs + // that have specific text in them. + var helloParagraphs = + from para in paraWithText + where para.Text.Contains("Hello") + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = para.Text + }; + + foreach (var p in helloParagraphs) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); + } +} +``` + +```vb +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + Public Function ParagraphText(ByVal e As XElement) As String + Dim w As XNamespace = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = ParagraphText(para.ParagraphNode) _ + } + + ' Following is the new query that retrieves all paragraphs + ' that have specific text in them. + Dim helloParagraphs = _ + From para In paraWithText _ + Where para.Text.Contains("Hello") _ + Select New With _ + { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = para.Text _ + } + + For Each p In helloParagraphs + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + End Sub +End Module +``` + + This example produces the following output: + +```output +StyleName:Code > Console.WriteLine("Hello World");< +StyleName:Code >Hello World< +``` + +## Example: Find all lines in a WordProcessingML document that have a specific style + +In this example the query is modified to search for lines of a specific style. It finds all blank lines that have the `Code` style. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = ParagraphText(para.ParagraphNode) + }; + + // Retrieve all paragraphs that have no text and are styled Code. + var blankCodeParagraphs = + from para in paraWithText + where para.Text == "" && para.StyleName == "Code" + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = para.Text + }; + + foreach (var p in blankCodeParagraphs) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); + } +} +``` + +```vb +Imports System.IO.Packaging +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + Public Function ParagraphText(ByVal e As XElement) As String + Dim w As XNamespace = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = ParagraphText(para.ParagraphNode) _ + } + + ' Retrieve all paragraphs that have no text and are styled Code. + Dim blankCodeParagraphs = _ + From para In paraWithText _ + Where String.IsNullOrEmpty(para.Text) And para.StyleName.Equals("Code") _ + Select New With _ + { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = para.Text _ + } + + For Each p In blankCodeParagraphs + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +StyleName:Code >< +``` + +This example could be enhanced in a number of ways. For example, we could use regular expressions to search for text, we could iterate through all the Word files in a particular directory, and so on. + +This example performs nearly as well as if it were written as a single query. Because each query is implemented in a lazy, deferred fashion, it doesn't yield its results until the query is iterated. For more information, see [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md). + +The next section provides details of WordprocessingML documents: + +- [Details of Office Open XML WordprocessingML documents](wordprocessingml-document-styles.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) +- [Refactor using a pure function](refactor-pure-function.md) +- [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md) diff --git a/docs/standard/linq/find-union-two-location-paths.md b/docs/standard/linq/find-union-two-location-paths.md new file mode 100644 index 0000000000000..85533176c098d --- /dev/null +++ b/docs/standard/linq/find-union-two-location-paths.md @@ -0,0 +1,91 @@ +--- +title: How to find a union of two location paths - LINQ to XML +description: "Learn how to find the union of the results of two XPath location paths. Two methods are shown: one uses XPathSelectElements, the other uses the Concat standard query operator." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 069622d3-2b58-4919-8903-710a564c0788 +--- + +# How to find a union of two location paths (LINQ to XML) + +This article shows how to use to find the union of the results of two XPath location paths, and how to use the standard query operator to do the same thing. + +## Example: Find all `Category` and `Price` elements and concatenate them + +This example finds all of the `Category` elements and all of the `Price` elements in XML document [Sample XML file: Numerical data](sample-xml-file-numerical-data.md), and concatenates them into a single collection. The XPath expression is `//Category|//Price`. + +> [!NOTE] +> The LINQ to XML query calls to put the results in document order. The XPath expression results are also in document order. + +```csharp +XDocument data = XDocument.Load("Data.xml"); + +// LINQ to XML query +IEnumerable list1 = + data + .Descendants("Category") + .Concat( + data + .Descendants("Price") + ) + .InDocumentOrder(); + +// XPath expression +IEnumerable list2 = data.XPathSelectElements("//Category|//Price"); + +if (list1.Count() == list2.Count() && + list1.Intersect(list2).Count() == list1.Count()) + Console.WriteLine("Results are identical"); +else + Console.WriteLine("Results differ"); +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim data As XDocument = XDocument.Load("Data.xml") + +' LINQ to XML query +Dim list1 As IEnumerable(Of XElement) = _ + data....Concat(data...).InDocumentOrder() + +' XPath expression +Dim list2 As IEnumerable(Of XElement) = _ + data.XPathSelectElements("//Category|//Price") + +If list1.Count() = list2.Count() And _ + list1.Intersect(list2).Count() = list1.Count() Then + Console.WriteLine("Results are identical") +Else + Console.WriteLine("Results differ") +End If +For Each el As XElement In list1 + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +Results are identical +A +24.50 +B +89.99 +A +4.95 +A +66.00 +B +.99 +A +29.00 +B +6.99 +``` + +## See also + +- [LINQ to XML for XPath Users (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md) diff --git a/docs/standard/linq/functional-construction.md b/docs/standard/linq/functional-construction.md new file mode 100644 index 0000000000000..2a60c163d512b --- /dev/null +++ b/docs/standard/linq/functional-construction.md @@ -0,0 +1,100 @@ +--- +title: Functional construction - LINQ to XML +description: LINQ to XML provides functional construction, which enables you to create an XML tree in a single statement. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 57a82bcf-de03-4f1c-a0c8-9a76e989d542 +--- + +# Functional construction (LINQ to XML) + +LINQ to XML provides a powerful way to create XML elements called *functional construction*. Functional construction enables you to create an XML tree in a single statement. + +Several key features of the LINQ to XML programming interface are used in functional construction: + +- The constructor takes various types of arguments for content. For example, you can pass another object, which becomes a child element. You can pass an object, which becomes an attribute of the element. Or you can pass any other type of object, which is converted to a string and becomes the text content of the element. +- The constructor takes a `params` array of type , so that you can pass any number of objects to the constructor. This enables you to create an element that has complex content. +- If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. This is important because it lets you pass the results of a LINQ query to the constructor. + +## Example: Create an XML tree + +You can use functional construction to write code to create an XML tree. The following is an example: + +```csharp +XElement contacts = + new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144"), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) + ); +``` + +## Example: Create an XML tree using LINQ query results + +These features also enable you to write code that uses the results of LINQ queries when you create an XML tree, as in the following example: + +```csharp +XElement srcTree = new XElement("Root", + new XElement("Element", 1), + new XElement("Element", 2), + new XElement("Element", 3), + new XElement("Element", 4), + new XElement("Element", 5) +); +XElement xmlTree = new XElement("Root", + new XElement("Child", 1), + new XElement("Child", 2), + from el in srcTree.Elements() + where (int)el > 2 + select el +); +Console.WriteLine(xmlTree); +``` + +In Visual Basic, the same thing is accomplished with XML literals: + +```vb +Dim srcTree As XElement = _ + + 1 + 2 + 3 + 4 + 5 + +Dim xmlTree As XElement = _ + + 1 + 2 + <%= From el In srcTree.Elements() _ + Where CInt(el) > 2 _ + Select el %> + +Console.WriteLine(xmlTree) +``` + +This example produces the following output: + +```xml + + 1 + 2 + 3 + 4 + 5 + +``` + +## See also + +- [Create XML Trees in C#](create-xml-trees.md) +- [XML literals in Visual Basic](xml-literals.md) diff --git a/docs/standard/linq/functional-transformation-xml.md b/docs/standard/linq/functional-transformation-xml.md new file mode 100644 index 0000000000000..5ac6b72758eed --- /dev/null +++ b/docs/standard/linq/functional-transformation-xml.md @@ -0,0 +1,36 @@ +--- +title: Functional transformation of XML - LINQ to XML +description: Learn about the pure functional transformation approach to modifying XML documents and how it differs from a procedural approach. +ms.date: 07/20/2015 +ms.assetid: 0ccb9251-38d7-44e3-9b84-1b5fe25e4b59 +--- + +# Functional transformation of XML (LINQ to XML) + +This article discusses the pure functional transformation approach to modifying XML documents, and contrasts it with a procedural approach. + +## Modifying an XML document + +One of the most common tasks for an XML programmer is transforming XML from one shape to another. The shape of an XML document is the structure of the document, which includes the following: + +- The hierarchy expressed by the document. +- The element and attribute names. +- The data types of the elements and attributes. + +In general, the most effective approach to transforming XML from one shape to another is that of pure functional transformation. In this approach, the primary programmer task is to create a transformation which is applied to the entire XML document (or to one or more strictly defined nodes). Functional transformation is arguably the easiest to code (after a programmer is familiar with the approach), yields the most maintainable code, and is often more compact than alternative approaches. + +### XML functional transformational technologies + +Microsoft offers two functional transformation technologies for use on XML documents: XSLT and LINQ to XML. XSLT is supported in the managed namespace and in the native COM implementation of MSXML. Although XSLT is a robust technology for manipulating XML documents, it requires expertise in a specialized domain, namely the XSLT language and its supporting APIs. + +LINQ to XML provides the tools necessary to code pure functional transformations in an expressive and powerful way, within C# or Visual Basic code. For example, many of the examples in the LINQ to XML documentation use a pure functional approach. Also, in the [Tutorial: Manipulating Content in a WordprocessingML Document](xml-shape-wordprocessingml-documents.md) tutorial, we use LINQ to XML in a functional approach to manipulate information in a Microsoft Word document. + +For a more complete comparison of LINQ to XML with other Microsoft XML technologies, see [LINQ to XML vs. other XML technologies](linq-xml-vs-xml-technologies.md). + +XSLT is the recommended tool for document-centric transformations when the source document has an irregular structure. However, LINQ to XML can also perform document-centric transforms. For more information, see [How to use annotations to transform LINQ to XML trees in an XSLT style](use-annotations-transform-linq-xml-trees-xslt-style.md). + +## See also + +- [Introduction to pure functional transformations](introduction-pure-functional-transformations.md) +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) +- [LINQ to XML vs. other XML technologies](linq-xml-vs-xml-technologies.md) diff --git a/docs/standard/linq/functional-vs-imperative-programming.md b/docs/standard/linq/functional-vs-imperative-programming.md new file mode 100644 index 0000000000000..20f609adc99f0 --- /dev/null +++ b/docs/standard/linq/functional-vs-imperative-programming.md @@ -0,0 +1,56 @@ +--- +title: Functional programming vs. imperative programming - LINQ to XML +description: Learn about functional programming and how it differs from traditional imperative (procedural) programming. +ms.date: 07/20/2015 +ms.assetid: 5e35c5a0-c949-422a-873b-fca6b2254f57 +--- + +# Functional programming vs. imperative programming (LINQ to XML) + +This article compares and contrasts functional programming with more traditional imperative (procedural) programming. + +## Functional programming vs. imperative programming + +The *functional programming* paradigm was explicitly created to support a pure functional approach to problem solving. Functional programming is a form of *declarative programming*. In contrast, most mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and Java, were designed to primarily support *imperative* (procedural) programming. + +With an imperative approach, a developer writes code that specifies the steps that the computer must take to accomplish the goal. This is sometimes referred to as *algorithmic* programming. In contrast, a functional approach involves composing the problem as a set of functions to be executed. You define carefully the input to each function, and what each function returns. The following table describes some of the general differences between these two approaches. + +|Characteristic|Imperative approach|Functional approach| +|--------------------|-------------------------|-------------------------| +|Programmer focus|How to perform tasks (algorithms) and how to track changes in state.|What information is desired and what transformations are required.| +|State changes|Important.|Non-existent.| +|Order of execution|Important.|Low importance.| +|Primary flow control|Loops, conditionals, and function (method) calls.|Function calls, including recursion.| +|Primary manipulation unit|Instances of structures or classes.|Functions as first-class objects and data collections.| + +Although most languages were designed to support a specific programming paradigm, many general languages are flexible enough to support multiple paradigms. For example, most languages that contain function pointers can be used to credibly support functional programming. Furthermore, C# and Visual Basic include explicit language extensions to support functional programming, including lambda expressions and type inference. LINQ technology is a form of declarative, functional programming. + +## Functional programming using XSLT + +Many XSLT developers are familiar with the pure functional approach. The most effective way to develop an XSLT style sheet is to treat each template as an isolated, composable transformation. The order of execution is completely de-emphasized. XSLT doesn't allow side effects (with the exception that escaping mechanisms for executing procedural code can introduce side effects that result in functional impurity). However, although XSLT is an effective tool, some of its characteristics aren't optimal. For example, expressing programming constructs in XML makes code relatively verbose, and therefore difficult to maintain. Also, the heavy reliance on recursion for flow control can result in code that's hard to read. For more information about XSLT, see [XSLT Transformations](../../standard/data/xml/xslt-transformations.md). + +However, XSLT has proved the value of using a pure functional approach for transforming XML from one shape to another. Pure functional programming with LINQ to XML is similar in many ways to XSLT. However, the programming constructs introduced by LINQ to XML, C#, and Visual Basic allow you to write pure functional transformations that are more readable and maintainable than XSLT. + +## Advantages of pure functions + +The primary reason to implement functional transformations as pure functions is that pure functions are composable: that is, self-contained and stateless. These characteristics bring a number of benefits, including the following: + +- Increased readability and maintainability. This is because each function is designed to accomplish a specific task given its arguments. The function doesn't rely on any external state. +- Easier reiterative development. Because the code is easier to refactor, changes to design are often easier to implement. For example, suppose you write a complicated transformation, and then realize that some code is repeated several times in the transformation. If you refactor through a pure method, you can call your pure method at will without worrying about side effects. +- Easier testing and debugging. Because pure functions can more easily be tested in isolation, you can write test code that calls the pure function with typical values, valid edge cases, and invalid edge cases. + +## Transitioning for OOP developers + +In traditional object-oriented programming (OOP), most developers are accustomed to programming in the imperative/procedural style. To switch to developing in a pure functional style, they have to make a transition in their thinking and their approach to development. + +To solve problems, OOP developers design class hierarchies, focus on proper encapsulation, and think in terms of class contracts. The behavior and state of object types are paramount, and language features, such as classes, interfaces, inheritance, and polymorphism, are provided to address these concerns. + +In contrast, functional programming approaches computational problems as an exercise in the evaluation of pure functional transformations of data collections. Functional programming avoids state and mutable data, and instead emphasizes the application of functions. + +Fortunately, C# and Visual Basic don't require the full leap to functional programming, because they support both imperative and functional programming approaches. A developer can choose which approach is most appropriate for a particular scenario. In fact, programs often combine both approaches. + +## See also + +- [Introduction to pure functional transformations](introduction-pure-functional-transformations.md) +- [XSLT Transformations](/../../standard/data/xml/xslt-transformations.md) +- [Refactor into pure functions](refactor-pure-functions.md) diff --git a/docs/standard/linq/functional-vs-procedural-programming.md b/docs/standard/linq/functional-vs-procedural-programming.md new file mode 100644 index 0000000000000..b161a42d71c9b --- /dev/null +++ b/docs/standard/linq/functional-vs-procedural-programming.md @@ -0,0 +1,34 @@ +--- +title: Functional vs. procedural programming +description: LINQ to XML supports both functional construction and procedural techniques for creating XML applications. Functional construction is a declarative approach. The procedural techniques support in-memory modification of XML trees. +ms.date: 07/20/2015 +ms.assetid: fc64e39c-a487-4882-9169-da4de97917d9 +--- + +# Functional vs. procedural programming (LINQ to XML) + +There are various types of XML applications: + +- Some applications take source XML documents, and produce new XML documents that are in a different shape than the source documents. +- Some applications take source XML documents, and produce result documents in an entirely different form, such as HTML or CSV text files. +- Some applications take source XML documents, and insert records into a database. +- Some applications take data from another source, such as a database, and create XML documents from it. + +These aren't all of the types of XML applications, but these are a representative set of the types of functionality that an XML programmer has to implement. + +With all of these types of applications, there are two contrasting approaches that a developer can take: + +- Functional construction using a declarative approach. +- In-memory XML tree modification using procedural code. + +LINQ to XML supports both approaches. + +When using the functional approach, you write transformations that take the source documents and generate completely new result documents with the desired shape. + +When modifying an XML tree in place, you write code that traverses and navigates through nodes in an in-memory XML tree, inserting, deleting, and modifying nodes as necessary. + +You can use LINQ to XML with either approach. You use the same classes, and in some cases the same methods. However, the structure and goals of the two approaches are different. For example, in different situations, one or the other approach will often have better performance, and use more or less memory. In addition, one or the other approach will be easier to write and yield more maintainable code. + +To see the two approaches contrasted, see [In-memory XML tree modification vs. functional construction](in-memory-xml-tree-modification-vs-functional-construction.md). + +For a tutorial on writing functional transformations, see [Introduction to pure functional transformations](introduction-pure-functional-transformations.md). diff --git a/docs/standard/linq/generate-text-files-xml.md b/docs/standard/linq/generate-text-files-xml.md new file mode 100644 index 0000000000000..c4560b938f11d --- /dev/null +++ b/docs/standard/linq/generate-text-files-xml.md @@ -0,0 +1,85 @@ +--- +title: How to generate text files from XML - LINQ to XML +description: You can use C# and Visual Basic to generate a comma-separated values (CSV) text file from an XML file. This article provides an example. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 9ad283f7-7cac-42ff-bf32-92aa866e6883 +--- +# How to generate text files from XML (LINQ to XML) + +This article provides an example that shows how to use C# and Visual Basic to generate a comma-separated values (CSV) text file from an XML file. + +## Example: Generate a CSV file from an XML document + +This example generates a CSV file from XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md). + +The C# version uses method syntax and the `Aggregate` operator to generate the file in a single expression. For more information, see [Query Syntax and Method Syntax in LINQ (C#)](../../csharp/programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md). + +The Visual Basic version uses procedural code to aggregate the collection of strings into a single string. + +```csharp +XElement custOrd = XElement.Load("CustomersOrders.xml"); +string csv = + (from el in custOrd.Element("Customers").Elements("Customer") + select + String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}{10}", + (string)el.Attribute("CustomerID"), + (string)el.Element("CompanyName"), + (string)el.Element("ContactName"), + (string)el.Element("ContactTitle"), + (string)el.Element("Phone"), + (string)el.Element("FullAddress").Element("Address"), + (string)el.Element("FullAddress").Element("City"), + (string)el.Element("FullAddress").Element("Region"), + (string)el.Element("FullAddress").Element("PostalCode"), + (string)el.Element("FullAddress").Element("Country"), + Environment.NewLine + ) + ) + .Aggregate( + new StringBuilder(), + (sb, s) => sb.Append(s), + sb => sb.ToString() + ); +Console.WriteLine(csv); +``` + +```vb +Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") +Dim strCollection As IEnumerable(Of String) = _ + From el In custOrd.. _ + Select _ + String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}{10}", _ + el.@CustomerID, _ + el..Value, _ + el..Value, _ + el..Value, _ + el..Value, _ + el..
.Value, _ + el...Value, _ + el...Value, _ + el...Value, _ + el...Value, _ + Environment.NewLine _ + ) +Dim sb As StringBuilder = New StringBuilder() +For Each str As String In strCollection + sb.Append(str) +Next +Console.WriteLine(sb.ToString()) +``` + +This example produces the following output: + +```output +GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA +HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA +LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA +LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA +``` + +## See also + +- [Query Syntax and Method Syntax in LINQ (C#)](../../csharp/programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq.md) diff --git a/docs/standard/linq/generate-xml-csv-files.md b/docs/standard/linq/generate-xml-csv-files.md new file mode 100644 index 0000000000000..c430324539eaa --- /dev/null +++ b/docs/standard/linq/generate-xml-csv-files.md @@ -0,0 +1,140 @@ +--- +title: How to generate XML from CSV files - LINQ to XML +description: Learn how to create XML from a comma-separated values (CSV) file in C# or Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 57b9ccde-f983-4a21-ae61-70ecede30307 +--- + +# How to generate XML from CSV files (LINQ to XML) + +You can use LINQ to XML in C# or Visual Basic to create XML from a comma-separated values (CSV) file. + +## Example: Generate XML from a CSV file + +This example does a LINQ query on an array of strings, then uses the `let` clause to split each string into an array of fields. + +```csharp +// Create the text file. +string csvString = @"GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA +HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA +LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA +LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA"; +File.WriteAllText("cust.csv", csvString); + +// Read into an array of strings. +string[] source = File.ReadAllLines("cust.csv"); +XElement cust = new XElement("Root", + from str in source + let fields = str.Split(',') + select new XElement("Customer", + new XAttribute("CustomerID", fields[0]), + new XElement("CompanyName", fields[1]), + new XElement("ContactName", fields[2]), + new XElement("ContactTitle", fields[3]), + new XElement("Phone", fields[4]), + new XElement("FullAddress", + new XElement("Address", fields[5]), + new XElement("City", fields[6]), + new XElement("Region", fields[7]), + new XElement("PostalCode", fields[8]), + new XElement("Country", fields[9]) + ) + ) +); +Console.WriteLine(cust); +``` + +```vb +' Create the text file. +Dim csvString As String = "GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA" & vbCrLf & _ + "HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA" & vbCrLf & _ + "LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA" & vbCrLf & _ + "LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA" +File.WriteAllText("cust.csv", csvString) + +' Read into an array of strings. +Dim source As String() = File.ReadAllLines("cust.csv") +Dim cust As XElement = _ + + <%= From strs In source _ + Let fields = Split(strs, ",") _ + Select _ + > + <%= fields(1) %> + <%= fields(2) %> + <%= fields(3) %> + <%= fields(4) %> + +
<%= fields(5) %>
+ <%= fields(6) %> + <%= fields(7) %> + <%= fields(8) %> + <%= fields(9) %> +
+
_ + %> +
+Console.WriteLine(cust) +``` + +This example produces the following output: + +```xml + + + Great Lakes Food Market + Howard Snyder + Marketing Manager + (503) 555-7555 + +
2732 Baker Blvd.
+ Eugene + OR + 97403 + USA +
+
+ + Hungry Coyote Import Store + Yoshi Latimer + Sales Representative + (503) 555-6874 + +
City Center Plaza 516 Main St.
+ Elgin + OR + 97827 + USA +
+
+ + Lazy K Kountry Store + John Steel + Marketing Manager + (509) 555-7969 + +
12 Orchestra Terrace
+ Walla Walla + WA + 99362 + USA +
+
+ + Let's Stop N Shop + Jaime Yorres + Owner + (415) 555-5938 + +
87 Polk St. Suite 5
+ San Francisco + CA + 94117 + USA +
+
+
+``` diff --git a/docs/standard/linq/in-memory-xml-tree-modification-vs-functional-construction.md b/docs/standard/linq/in-memory-xml-tree-modification-vs-functional-construction.md new file mode 100644 index 0000000000000..00dda94d761a3 --- /dev/null +++ b/docs/standard/linq/in-memory-xml-tree-modification-vs-functional-construction.md @@ -0,0 +1,95 @@ +--- +title: In-memory XML tree modification vs. functional construction - LINQ to XML +description: See examples of two different approaches to modifying XML trees. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b5afc31d-a325-4ec6-bf17-0ff90a20ffca +--- + +# In-memory XML tree modification vs. functional construction (LINQ to XML) + +Modifying an XML tree in place is a traditional approach to changing the shape of an XML document. A typical application loads a document into a data store such as DOM or LINQ to XML; uses a programming interface to insert or delete nodes, or change their content; and then saves the XML to a file or transmits it over a network. + +LINQ to XML enables another approach that is useful in many scenarios: *functional construction*. Functional construction treats modifying data as a problem of transformation, rather than as detailed manipulation of a data store. If you can take a representation of data and transform it efficiently from one form to another, the result is the same as if you took one data store and manipulated it in some way to take another shape. A key to the functional construction approach is to pass the results of queries to and constructors. + +In many cases you can write the transformational code in a fraction of the time that it would take to manipulate the data store, and the resulting code is more robust and easier to maintain. In these cases, even though the transformational approach can take more processing power, it's a more effective way to modify data. If a developer is familiar with the functional approach, the resulting code in many cases is easier to understand, and it's easy to find the code that modifies each part of the tree. + +The approach where you modify an XML tree in place is more familiar to many DOM programmers, whereas code written using the functional approach might look unfamiliar to a developer who doesn't yet understand that approach. If you have to only make a small modification to a large XML tree, the approach where you modify a tree in place in many cases will take less CPU time. + +This article provides examples of both approaches. Suppose you want to modify the following simple XML document so that the attributes become elements: + +```xml + + + Content + +``` + +The first of the following examples uses the traditional in-place modification approach, and the second uses the functional construction approach. + +## Example: Transform attributes into elements with the traditional in-place approach + +You can write some procedural code to create elements from the attributes, and then delete the attributes, as follows: + +```csharp +XElement root = XElement.Load("Data.xml"); +foreach (XAttribute att in root.Attributes()) { + root.Add(new XElement(att.Name, (string)att)); +} +root.Attributes().Remove(); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = XElement.Load("Data.xml") +For Each att As XAttribute In root.Attributes() + root.Add(New XElement(att.Name, att.Value)) +Next +root.Attributes().Remove() +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + Content + 123 + 456 + +``` + +## Example: Transform attributes into elements with the functional construction approach + +By contrast, a functional approach consists of code to form a new tree, picking and choosing elements and attributes from the source tree, and transforming them as appropriate as they're added to the new tree. + +```csharp +XElement root = XElement.Load("Data.xml"); +XElement newTree = new XElement("Root", + root.Element("Child1"), + from att in root.Attributes() + select new XElement(att.Name, (string)att) +); +Console.WriteLine(newTree); +``` + +```vb +Dim root As XElement = XElement.Load("Data.xml") +Dim newTree As XElement = _ + + <%= root. %> + <%= From att In root.Attributes() _ + Select New XElement(att.Name, att.Value) %> + +Console.WriteLine(newTree) +``` + +This example outputs the same XML as the first example. However, notice that you can actually see the resulting structure of the new XML in the functional approach. You can see the creation of the `Root` element, the code that pulls the `Child1` element from the source tree, and the code that transforms the attributes from the source tree to elements in the new tree. + +The functional example in this case is neither shorter nor simpler than the first example. However, if you have many changes to make to an XML tree, the procedural approach will become quite complex and somewhat obtuse. In contrast, when using the functional approach, you still just form the desired XML, embedding queries and expressions as appropriate, to pull in the desired content. The functional approach yields code that is easier to maintain. + +Notice that in this case the functional approach probably would not perform quite as well as the tree manipulation approach. The main issue is that the functional approach creates more short-lived objects. However, the tradeoff is an effective one if using the functional approach allows for greater programmer productivity. + +This is a very simple example, but it serves to show the difference in philosophy between the two approaches. The functional approach yields greater productivity gains for transforming larger XML documents. diff --git a/docs/standard/using-linq.md b/docs/standard/linq/index.md similarity index 72% rename from docs/standard/using-linq.md rename to docs/standard/linq/index.md index a9ba1021fa8e3..6fca36145cc09 100644 --- a/docs/standard/using-linq.md +++ b/docs/standard/linq/index.md @@ -1,22 +1,22 @@ --- -title: LINQ (Language Integrated Query) -description: Learn how LINQ provides language-level querying capabilities and an API to C# and Visual Basic as a way to write expressive, declarative code. +title: LINQ overview - .NET +description: Language-Integrated Query (LINQ) provides language-level querying capabilities, and a higher-order function API to C# and Visual Basic, that enable you to write expressive declarative code. author: cartermp ms.author: wiwagn ms.date: 06/20/2016 -dev_langs: +ms.technology: dotnet-standard +dev_langs: - "csharp" - "vb" -ms.technology: dotnet-standard -ms.assetid: c00939e1-59e3-4e61-8fe9-08ad6b3f1295 --- -# LINQ (Language Integrated Query) -## What is it? +# LINQ overview -LINQ provides language-level querying capabilities and a [higher-order function](https://en.wikipedia.org/wiki/Higher-order_function) API to C# and Visual Basic as a way to write expressive, declarative code. +Language-Integrated Query (LINQ) provides language-level querying capabilities, and a [higher-order function](https://en.wikipedia.org/wiki/Higher-order_function) API to C# and Visual Basic, that enable you to write expressive declarative code. -Language-level query syntax: +## Language-level query syntax + +This is the language-level query syntax: ```csharp var linqExperts = from p in programmers @@ -30,7 +30,7 @@ Dim linqExperts = From p in programmers Select New LINQExpert(p) ``` -Same example using the `IEnumerable` API: +This is the same example using the `IEnumerable` API: ```csharp var linqExperts = programmers.Where(p => p.IsNewToLINQ) @@ -42,11 +42,11 @@ Dim linqExperts = programmers.Where(Function(p) p.IsNewToLINQ). Select(Function(p) New LINQExpert(p)) ``` -## LINQ is Expressive +## LINQ is expressive Imagine you have a list of pets, but want to convert it into a dictionary where you can access a pet directly by its `RFID` value. -Traditional imperative code: +This is traditional imperative code: ```csharp var petLookup = new Dictionary(); @@ -65,9 +65,9 @@ For Each pet in pets Next ``` -The intention behind the code is not to create a new `Dictionary` and add to it via a loop, it is to convert an existing list into a dictionary! LINQ preserves the intention whereas the imperative code does not. +The intention behind the code isn't to create a new `Dictionary` and add to it via a loop, it's to convert an existing list into a dictionary! LINQ preserves the intention whereas the imperative code doesn't. -Equivalent LINQ expression: +This is the equivalent LINQ expression: ```csharp var petLookup = pets.ToDictionary(pet => pet.RFID); @@ -77,13 +77,13 @@ var petLookup = pets.ToDictionary(pet => pet.RFID); Dim petLookup = pets.ToDictionary(Function(pet) pet.RFID) ``` -The code using LINQ is valuable because it evens the playing field between intent and code when reasoning as a programmer. Another bonus is code brevity. Imagine reducing large portions of a codebase by 1/3 as done above. Pretty sweet deal, right? +The code using LINQ is valuable because it evens the playing field between intent and code when reasoning as a programmer. Another bonus is code brevity. Imagine reducing large portions of a codebase by 1/3 as done above. Sweet deal, right? -## LINQ Providers Simplify Data Access +## LINQ providers simplify data access -For a significant chunk of software out in the wild, everything revolves around dealing with data from some source (Databases, JSON, XML, etc). Often this involves learning a new API for each data source, which can be annoying. LINQ simplifies this by abstracting common elements of data access into a query syntax which looks the same no matter which data source you pick. +For a significant chunk of software out in the wild, everything revolves around dealing with data from some source (Databases, JSON, XML, and so on). Often this involves learning a new API for each data source, which can be annoying. LINQ simplifies this by abstracting common elements of data access into a query syntax that looks the same no matter which data source you pick. -Consider the following: finding all XML elements with a specific attribute value. +This finds all XML elements with a specific attribute value: ```csharp public static IEnumerable FindAllElementsWithAttribute(XElement documentRoot, string elementName, @@ -102,16 +102,15 @@ Public Shared Function FindAllElementsWithAttribute(documentRoot As XElement, el Where el.Element(attributeName).ToString() = value Select el End Function - ``` -Writing code to manually traverse the XML document to perform this task would be far more challenging. +Writing code to manually traverse the XML document to do this task would be far more challenging. -Interacting with XML isn’t the only thing you can do with LINQ Providers. [Linq to SQL](../framework/data/adonet/sql/linq/index.md) is a fairly bare-bones Object-Relational Mapper (ORM) for an MSSQL Server Database. The [JSON.NET](https://www.newtonsoft.com/json/help/html/LINQtoJSON.htm) library provides efficient JSON Document traversal via LINQ. Furthermore, if there isn’t a library which does what you need, you can also [write your own LINQ Provider](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2012/bb546158(v=vs.110))! +Interacting with XML isn't the only thing you can do with LINQ Providers. [Linq to SQL](../../framework/data/adonet/sql/linq/index.md) is a fairly bare-bones Object-Relational Mapper (ORM) for an MSSQL Server Database. The [JSON.NET](https://www.newtonsoft.com/json/help/html/LINQtoJSON.htm) library provides efficient JSON Document traversal via LINQ. Furthermore, if there isn't a library that does what you need, you can also [write your own LINQ Provider](https://docs.microsoft.com/previous-versions/visualstudio/visual-studio-2012/bb546158(v=vs.110))! -## Why Use the Query Syntax? +## Reasons to use the query syntax -This is a question which often comes up. After all, this, +Why use query syntax? This is a question that often comes up. After all, the following code: ```csharp var filteredItems = myItems.Where(item => item.Foo); @@ -135,39 +134,39 @@ Dim filteredItems = From item In myItems Select item ``` -Isn’t the API syntax just a more concise way to do the query syntax? +Isn't the API syntax just a more concise way to do the query syntax? -No. The query syntax allows for the use of the **let** clause, which allows you to introduce and bind a variable within the scope of the expression, using it in subsequent pieces of the expression. Reproducing the same code with only the API syntax can be done, but will most likely lead to code which is hard to read. +No. The query syntax allows for the use of the **let** clause, which allows you to introduce and bind a variable within the scope of the expression, using it in subsequent pieces of the expression. Reproducing the same code with only the API syntax can be done, but will most likely lead to code that's hard to read. So this begs the question, **should you just use the query syntax?** -The answer to this question is **yes** if... +The answer to this question is **yes** if: -* Your existing codebase already uses the query syntax -* You need to scope variables within your queries due to complexity -* You prefer the query syntax and it won’t distract from your codebase +- Your existing codebase already uses the query syntax. +- You need to scope variables within your queries because of complexity. +- You prefer the query syntax and it won't distract from your codebase. The answer to this question is **no** if... -* Your existing codebase already uses the API syntax -* You have no need to scope variables within your queries -* You prefer the API syntax and it won’t distract from your codebase +- Your existing codebase already uses the API syntax +- You have no need to scope variables within your queries +- You prefer the API syntax and it won't distract from your codebase -## Essential Samples +## Essential LINQ For a truly comprehensive list of LINQ samples, visit [101 LINQ Samples](https://docs.microsoft.com/samples/dotnet/try-samples/101-linq-samples/). -The following is a quick demonstration of some of the essential pieces of LINQ. This is in no way comprehensive, as LINQ provides significantly more functionality than what is showcased here. +The following examples are a quick demonstration of some of the essential pieces of LINQ. This is in no way comprehensive, as LINQ provides more functionality than what is showcased here. -* The bread and butter - `Where`, `Select`, and `Aggregate`: +### The bread and butter - `Where`, `Select`, and `Aggregate` ```csharp // Filtering a list. -var germanShepards = dogs.Where(dog => dog.Breed == DogBreed.GermanShepard); +var germanShepherds = dogs.Where(dog => dog.Breed == DogBreed.GermanShepherd); // Using the query syntax. -var queryGermanShepards = from dog in dogs - where dog.Breed == DogBreed.GermanShepard +var queryGermanShepherds = from dog in dogs + where dog.Breed == DogBreed.GermanShepherd select dog; // Mapping a list from type A to type B. @@ -184,11 +183,11 @@ int sumOfStrings = strings.Aggregate(seed, (s1, s2) => s1.Length + s2.Length); ```vb ' Filtering a list. -Dim germanShepards = dogs.Where(Function(dog) dog.Breed = DogBreed.GermanShepard) +Dim germanShepherds = dogs.Where(Function(dog) dog.Breed = DogBreed.GermanShepherd) ' Using the query syntax. -Dim queryGermanShepards = From dog In dogs - Where dog.Breed = DogBreed.GermanShepard +Dim queryGermanShepherds = From dog In dogs + Where dog.Breed = DogBreed.GermanShepherd Select dog ' Mapping a list from type A to type B. @@ -203,7 +202,7 @@ Dim seed As Integer = 0 Dim sumOfStrings As Integer = strings.Aggregate(seed, Function(s1, s2) s1.Length + s2.Length) ``` -* Flattening a list of lists: +### Flattening a list of lists ```csharp // Transforms the list of kennels into a list of all their dogs. @@ -215,7 +214,7 @@ var allDogsFromKennels = kennels.SelectMany(kennel => kennel.Dogs); Dim allDogsFromKennels = kennels.SelectMany(Function(kennel) kennel.Dogs) ``` -* Union between two sets (with custom comparator): +### Union between two sets (with custom comparator) ```csharp public class DogHairLengthComparer : IEqualityComparer @@ -243,11 +242,11 @@ public class DogHairLengthComparer : IEqualityComparer return d.GetHashCode(); } } - ... // Gets all the short-haired dogs between two different kennels. var allShortHairedDogs = kennel1.Dogs.Union(kennel2.Dogs, new DogHairLengthComparer()); + ``` ```vb @@ -276,7 +275,7 @@ End Class Dim allShortHairedDogs = kennel1.Dogs.Union(kennel2.Dogs, New DogHairLengthComparer()) ``` -* Intersection between two sets: +### Intersection between two sets ```csharp // Gets the volunteers who spend share time with two humane societies. @@ -290,7 +289,7 @@ Dim volunteers = humaneSociety1.Volunteers.Intersect(humaneSociety2.Volunteers, New VolunteerTimeComparer()) ``` -* Ordering: +### Ordering ```csharp // Get driving directions, ordering by if it's toll-free before estimated driving time. @@ -306,7 +305,9 @@ Dim results = DirectionsProcessor.GetDirections(start, end). ThenBy(Function(direction) direction.EstimatedTime) ``` -* Finally, a more advanced sample: determining if the values of the properties of two instances of the same type are equal (Borrowed and modified from [this StackOverflow post](https://stackoverflow.com/a/844855)): +### Equality of instance properties + +Finally, a more advanced sample: determining if the values of the properties of two instances of the same type are equal (Borrowed and modified from [this StackOverflow post](https://stackoverflow.com/a/844855)): ```csharp public static bool PublicInstancePropertiesEqual(this T self, T to, params string[] ignore) where T : class @@ -382,11 +383,11 @@ This code will partition `facebookUsers` across system threads as necessary, sum In diagram form: -![PLINQ diagram](./media/using-linq/plinq-diagram.png) +![PLINQ diagram](media/index/plinq-diagram.png) -Parallelizable CPU-bound jobs which can be easily expressed via LINQ (in other words, are pure functions and have no side effects) are a great candidate for PLINQ. For jobs which _do_ have a side effect, consider using the [Task Parallel Library](./parallel-programming/task-parallel-library-tpl.md). +Parallelizable CPU-bound jobs that can be easily expressed via LINQ (in other words, are pure functions and have no side effects) are a great candidate for PLINQ. For jobs that _do_ have a side effect, consider using the [Task Parallel Library](../parallel-programming/task-parallel-library-tpl.md). -## Further Resources: +## More resources * [101 LINQ Samples](https://docs.microsoft.com/samples/dotnet/try-samples/101-linq-samples/) * [Linqpad](https://www.linqpad.net/), a playground environment and Database querying engine for C#/F#/Visual Basic diff --git a/docs/standard/linq/intermediate-materialization.md b/docs/standard/linq/intermediate-materialization.md new file mode 100644 index 0000000000000..aeae0a0f191e7 --- /dev/null +++ b/docs/standard/linq/intermediate-materialization.md @@ -0,0 +1,89 @@ +--- +title: Intermediate materialization (C#) +description: Learn how the use of some standard query operators can cause materialization of collections in a query, and drastically alter the memory and performance profile of your application. +ms.date: 07/20/2015 +ms.assetid: 7922d38f-5044-41cf-8e17-7173d6553a5e +--- + +# Intermediate materialization (C#) + +If you're not careful you can, in some situations, drastically alter the memory and performance profile of your application by causing premature materialization of collections in your queries. Some standard query operators cause materialization of their source collection before yielding a single element. For example, first iterates through its entire source collection, then sorts all items, and then finally yields the first item. This means that it's expensive to get the first item of an ordered collection; each item thereafter isn't expensive. This makes sense: It would be impossible for that query operator to do otherwise. + +## Example: Add a method that calls `ToList`, causing materialization + +This example alters the example in [Chain queries example (C#)](chain-queries-example.md): the `AppendString` method is changed to call before iterating through the source, which causes materialization. + +```csharp +public static class LocalExtensions +{ + public static IEnumerable + ConvertCollectionToUpperCase(this IEnumerable source) + { + foreach (string str in source) + { + Console.WriteLine("ToUpper: source >{0}<", str); + yield return str.ToUpper(); + } + } + + public static IEnumerable + AppendString(this IEnumerable source, string stringToAppend) + { + // the following statement materializes the source collection in a List + // before iterating through it + foreach (string str in source.ToList()) + { + Console.WriteLine("AppendString: source >{0}<", str); + yield return str + stringToAppend; + } + } +} + +class Program +{ + static void Main(string[] args) + { + string[] stringArray = { "abc", "def", "ghi" }; + + IEnumerable q1 = + from s in stringArray.ConvertCollectionToUpperCase() + select s; + + IEnumerable q2 = + from s in q1.AppendString("!!!") + select s; + + foreach (string str in q2) + { + Console.WriteLine("Main: str >{0}<", str); + Console.WriteLine(); + } + } +} +``` + + This example produces the following output: + +```output +ToUpper: source >abc< +ToUpper: source >def< +ToUpper: source >ghi< +AppendString: source >ABC< +Main: str >ABC!!!< + +AppendString: source >DEF< +Main: str >DEF!!!< + +AppendString: source >GHI< +Main: str >GHI!!!< +``` + +In this example, you can see that the call to causes `AppendString` to enumerate its entire source before yielding the first item. If the source were a large array, this would significantly alter the memory profile of the application. + +Standard query operators can also be chained together as shown in the final article in this tutorial: + +- [Chain standard query operators together (C#)](chain-standard-query-operators-together.md) + +## See also + +- [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md) diff --git a/docs/standard/linq/introduction-pure-functional-transformations.md b/docs/standard/linq/introduction-pure-functional-transformations.md new file mode 100644 index 0000000000000..ebeac1da55065 --- /dev/null +++ b/docs/standard/linq/introduction-pure-functional-transformations.md @@ -0,0 +1,23 @@ +--- +title: Introduction to pure functional transformations - LINQ to XML +description: Get acquainted with functional transformations, including the underlying concepts and supporting language constructs. +ms.date: 07/20/2015 +ms.assetid: 8495c9d9-2d02-4aa0-8a10-9e8794b985fe +--- +# Introduction to pure functional transformations (LINQ to XML) + +This section introduces functional transformations, including the underlying concepts and supporting language constructs. It contrasts the object-oriented and functional transformation approaches to programming, including advice on how to transition to the latter. Although functional transformations can be used in many programming scenarios, XML transformation is used here as a concrete example. + + The [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) tutorial provides a series of examples, each building on the previous one. These examples demonstrate the pure functional transformational approach to manipulating XML. This tutorial assumes a working knowledge of C# or Visual Basic. Detailed semantics of the language constructs aren't provided in this tutorial, but links are provided to the language documentation as appropriate. + + A working knowledge of basic computer science concepts and XML, including XML namespaces, is also assumed. + +## In this section + +|Article|Description| +|-----------|-----------------| +|[Concepts and terminology (functional transformation)](concepts-terminology-functional-transformation.md)|Introduces the concepts and terminology of pure functional transformations.| +|[Functional programming vs. imperative programming](functional-vs-imperative-programming.md)|Compares and contrasts functional programming to more traditional imperative (procedural) programming.| +|[Refactor into pure functions](refactor-pure-functions.md)|Introduces pure functions, and shows examples of and pure and impure functions.| +|[Applicability of functional transformation](applicability-functional-transformation.md)|Describes typical scenarios for functional transformations.| +|[Functional transformation of XML](functional-transformation-xml.md)|Describes functional transformations in the context of transforming XML trees.| diff --git a/docs/standard/linq/join-two-collections.md b/docs/standard/linq/join-two-collections.md new file mode 100644 index 0000000000000..13dedef0cd069 --- /dev/null +++ b/docs/standard/linq/join-two-collections.md @@ -0,0 +1,174 @@ +--- +title: How to join two collections - LINQ to XML +description: An XSD file can establish relationships in an XML file, to enable joining of elements to create new types of elements. This article provides an example for C# and Visual Basic that joins elements and creates a new XML document. +ms.date: 07/20/2015 +ms.assetid: 7b817ede-911a-4cff-9dd3-639c3fc228c9 +dev_langs: + - "csharp" + - "vb" +--- + +# How to join two collections (LINQ to XML) + +An XSD file can establish relationships in an XML file, to enable joining of elements to create new types of elements. This article provides an example for C# and Visual Basic that joins elements and creates a new XML document. + +An element or attribute in an XML document can sometimes refer to another element or attribute. For example, XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md) contains a list of customers and a list of orders. Every `Customer` element has a `CustomerID` attribute, and every `Order` element contains a `CustomerID` element. The `CustomerID` element value in an `Order` element refers to the `Customer` element that has a matching `CustomerID` attribute value. + +The article [Sample XSD file: Customers and orders](sample-xsd-file-customers-orders.md) contains an XSD that can be used to validate the `Customers and orders` document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the key and the `CustomerID` element of the `Order`elements. + +With LINQ to XML, you can take advantage of this relationship by using the `join` clause to join customer information to order information. + +For more detailed information about `join`, see [Join Operations (C#)](../../csharp/programming-guide/concepts/linq/join-operations.md) and [Join Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/join-operations.md). +> [!NOTE] +> Joins are done using linear searches. There are no indexes to boost search performance. + +## Example: Create a new XML document that has `Customer` and `Order` elements joined + +The following example generates a new XML document that joins the `Customer` elements of [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md) to the `Order` elements, and includes the `CompanyName` element in the orders. + +Before executing the query, the example validates that the document complies with the schema in [Sample XSD file: Customers and orders](sample-xsd-file-customers-orders.md). This ensures that the join clause will work. + +The query selects only the orders for customers with a `CustomerID` greater than "K". It projects new `Order` elements that contains the customer information within each order. + +```csharp +XmlSchemaSet schemas = new XmlSchemaSet(); +schemas.Add("", "CustomersOrders.xsd"); + +Console.Write("Attempting to validate, "); +XDocument custOrdDoc = XDocument.Load("CustomersOrders.xml"); + +bool errors = false; +custOrdDoc.Validate(schemas, (o, e) => + { + Console.WriteLine("{0}", e.Message); + errors = true; + }); +Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); + +if (!errors) +{ + // Join customers and orders, and create a new XML document with + // a different shape. + + // The new document contains orders only for customers with a + // CustomerID > 'K' + XElement custOrd = custOrdDoc.Element("Root"); + XElement newCustOrd = new XElement("Root", + from c in custOrd.Element("Customers").Elements("Customer") + join o in custOrd.Element("Orders").Elements("Order") + on (string)c.Attribute("CustomerID") equals + (string)o.Element("CustomerID") + where ((string)c.Attribute("CustomerID")).CompareTo("K") > 0 + select new XElement("Order", + new XElement("CustomerID", (string)c.Attribute("CustomerID")), + new XElement("CompanyName", (string)c.Element("CompanyName")), + new XElement("ContactName", (string)c.Element("ContactName")), + new XElement("EmployeeID", (string)o.Element("EmployeeID")), + new XElement("OrderDate", (DateTime)o.Element("OrderDate")) + ) + ); + Console.WriteLine(newCustOrd); +} +``` + +```vb +Public Class Program + Public Shared errors As Boolean = False + + Public Shared Function LamValidEvent(ByVal o As Object, _ + ByVal e As ValidationEventArgs) As Boolean + Console.WriteLine("{0}", e.Message) + errors = True + End Function + + Shared Sub Main() + Dim schemas As New XmlSchemaSet() + schemas.Add("", "CustomersOrders.xsd") + + Console.Write("Attempting to validate, ") + Dim custOrdDoc As XDocument = XDocument.Load("CustomersOrders.xml") + + custOrdDoc.Validate(schemas, Function(o, e) LamValidEvent(0, e)) + If errors Then + Console.WriteLine("custOrdDoc did not validate") + Else + Console.WriteLine("custOrdDoc validated") + End If + + If Not errors Then + 'Join customers and orders, and create a new XML document with + ' a different shape. + 'The new document contains orders only for customers with a + ' CustomerID > 'K'. + Dim custOrd As XElement = custOrdDoc..FirstOrDefault + Dim newCustOrd As XElement = _ + + <%= From c In custOrd.. _ + Join o In custOrd.. _ + On c.@CustomerID Equals o..Value _ + Where c.@CustomerID.CompareTo("K") > 0 _ + Select _ + + <%= c.@CustomerID %> + <%= c. %> + <%= c. %> + <%= o. %> + <%= o. %> + _ + %> + + Console.WriteLine(newCustOrd) + End If + End Sub +End Class +``` + +This example produces the following output: + +```output +Attempting to validate, custOrdDoc validated + + + LAZYK + Lazy K Kountry Store + John Steel + 1 + 1997-03-21T00:00:00 + + + LAZYK + Lazy K Kountry Store + John Steel + 8 + 1997-05-22T00:00:00 + + + LETSS + Let's Stop N Shop + Jaime Yorres + 1 + 1997-06-25T00:00:00 + + + LETSS + Let's Stop N Shop + Jaime Yorres + 8 + 1997-10-27T00:00:00 + + + LETSS + Let's Stop N Shop + Jaime Yorres + 6 + 1997-11-10T00:00:00 + + + LETSS + Let's Stop N Shop + Jaime Yorres + 4 + 1998-02-12T00:00:00 + + +``` diff --git a/docs/standard/linq/language-integrated-axes.md b/docs/standard/linq/language-integrated-axes.md new file mode 100644 index 0000000000000..26ae957e999d8 --- /dev/null +++ b/docs/standard/linq/language-integrated-axes.md @@ -0,0 +1,21 @@ +--- +title: Language-integrated axes in Visual Basic - LINQ to XML +description: LINQ to XML provides easy access to XML using the axes integrated into Visual Basic +ms.date: 07/20/2015 +ms.assetid: d450a556-a134-4261-b011-44e399660894 +--- + +# Language-integrated axes in Visual Basic (LINQ to XML) + +Axis features are integrated into Visual Basic, making it easy to access XML. Many of the examples in the LINQ to XML documentation use these features, which are described in the articles listed in this table: + +|Article|Description| +|-----------|-----------------| +|[XML Child Axis Property](../../visual-basic/language-reference/xml-axis/xml-child-axis-property.md)|Provides access to the children of one of the following: an object, an object, a collection of objects, or a collection of objects. This axis is equivalent to the axis.| +|[XML Descendant Axis Property](../../visual-basic/language-reference/xml-axis/xml-descendant-axis-property.md)|Provides access to the descendants of the following: an object, an object, or a collection of objects. This axis is equivalent to the axis.| +|[XML Attribute Axis Property](../../visual-basic/language-reference/xml-axis/xml-attribute-axis-property.md)|Provides access to an attribute of an object. This axis is roughly equivalent to the axis. This axis differs from the axis in that it returns the value of the attribute, not an object.| +|[Extension Indexer Property](../../visual-basic/language-reference/xml-axis/extension-indexer-property.md)|Provides access to individual elements in a collection.| + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-annotations.md b/docs/standard/linq/linq-xml-annotations.md similarity index 77% rename from docs/csharp/programming-guide/concepts/linq/linq-to-xml-annotations.md rename to docs/standard/linq/linq-xml-annotations.md index a5db878fb6ce6..d821c760a9d1b 100644 --- a/docs/csharp/programming-guide/concepts/linq/linq-to-xml-annotations.md +++ b/docs/standard/linq/linq-xml-annotations.md @@ -1,16 +1,16 @@ --- -title: "LINQ to XML Annotations" +title: Annotations - LINQ to XML description: Learn how to use annotations in LINQ to XML to associate any arbitrary object of any arbitrary type with any XML component in an XML tree. ms.date: 07/20/2015 ms.assetid: 54e7b9d0-07f5-488f-9065-b6e6b870f810 --- -# LINQ to XML Annotations +# LINQ to XML annotations (LINQ to XML) -Annotations in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] enable you to associate any arbitrary object of any arbitrary type with any XML component in an XML tree. +Annotations in LINQ to XML enable you to associate any arbitrary object of any arbitrary type with any XML component in an XML tree. To add an annotation to an XML component, such as an or , you call the method. You retrieve annotations by type. -Note that annotations are not part of the XML infoset; they are not serialized or deserialized. +Note that annotations aren't part of the XML infoset; they're not serialized or deserialized. ## Methods diff --git a/docs/standard/linq/linq-xml-axes-overview.md b/docs/standard/linq/linq-xml-axes-overview.md new file mode 100644 index 0000000000000..b5f176052bff3 --- /dev/null +++ b/docs/standard/linq/linq-xml-axes-overview.md @@ -0,0 +1,55 @@ +--- +title: LINQ to XML axes overview - LINQ to XML +description: Use axis methods from the XElement, XDocument, and IEnumerable classes to find elements in an XML tree and retrieve their values. +ms.date: 07/20/2015 +ms.assetid: 516792fb-461d-40a8-8a50-9993a51258fc +--- +# LINQ to XML axes overview + +After you've created an XML tree or loaded an XML document into an XML tree, you can query it to find elements and attributes and retrieve their values. You retrieve collections through the *axis methods*, also called *axes*. Some of the axes are methods in the and classes that return collections. Some of the axes are extension methods in the class. The axes that are implemented as extension methods operate on collections and return collections. + +As described in [XElement class overview](xelement-class-overview.md), an object represents a single element node. The content of an element can be complex (sometimes called structured content), or it can be a simple element. A simple element can be empty or can contain a value. If the node contains structured content, you can use the various axis methods to retrieve enumerations of descendant elements. The most commonly used axis methods are and . + +In addition to the axis methods, which return collections, there are two more methods that you'll commonly use in LINQ to XML queries. The method returns a single . The method returns a single . + +For many purposes, LINQ queries provide the most powerful way to examine a tree, extract data from it, and transform it. LINQ queries operate on objects that implement , and the LINQ to XML axes return of collections, and of collections. You need these collections to do your queries. + +In addition to the axis methods that retrieve collections of elements and attributes, there are axis methods that allow you to iterate through the tree in great detail. For example, instead of dealing with elements and attributes, you can work with the nodes of the tree. Nodes are a finer level of granularity than elements and attributes. When working with nodes, you can examine XML comments, text nodes, processing instructions, and more. This functionality is important, for example, to someone who is writing a word processor and wants to save documents as XML. However, the majority of XML programmers are primarily concerned with elements, attributes, and their values. + +## Methods for retrieving a collection of elements + +The following is a summary of the methods of the class (or its base classes) that you call on an to return a collection of elements. + +|Method|Description| +|------------|-----------------| +||Returns an of of the ancestors of this element. An overload returns an of of the ancestors that have the specified .| +||Returns an of of the descendants of this element. An overload returns an of of the descendants that have the specified .| +||Returns an of of the child elements of this element. An overload returns an of of the child elements that have the specified .| +||Returns an of of the elements that come after this element. An overload returns an of of the elements after this element that have the specified .| +||Returns an of of the elements that come before this element. An overload returns an of of the elements before this element that have the specified .| +||Returns an of of this element and its ancestors. An overload returns an of of the elements that have the specified .| +||Returns an of of this element and its descendants. An overload returns an of of the elements that have the specified .| + +## Method for retrieving a single element + +The following method retrieves a single child from an object. + +|Method|Description| +|------------|-----------------| +||Returns the first child object that has the specified .| + +## Method for retrieving a collection of attributes + +The following method retrieves attributes from an object. + +|Method|Description| +|------------|-----------------| +||Returns an of of all of the attributes.| + +## Method for retrieving a single attribute + +The following method retrieves a single attribute from an object. + +|Method|Description| +|------------|-----------------| +||Returns the that has the specified .| diff --git a/docs/standard/linq/linq-xml-classes-overview.md b/docs/standard/linq/linq-xml-classes-overview.md new file mode 100644 index 0000000000000..0f92600ef9e66 --- /dev/null +++ b/docs/standard/linq/linq-xml-classes-overview.md @@ -0,0 +1,97 @@ +--- +title: LINQ to XML classes overview +description: This article provides a list of the LINQ to XML classes, with descriptions of each. +ms.date: 07/20/2015 +ms.assetid: bf666100-5392-4968-97f4-f6b9d3287d7b +--- + +# LINQ to XML classes overview + +This article provides a list of the LINQ to XML classes in the namespace, and a short description of each. + +## LINQ to XML classes + +### XAttribute class + + represents an XML attribute. For detailed information and examples, see [XAttribute class overview](xattribute-class-overview.md). + +### XCData class + + represents a CDATA text node. + +### XComment class + + represents an XML comment. + +### XContainer class + + is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: + +- +- + +### XDeclaration class + + represents an XML declaration. An XML declaration is used to declare the XML version and the encoding of a document. In addition, an XML declaration specifies whether the XML document is stand-alone. If a document is stand-alone, there are no external markup declarations, either in an external DTD, or in an external parameter entity referenced from the internal subset. + +### XDocument class + + represents an XML document. For detailed information and examples, see [XDocument class overview](xdocument-class-overview.md). + +### XDocumentType class + + represents an XML Document Type Definition (DTD). + +### XElement class + + represents an XML element. For detailed information and examples, see [XElement class overview](xelement-class-overview.md). + +### XName class + + represents names of elements () and attributes (). For detailed information and examples, see [XDocument class overview](xdocument-class-overview.md). + +LINQ to XML is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced article in XML. Arguably, this complexity comes not from namespaces, which developers use regularly in programming, but from namespace prefixes. Namespace prefixes can be useful to reduce the keystrokes required when you input XML, or to make XML easier to read. However, prefixes are often just a shortcut for using the full XML namespace, and aren't required in most cases. LINQ to XML simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they're required, through the method. + +it's possible, if necessary, to control namespace prefixes. In some circumstances, if you're working with other XML systems, such as XSLT or XAML, you need to control namespace prefixes. For example, if you have an XPath expression that uses namespace prefixes and is embedded in an XSLT stylesheet, you must make sure that your XML document is serialized with namespace prefixes that match those used in the XPath expression. + +### XNamespace class + + represents a namespace for an or . Namespaces are a component of an . + +### XNode class + + is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: + +- +- +- +- +- + +### XNodeDocumentOrderComparer class + + provides functionality to compare nodes for their document order. + +### XNodeEqualityComparer class + + provides functionality to compare nodes for value equality. + +### XObject class + + is an abstract base class of and . It provides annotation and event functionality. + +### XObjectChange class + + specifies the event type when an event is raised for an . + +### XObjectChangeEventArgs class + + provides data for the and events. + +### XProcessingInstruction class + + represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. + +### XText class + + represents a text node. In most cases, you don't have to use this class. This class is primarily used for mixed content. diff --git a/docs/standard/linq/linq-xml-events.md b/docs/standard/linq/linq-xml-events.md new file mode 100644 index 0000000000000..81912c4f0fb48 --- /dev/null +++ b/docs/standard/linq/linq-xml-events.md @@ -0,0 +1,149 @@ +--- +title: LINQ to XML events - LINQ to XML +description: Learn how to use XML events to monitor changes to an XML tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: ce7de951-cba7-4870-9962-733eb01cd680 +--- + +# LINQ to XML Events (LINQ to XML) + +LINQ to XML events enable you to be notified when an XML tree is altered. + +You can add events to any instance of any . The event handler will then receive events for modifications to that and any of its descendants. For example, you can add an event handler to the root of the tree, and handle all modifications to the tree from that event handler. + +For examples of LINQ to XML events, see and . + +## Types and events + +You use the following types when working with events: + +|Type|Description| +|----------|-----------------| +||Specifies the event type when an event is raised for an .| +||Provides data for the and events.| + +The following events are raised when you modify an XML tree: + +|Event|Description| +|-----------|-----------------| +||Occurs just before this or any of its descendants is going to change.| +||Occurs when an has changed or any of its descendants have changed.| + +## Example: Use events to maintain a proper total when items are changed + +Events are useful when you want to maintain some aggregate information in an XML tree. For example, you may want to maintain an invoice total that's the sum of the line items of the invoice. This example uses events to maintain the total of all of the child elements under the complex element `Items`. + +```csharp +XElement root = new XElement("Root", + new XElement("Total", "0"), + new XElement("Items") +); +XElement total = root.Element("Total"); +XElement items = root.Element("Items"); +items.Changed += (object sender, XObjectChangeEventArgs cea) => +{ + switch (cea.ObjectChange) + { + case XObjectChange.Add: + if (sender is XElement) + total.Value = ((int)total + (int)(XElement)sender).ToString(); + if (sender is XText) + total.Value = ((int)total + (int)((XText)sender).Parent).ToString(); + break; + case XObjectChange.Remove: + if (sender is XElement) + total.Value = ((int)total - (int)(XElement)sender).ToString(); + if (sender is XText) + total.Value = ((int)total - Int32.Parse(((XText)sender).Value)).ToString(); + break; + } + Console.WriteLine("Changed {0} {1}", + sender.GetType().ToString(), cea.ObjectChange.ToString()); +}; +items.SetElementValue("Item1", 25); +items.SetElementValue("Item2", 50); +items.SetElementValue("Item2", 75); +items.SetElementValue("Item3", 133); +items.SetElementValue("Item1", null); +items.SetElementValue("Item4", 100); +Console.WriteLine("Total:{0}", (int)total); +Console.WriteLine(root); +``` + +```vb +Module Module1 + Dim WithEvents items As XElement = Nothing + Dim total As XElement = Nothing + Dim root As XElement = _ + + 0 + + + + Private Sub XObjectChanged( _ + ByVal sender As Object, _ + ByVal cea As XObjectChangeEventArgs) _ + Handles items.Changed + Select Case cea.ObjectChange + Case XObjectChange.Add + If sender.GetType() Is GetType(XElement) Then + total.Value = CStr(CInt(total.Value) + _ + CInt((DirectCast(sender, XElement)).Value)) + End If + If sender.GetType() Is GetType(XText) Then + total.Value = CStr(CInt(total.Value) + _ + CInt((DirectCast(sender, XText)).Value)) + End If + Case XObjectChange.Remove + If sender.GetType() Is GetType(XElement) Then + total.Value = CStr(CInt(total.Value) - _ + CInt((DirectCast(sender, XElement)).Value)) + End If + If sender.GetType() Is GetType(XText) Then + total.Value = CStr(CInt(total.Value) - _ + CInt((DirectCast(sender, XText)).Value)) + End If + End Select + Console.WriteLine("Changed {0} {1}", _ + sender.GetType().ToString(), _ + cea.ObjectChange.ToString()) + End Sub + + Sub Main() + total = root.(0) + items = root.(0) + items.SetElementValue("Item1", 25) + items.SetElementValue("Item2", 50) + items.SetElementValue("Item2", 75) + items.SetElementValue("Item3", 133) + items.SetElementValue("Item1", Nothing) + items.SetElementValue("Item4", 100) + Console.WriteLine("Total:{0}", CInt(total)) + Console.WriteLine(root) + End Sub +End Module +``` + +This example produces the following output: + +```output +Changed System.Xml.Linq.XElement Add +Changed System.Xml.Linq.XElement Add +Changed System.Xml.Linq.XText Remove +Changed System.Xml.Linq.XText Add +Changed System.Xml.Linq.XElement Add +Changed System.Xml.Linq.XElement Remove +Changed System.Xml.Linq.XElement Add +Total:308 + + 308 + + 75 + 133 + 100 + + +``` diff --git a/docs/standard/linq/linq-xml-overview.md b/docs/standard/linq/linq-xml-overview.md new file mode 100644 index 0000000000000..0c0f483443df2 --- /dev/null +++ b/docs/standard/linq/linq-xml-overview.md @@ -0,0 +1,170 @@ +--- +title: Overview - LINQ to XML +description: LINQ to XML provides an in-memory XML programming interface that' based on .NET capabilities, and comparable to an updated DOM API. +ms.date: 10/30/2018 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 716b94d3-0091-4de1-8e05-41bc069fa9dd +--- + +# LINQ to XML overview + +LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. LINQ to XML uses .NET capabilities and is comparable to an updated, redesigned Document Object Model (DOM) XML programming interface. + +XML has been widely adopted as a way to format data in many contexts. For example, you can find XML on the Web, in configuration files, in Microsoft Office Word files, and in databases. + +LINQ to XML is an up-to-date, redesigned approach to programming with XML. It provides the in-memory document modification capabilities of the Document Object Model (DOM), and supports LINQ query expressions. Although these query expressions are syntactically different from XPath, they provide similar functionality. + +## LINQ to XML developers + +LINQ to XML targets a variety of developers. For an average developer who just wants to get something done, LINQ to XML makes XML easier by providing a query experience that's similar to SQL. With just a bit of study, programmers can learn to write succinct and powerful queries in their programming language of choice. + +Professional developers can use LINQ to XML to greatly increase their productivity. With LINQ to XML, they can write less code that's more expressive, more compact, and more powerful. They can use query expressions from multiple data domains at the same time. + +## LINQ to XML is an XML programming interface + +LINQ to XML is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET programming languages. + +LINQ to XML is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, LINQ to XML differs from DOM: + +- It provides a new object model that's lighter weight and easier to work with. +- It takes advantage of language features in C# and Visual Basic. + +The most important advantage of LINQ to XML is its integration with Language-Integrated Query (LINQ). This integration enables you to write queries on the in-memory XML document to retrieve collections of elements and attributes. The query capability of LINQ to XML is comparable in functionality (although not in syntax) to XPath and XQuery. The integration of LINQ in C# and Visual Basic provides stronger typing, compile-time checking, and improved debugger support. + +Another advantage of LINQ to XML is the ability to use query results as parameters to and object constructors enables a powerful approach to creating XML trees. This approach, called *functional construction*, enables developers to easily transform XML trees from one shape to another. + +For example, you might have a typical XML purchase order as described in [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). By using LINQ to XML, you could run the following query to obtain the part number attribute value for every item element in the purchase order: + +```csharp +// Load the XML file from our project directory containing the purchase orders +var filename = "PurchaseOrder.xml"; +var currentDirectory = Directory.GetCurrentDirectory(); +var purchaseOrderFilepath = Path.Combine(currentDirectory, filename); + +XElement purchaseOrder = XElement.Load(purchaseOrderFilepath); + +IEnumerable partNos = from item in purchaseOrder.Descendants("Item") + select (string) item.Attribute("PartNumber"); +``` + +```vb +' Load the XML file from our project directory containing the purchase orders +Dim filename = "PurchaseOrder.xml" +Dim currentDirectory = Directory.GetCurrentDirectory() +Dim purchaseOrderFilepath = Path.Combine(currentDirectory, filename) + +Dim purchaseOrder As XElement = XElement.Load(purchaseOrderFilepath) + +Dim partNos = _ + From item In purchaseOrder... _ + Select item.@PartNumber +``` + +In C# this can be rewritten in method syntax form: + +```csharp +IEnumerable partNos = purchaseOrder.Descendants("Item").Select(x => (string) x.Attribute("PartNumber")); +``` + +As another example, you might want a list, sorted by part number, of the items with a value greater than $100. To obtain this information, you could run the following query: + +```csharp +// Load the XML file from our project directory containing the purchase orders +var filename = "PurchaseOrder.xml"; +var currentDirectory = Directory.GetCurrentDirectory(); +var purchaseOrderFilepath = Path.Combine(currentDirectory, filename); + +XElement purchaseOrder = XElement.Load(purchaseOrderFilepath); + +IEnumerable pricesByPartNos = from item in purchaseOrder.Descendants("Item") + where (int) item.Element("Quantity") * (decimal) item.Element("USPrice") > 100 + orderby (string)item.Element("PartNumber") + select item; +``` + +```vb +' Load the XML file from our project directory containing the purchase orders +Dim filename = "PurchaseOrder.xml" +Dim currentDirectory = Directory.GetCurrentDirectory() +Dim purchaseOrderFilepath = Path.Combine(currentDirectory, filename) + +Dim purchaseOrder As XElement = XElement.Load(purchaseOrderFilepath) + +Dim partNos = _ +From item In purchaseOrder... _ +Where (item..Value * _ + item..Value) > 100 _ +Order By item..Value _ +Select item +``` + +Again, in C# this can be rewritten in method syntax form: + +```csharp +IEnumerable pricesByPartNos = purchaseOrder.Descendants("Item") + .Where(item => (int)item.Element("Quantity") * (decimal)item.Element("USPrice") > 100) + .OrderBy(order => order.Element("PartNumber")); +``` + +In addition to these LINQ capabilities, LINQ to XML provides an improved XML programming interface. Using LINQ to XML, you can: + +- Load XML from [files](load-xml-file.md) or [streams](stream-xml-fragments-xmlreader.md). +- Serialize XML to files or streams. +- Create XML from scratch by using functional construction. +- Query XML using XPath-like axes. +- Manipulate the in-memory XML tree by using methods such as , , , and . +- Validate XML trees using XSD. +- Use a combination of these features to transform XML trees from one shape into another. + +## Create XML trees + +One of the most significant advantages of programming with LINQ to XML is that it's easy to create XML trees. For example, to create a small XML tree, you can write code as follows: + +```csharp +XElement contacts = +new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144", + new XAttribute("Type", "Home")), + new XElement("phone", "425-555-0145", + new XAttribute("Type", "Work")), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) +); +``` + +```vb +Dim contacts As XElement = _ + + + Patrick Hines + 206-555-0144 +
+ 123 Main St + Mercer Island + WA + 68042 +
+
+
+``` + +> [!NOTE] +> The Visual Basic version of the example uses XML literals. You can also use in Visual Basic, as in the C# version. + +For more information, see [XML trees](functional-construction.md). + +## See also + +- [Reference](reference.md) +- [LINQ to XML vs. DOM](linq-xml-vs-dom.md) +- [LINQ to XML vs. other XML technologies](linq-xml-vs-xml-technologies.md) +- diff --git a/docs/standard/linq/linq-xml-security.md b/docs/standard/linq/linq-xml-security.md new file mode 100644 index 0000000000000..52cb4dffdcf2c --- /dev/null +++ b/docs/standard/linq/linq-xml-security.md @@ -0,0 +1,105 @@ +--- +title: LINQ to XML Security - LINQ to XML +description: Learn about LINQ to XML security issues, and ways to mitigate security exposure. +ms.date: 07/20/2015 +ms.assetid: ef2c0dc9-ecf9-4c17-b24e-144184ab725f +--- + +# LINQ to XML security + +This article describes security issues associated with LINQ to XML, and provides guidance for mitigating security exposure. + +## LINQ to XML security overview + +LINQ to XML is designed more for programming convenience than for server-side applications with stringent security requirements. Most XML scenarios consist of processing trusted XML documents, rather than processing untrusted XML documents that are uploaded to a server. LINQ to XML is optimized for these scenarios. + +If you must process untrusted data from unknown sources, Microsoft recommends that you use an instance of the class that has been configured to filter out known XML denial of service (DoS) attacks. + +If you've configured an to mitigate denial of service attacks, you can use that reader to populate a LINQ to XML tree and still benefit from the programmer productivity enhancements of LINQ to XML. Many mitigation techniques involve creating readers that are configured to mitigate the security issue, and then instantiating an XML tree through the configured reader. + +XML is intrinsically vulnerable to denial of service attacks because documents are unbounded in size, depth, element name size, and more. Regardless of the component that you use to process XML, you should always be prepared to recycle the application domain if it uses excessive resources. + +## Mitigation of XML, XSD, XPath, and XSLT attacks + +LINQ to XML is built upon and . LINQ to XML supports XSD and XPath through extension methods in the and namespaces. By using the , , and classes in conjunction with LINQ to XML, you can invoke XSLT to transform XML trees. + +If you're operating in a less secure environment, there are a number of security issues that are associated with XML and the use of the classes in , , , and . These issues include, but aren't limited to, the following: + +- XSD, XPath, and XSLT are string-based languages in which you can specify operations that consume a lot of time or memory. It's the responsibility of application programmers who take XSD, XPath, or XSLT strings from untrusted sources to validate that the strings aren't malicious, or to monitor and mitigate the possibility that evaluating these strings will lead to excessive system resource consumption. +- XSD schemas (including inline schemas) are inherently vulnerable to denial of service attacks; you shouldn't accept schemas from untrusted sources. +- XSD and XSLT can include references to other files, and such references can result in cross-zone and cross-domain attacks. +- External entities in DTDs can result in cross-zone and cross-domain attacks. +- DTDs are vulnerable to denial of service attacks. +- Exceptionally deep XML documents can pose denial of service issues; you might want to limit the depth of XML documents. +- Don't accept supporting components, such as , , and objects, from untrusted assemblies. +- Read data in chunks to mitigate large document attacks. +- Script blocks in XSLT style sheets can expose a number of attacks. +- Validate carefully before constructing dynamic XPath expressions. + +## LINQ to XML security issues + +The security issues in this article aren't presented in any particular order. All issues are important and should be addressed as appropriate. + +A successful elevation of privilege attack gives a malicious assembly more control over its environment. A successful elevation of privilege attack can result in disclosure of data, denial of service, and more. + +Applications shouldn't disclose data to users who aren't authorized to see that data. + +Denial of service attacks cause the XML parser or LINQ to XML to consume excessive amounts of memory or CPU time. Denial of service attacks are considered to be less severe than elevation of privilege attacks or disclosure of data attacks. However, they're important in a scenario where a server needs to process XML documents from untrusted sources. + +### Don't expose error messages to untrusted callers + +The description of an error might reveal data, such as the data being transformed, file names, or implementation details. Error messages shouldn't be exposed to callers that aren't trusted. You should catch all errors and report errors with your own custom error messages. + +### Don't call CodeAccessPermissions.Assert in an event handler + +An assembly can have lesser or greater permissions. An assembly that has greater permissions has greater control over the computer and its environments. + +If code in an assembly with greater permissions calls in an event handler, and then the XML tree is passed to a malicious assembly that has restricted permissions, the malicious assembly can cause an event to be raised. Because the event runs code that's in the assembly with greater permissions, the malicious assembly would then be operating with elevated privileges. + +Microsoft recommends that you never call in an event handler. + +### Don't accept DTDs from untrusted sources + +Entities in DTDs are inherently not secure. It's possible for a malicious XML document that contains a DTD to cause the parser to use all memory and CPU time, causing a denial of service attack. Therefore, in LINQ to XML, DTD processing is turned off by default. You shouldn't accept DTDs from untrusted sources. + +One example of accepting DTDs from untrusted sources is a Web application that allows Web users to upload an XML file that references a DTD and a DTD file. Upon validation of the file, a malicious DTD could execute a denial of service attack on your server. Another example of accepting DTDs from untrusted sources is to reference a DTD on a network share that also allows anonymous FTP access. + +### Avoid excessive buffer allocation + +Application developers should be aware that extremely large data sources can lead to resource exhaustion and denial of service attacks. + +If a malicious user submits or uploads a very large XML document, it could cause LINQ to XML to consume excessive system resources. This can constitute a denial of service attack. To prevent this, you can set the property, and create a reader that's then limited in the size of document that it can load. You then use the reader to create the XML tree. + +For example, if you know that the maximum expected size of your XML documents coming from an untrusted source will be less than 50K bytes, set to 100,000. This will not encumber your processing of XML documents, and at the same time it will mitigate denial of service threats where documents might be uploaded that would consume large amounts of memory. + +### Avoid excess entity expansion + +One of the known denial of service attacks when using a DTD is a document that causes excessive entity expansion. To prevent this, you can set the property, and create a reader that's then limited in the number of characters that result from entity expansion. You then use the reader to create the XML tree. + +### Limit the depth of the XML hierarchy + +One possible denial of service attack is when a document is submitted that has excessive depth of hierarchy. To prevent this, you can wrap an in your own class that counts the depth of elements. If the depth exceeds a predetermined reasonable level, you can terminate the processing of the malicious document. + +### Protect against untrusted XmlReader or XmlWriter implementations + +Administrators should verify that any externally supplied or implementations have strong names and have been registered in the machine configuration. This prevents malicious code masquerading as a reader or writer from being loaded. + +### Periodically free objects that reference XName + +To protect against certain kinds of attacks, application programmers should free all objects that reference an object in the application domain on a regular basis. + +### Protect against random XML names + +Applications that take data from untrusted sources should consider using an that's wrapped in custom code to inspect for the possibility of random XML names and namespaces. If such random XML names and namespaces are detected, the application can then terminate the processing of the malicious document. + +You might want to limit the number of names in any given namespace (including names in no namespace) to a reasonable limit. + +### Serialize LINQ to XML objects to XML text before passing the data to an untrusted component + +LINQ to XML could be used to build processing pipelines in which different application components load, validate, query, transform, update, and save XML data that's passed between components as XML trees. This can help optimize performance, because the overhead of loading and serializing objects to XML text is done only at the ends of the pipeline. Developers must be aware, however, that all annotations and event handlers created by one component are accessible to other components. This can create a number of vulnerabilities if the components have different levels of trust. To build secure pipelines across less trusted components, you must serialize LINQ to XML objects to XML text before passing the data to an untrusted component. + +Some security is provided by the common language runtime (CLR). For example, a component that doesn't include a private class can't access annotations keyed by that class. However, annotations can be deleted by components that can't read them. This could be used as a tampering attack. + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/linq-xml-vs-dom.md b/docs/standard/linq/linq-xml-vs-dom.md new file mode 100644 index 0000000000000..a48c14576ba37 --- /dev/null +++ b/docs/standard/linq/linq-xml-vs-dom.md @@ -0,0 +1,203 @@ +--- +title: LINQ to XML vs. DOM +description: There are key differences between LINQ to XML and DOM. LINQ to XML supports functional construction and XML literals, which better show the structure of the XML trees that they build. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 51c0e3d2-c047-4e6a-a423-d61a882400b7 +--- + +# LINQ to XML vs. DOM + +This article describes some key differences between LINQ to XML and the current predominant XML programming API, the W3C Document Object Model (DOM). + +## New ways to construct XML trees + +In the W3C DOM, you build an XML tree from the bottom up; that is, you create a document, you create elements, and then you add the elements to the document. + +For example, the following example uses a typical way to create an XML tree using the Microsoft implementation of DOM, . + +```csharp +XmlDocument doc = new XmlDocument(); +XmlElement name = doc.CreateElement("Name"); +name.InnerText = "Patrick Hines"; +XmlElement phone1 = doc.CreateElement("Phone"); +phone1.SetAttribute("Type", "Home"); +phone1.InnerText = "206-555-0144"; +XmlElement phone2 = doc.CreateElement("Phone"); +phone2.SetAttribute("Type", "Work"); +phone2.InnerText = "425-555-0145"; +XmlElement street1 = doc.CreateElement("Street1"); +street1.InnerText = "123 Main St"; +XmlElement city = doc.CreateElement("City"); +city.InnerText = "Mercer Island"; +XmlElement state = doc.CreateElement("State"); +state.InnerText = "WA"; +XmlElement postal = doc.CreateElement("Postal"); +postal.InnerText = "68042"; +XmlElement address = doc.CreateElement("Address"); +address.AppendChild(street1); +address.AppendChild(city); +address.AppendChild(state); +address.AppendChild(postal); +XmlElement contact = doc.CreateElement("Contact"); +contact.AppendChild(name); +contact.AppendChild(phone1); +contact.AppendChild(phone2); +contact.AppendChild(address); +XmlElement contacts = doc.CreateElement("Contacts"); +contacts.AppendChild(contact); +doc.AppendChild(contacts); +``` + +```vb +Dim doc As XmlDocument = New XmlDocument() +Dim name As XmlElement = doc.CreateElement("Name") +name.InnerText = "Patrick Hines" +Dim phone1 As XmlElement = doc.CreateElement("Phone") +phone1.SetAttribute("Type", "Home") +phone1.InnerText = "206-555-0144" +Dim phone2 As XmlElement = doc.CreateElement("Phone") +phone2.SetAttribute("Type", "Work") +phone2.InnerText = "425-555-0145" +Dim street1 As XmlElement = doc.CreateElement("Street1") +street1.InnerText = "123 Main St" +Dim city As XmlElement = doc.CreateElement("City") +city.InnerText = "Mercer Island" +Dim state As XmlElement = doc.CreateElement("State") +state.InnerText = "WA" +Dim postal As XmlElement = doc.CreateElement("Postal") +postal.InnerText = "68042" +Dim address As XmlElement = doc.CreateElement("Address") +address.AppendChild(street1) +address.AppendChild(city) +address.AppendChild(state) +address.AppendChild(postal) +Dim contact As XmlElement = doc.CreateElement("Contact") +contact.AppendChild(name) +contact.AppendChild(phone1) +contact.AppendChild(phone2) +contact.AppendChild(address) +Dim contacts As XmlElement = doc.CreateElement("Contacts") +contacts.AppendChild(contact) +doc.AppendChild(contacts) +Console.WriteLine(doc.OuterXml) +``` + +This style of coding hides the structure of the XML tree. LINQ to XML also supports an alternative approach, *functional construction*, that better shows the structure. This approach can be done with the and constructors. In Visual Basic, it can also be done with XML literals. This example demonstrates construction of the same XML tree using functional construction: + +```csharp +XElement contacts = + new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144", + new XAttribute("Type", "Home")), + new XElement("phone", "425-555-0145", + new XAttribute("Type", "Work")), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) + ); +``` + +```vb +Dim contacts = _ + + + Patrick Hines + 206-555-0144 + 425-555-0145 +
+ 123 Main St + Mercer Island + WA + 68042 +
+
+
+``` + +Notice that indenting the code to construct the XML tree shows the structure of the underlying XML. The Visual Basic version uses XML literals. + +For more information, see [XML trees](functional-construction.md). + +## Work directly with XML elements + +When you program with XML, your primary focus is usually on XML elements and perhaps on attributes. In LINQ to XML, you can work directly with XML elements and attributes. For example, you can do the following: + +- Create XML elements without using a document object at all. This simplifies programming when you have to work with fragments of XML trees. +- Load `T:System.Xml.Linq.XElement` objects directly from an XML file. +- Serialize `T:System.Xml.Linq.XElement` objects to a file or a stream. + +Compare this to the W3C DOM, in which the XML document is used as a logical container for the XML tree. In DOM, XML nodes, including elements and attributes, must be created in the context of an XML document. Here is a fragment of code to create a name element in DOM: + +```csharp +XmlDocument doc = new XmlDocument(); +XmlElement name = doc.CreateElement("Name"); +name.InnerText = "Patrick Hines"; +doc.AppendChild(name); +``` + +```vb +Dim doc As XmlDocument = New XmlDocument() +Dim name As XmlElement = doc.CreateElement("Name") +name.InnerText = "Patrick Hines" +doc.AppendChild(name) +``` + +If you want to use an element across multiple documents, you must import the nodes across documents. LINQ to XML avoids this layer of complexity. + +When using LINQ to XML, you use the class only if you want to add a comment or processing instruction at the root level of the document. + +## Simplified handling of names and namespaces + +Handling names, namespaces, and namespace prefixes is generally a complex part of XML programming. LINQ to XML simplifies names and namespaces by eliminating the requirement to deal with namespace prefixes. If you want to control namespace prefixes, you can. But if you decide to not explicitly control namespace prefixes, LINQ to XML will assign namespace prefixes during serialization if they're required, or will serialize using default namespaces if they're not. If default namespaces are used, there will be no namespace prefixes in the resulting document. For more information, see [Namespaces overview](namespaces-overview.md). + +Another problem with the DOM is that it doesn't let you change the name of a node. Instead, you have to create a new node and copy all the child nodes to it, losing the original node identity. LINQ to XML avoids this problem by enabling you to set the property on a node. + +## Static method support for loading XML + +LINQ to XML lets you load XML by using static methods, instead of instance methods. This simplifies loading and parsing. For more information, see [How to load XML from a file](load-xml-file.md). + +## Removal of support for DTD constructs + +LINQ to XML further simplifies XML programming by removing support for entities and entity references. The management of entities is complex, and is rarely used. Removing their support increases performance and simplifies the programming interface. When a LINQ to XML tree is populated, all DTD entities are expanded. + +## Support for fragments + +LINQ to XML doesn't provide an equivalent for the `XmlDocumentFragment` class. In many cases, however, the `XmlDocumentFragment` concept can be handled by the result of a query that's typed as of , or of . + +## Support for XPathNavigator + +LINQ to XML provides support for through extension methods in the namespace. For more information, see . + +## Support for white space and indentation + +LINQ to XML handles white space more simply than the DOM. + +A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), do some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for LINQ to XML. + +Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. In LINQ to XML, you can do this by: + +- Preserving white space when you load or parse the XML. +- Disabling formatting when you serialize the XML. + +LINQ to XML stores white space as an node, instead of having a specialized node type, as the DOM does. + +## Support for annotations + +LINQ to XML elements support an extensible set of annotations. This is useful for tracking miscellaneous information about an element, such as schema information, information about whether the element is bound to a UI, or any other kind of application-specific information. For more information, see [LINQ to XML annotations](linq-xml-annotations.md). + +## Support for schema information + +LINQ to XML provides support for XSD validation through extension methods in the namespace. You can validate that an XML tree complies with an XSD. You can populate the XML tree with the post-schema-validation infoset (PSVI). For more information, see [How to validate using XSD](validate-xsd.md) and . + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/linq-xml-vs-xml-technologies.md b/docs/standard/linq/linq-xml-vs-xml-technologies.md new file mode 100644 index 0000000000000..b29466e491811 --- /dev/null +++ b/docs/standard/linq/linq-xml-vs-xml-technologies.md @@ -0,0 +1,58 @@ +--- +title: LINQ to XML vs. other XML technologies +description: Learn how LINQ to XML compares to XSLT, MSXML, and XmlLite, to make better technology choices. +ms.date: 07/20/2015 +ms.assetid: 01b8e746-12d3-471d-b811-7539e4547784 +--- + +# LINQ to XML vs. other XML technologies + +This article compares LINQ to XML to the following XML technologies: , XSLT, MSXML, and XmlLite. This information can help you decide which technologies to use. + +For a comparison of LINQ to XML to the Document Object Model (DOM), see [LINQ to XML vs. DOM](linq-xml-vs-dom.md). + +## LINQ to XML vs. XmlReader + + is a fast, forward-only, non-caching parser. + +LINQ to XML is implemented on top of , and they're tightly integrated. However, you can also use directly. + +For example, suppose you're building a Web service that will parse hundreds of XML documents per second, and the documents have the same structure, meaning that you only have to write one implementation of the code to parse the XML. In this case, you'd probably want to use directly. + +In contrast, if you're building a system that parses many smaller XML documents, and each one is different, you'd want to take advantage of the productivity improvements that LINQ to XML provides. + +## LINQ to XML vs. XSLT + +Both LINQ to XML and XSLT provide extensive XML document transformation capabilities. XSLT is a rule-based, declarative approach. Advanced XSLT programmers write XSLT in a functional programming style that emphasizes a stateless approach. Transformations can be written using pure functions that are implemented without side effects. This rule-based or functional approach is unfamiliar to many developers, and can be difficult and time-consuming to learn. + +XSLT can be a productive system that yields high-performance applications. For example, some large Web companies use XSLT as a way to generate HTML from XML that has been pulled from different kinds of data stores. The managed XSLT engine compiles XSLT to common language runtime (CLR) code, and performs even better in some scenarios than the native XSLT engine. + +However, XSLT doesn't take advantage of the C# and Visual Basic knowledge that many developers have. It requires developers to write code in a different and complex programming language. Using two non-integrated development systems such as C# (or Visual Basic) and XSLT results in software systems that are more difficult to develop and maintain. + +After you've mastered LINQ to XML query expressions, LINQ to XML transformations are a powerful technology that's easy to use. Basically, you form your XML document by using functional construction, pulling in data from various sources, constructing objects dynamically, and assembling the whole into a new XML tree. The transformation can generate a completely new document. Constructing transformations in LINQ to XML is relatively easy and intuitive, and the resulting code is readable. This reduces development and maintenance costs. + +LINQ to XML isn't intended to replace XSLT. XSLT is still the tool of choice for complicated and document-centric XML transformations, especially if the structure of the document isn't well defined. + +XSLT has the advantage of being a World Wide Web Consortium (W3C) standard. If you have a requirement that you use only technologies that are standards, XSLT might be more appropriate. + +XSLT is XML, and that's why it can be programmatically manipulated. + +## LINQ to XML vs. MSXML + +MSXML is the COM-based technology for processing XML that's included with Microsoft Windows. MSXML provides a native implementation of the DOM with support for XPath and XSLT. It also contains the SAX2 non-caching, event-based parser. + +MSXML performs well, is secure by default in most scenarios, and can be accessed in Internet Explorer for doing client-side XML processing in AJAX-style applications. MSXML can be used from any programming language that supports COM, including C++, JavaScript, and Visual Basic 6.0. + +MSXML isn't recommended for use in managed code based on the CLR. + +## LINQ to XML vs. XmlLite + +XmlLite is a non-caching, forward only, pull parser. Developers primarily use XmlLite with C++. It's not recommended for developers to use XmlLite with managed code. + +The main advantage of XmlLite is that it's a lightweight, fast XML parser that's secure in most scenarios. Its threat surface area is small. If you have to parse untrusted documents and you want to protect against attacks such as denial of service or exposure of data, XmlLite might be a good option. + +XmlLite isn't integrated with Language-Integrated Query (LINQ). It doesn't yield the programmer productivity improvements that are the motivating force behind LINQ. + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md b/docs/standard/linq/list-all-nodes-tree.md similarity index 53% rename from docs/csharp/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md rename to docs/standard/linq/list-all-nodes-tree.md index 2b98597a68df9..5d26fe4a0f884 100644 --- a/docs/csharp/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md +++ b/docs/standard/linq/list-all-nodes-tree.md @@ -1,23 +1,29 @@ --- -title: "How to list all nodes in a tree (C#)" -description: Learn how to list all the nodes in a tree by running an XPath expression using LINQ to XML in C#. You can see how a method or property affects the tree. +title: How to list all nodes in a tree - LINQ to XML +description: You can use XPath to list all nodes in an XML tree. This article provides an example for C# and Visual Basic that lists the nodes of a tree. Each node is represented by an XPath expression that specifies the location of the node in the tree. ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" ms.assetid: 3e934371-f4c6-458b-9f6b-f9061b596f5b --- -# How to list all nodes in a tree (C#) -Sometimes it is helpful to list all nodes in a tree. This can be useful when learning exactly how a method or property affects the tree. One approach to listing all nodes in a textual form is to generate an XPath expression that exactly and specifically identifies any node in the tree. +# How to list all nodes in a tree (LINQ to XML) -It is not particularly helpful to execute XPath expressions using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. XPath expressions have poorer performance than [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries, and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries are much more powerful. However, as a way to identify nodes in the XML tree, XPath works well. +Sometimes, it's helpful to list all nodes in a tree – for example, to learn exactly how a method or property affects the tree. The following example for C# and Visual Basic lists the nodes of a tree. Each node is represented by an XPath expression that specifies the location of the node in the tree. -## Example - This example shows a function named `GetXPath` that generates a specific XPath expression for any node in the XML tree. It generates appropriate XPath expressions even when nodes are in a namespace. The XPath expressions are generated by using namespace prefixes. +> [!NOTE] +> It's not particularly helpful to execute XPath expressions using LINQ to XML. LINQ to XML queries perform better than XPath expressions and are much more powerful. However, as a way to identify nodes in the XML tree, XPath works well. - The example then creates a small XML tree that contains an example of several types of nodes. It then iterates through the descendant nodes and prints the XPath expression for each node. +## Example: Use XPath to list all nodes in a tree - You will notice that the XML declaration is not a node in the tree. +This example has a function named `GetXPath` that generates a specific XPath expression for any node in the XML tree. It does this even when nodes are in a namespace. The elements in the generated XPath expressions have namespace prefixes as needed. - The following is an XML file that contains several types of nodes: +The example first creates a small XML tree that contains several types of nodes. It then iterates through the nodes and prints the XPath expression for each node. + +The XML declaration isn't a node in the tree. + +Here is the XML tree that serves as input: ```xml @@ -33,7 +39,7 @@ It is not particularly helpful to execute XPath expressions using [!INCLUDE[sqlt
``` - The following is the list of nodes in the above XML tree, expressed as XPath expressions: +Here is the list of nodes in the XML tree, as defined by XPath expressions: ```text /processing-instruction() @@ -54,6 +60,8 @@ It is not particularly helpful to execute XPath expressions using [!INCLUDE[sqlt /Root/aw:ElementInNamespace/aw:ChildInNamespace ``` +Here is the code for the example: + ```csharp public static class MyExtensions { @@ -105,7 +113,7 @@ public static class MyExtensions XElement el = xobj as XElement; if (el != null) return "/" + NameWithPredicate(el); - // the XPath data model does not include white space text nodes + // The XPath data model doesn't include white space text nodes // that are children of a document, so this method returns null. XText xt = xobj as XText; if (xt != null) @@ -311,7 +319,179 @@ class Program } ``` - This example produces the following output: +```vb +Module Module1 + _ + Private Function StrCat(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Return _ + source.Aggregate(New StringBuilder(), _ + Function(sb, i) sb _ + .Append(i.ToString()) _ + .Append(separator), _ + Function(s) s.ToString()) + End Function + + _ + Public Function GetXPath(ByVal xobj As XObject) As String + Dim retStr As String + If xobj.Parent Is Nothing Then + Dim doc As XDocument = TryCast(xobj, XDocument) + If doc IsNot Nothing Then + Return "." + End If + Dim el As XElement = TryCast(xobj, XElement) + If el IsNot Nothing Then + Return ("/" & NameWithPredicate(el)) + End If + + ' The XPath data model doesn't include white space text nodes + ' that are children of a document, so this method returns null. + Dim xt As XText = TryCast(xobj, XText) + If xt IsNot Nothing Then + Return Nothing + End If + Dim com As XComment = TryCast(xobj, XComment) + If com IsNot Nothing Then + If com.Document().Nodes().OfType(Of XComment)().Count() <> 1 Then + Return "/comment()[" & (com.NodesBeforeSelf().OfType _ + (Of XComment)().Count() + 1) & "]" + Else + Return "/comment()" + End If + End If + + Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) + If pi IsNot Nothing Then + If pi.Document.Nodes().OfType(Of XProcessingInstruction)(). _ + Count() <> 1 Then + Return "/processing-instruction()[" & _ + (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)() _ + .Count() + 1) & "]" + Else + Return "/processing-instruction()" + End If + End If + Else + Dim el As XElement = TryCast(xobj, XElement) + If el IsNot Nothing Then + Return "/" & el.Ancestors().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)) _ + .StrCat("/") & NameWithPredicate(el) + End If + + Dim at As XAttribute = TryCast(xobj, XAttribute) + If at IsNot Nothing Then + Return "/" & at.Parent().AncestorsAndSelf().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)).StrCat("/") & _ + "@" & GetQName(at) + End If + + Dim com As XComment = TryCast(xobj, XComment) + If com IsNot Nothing Then + retStr = "/" & com.Parent.AncestorsAndSelf().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)).StrCat("/") & "comment()" + If com.Parent().Nodes().OfType(Of XComment)().Count() <> 1 Then + retStr &= "[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]" + End If + Return retStr + End If + + Dim cd As XCData = TryCast(xobj, XCData) + If cd IsNot Nothing Then + retStr = "/" & cd.Parent.AncestorsAndSelf().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)).StrCat("/") & "text()" + If cd.Parent.Nodes().OfType(Of XText)().Count() <> 1 Then + retStr &= "[" & (cd.NodesBeforeSelf().OfType(Of XText)(). _ + Count() + 1) & "]" + End If + Return retStr + End If + + Dim tx As XText = TryCast(xobj, XText) + If tx IsNot Nothing Then + retStr = "/" & tx.Parent.AncestorsAndSelf().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)).StrCat("/") & "text()" + If tx.Parent.Nodes().OfType(Of XText)().Count() <> 1 Then + retStr &= "[" & (tx.NodesBeforeSelf().OfType(Of XText)(). _ + Count() + 1) & "]" + End If + Return retStr + End If + + Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) + If pi IsNot Nothing Then + retStr = "/" & pi.Parent.AncestorsAndSelf().InDocumentOrder(). _ + Select(Function(e) NameWithPredicate(e)). _ + StrCat("/") & "processing-instruction()" + If pi.Parent.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1 Then + retStr &= "[" & (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)(). _ + Count() + 1) & "]" + End If + End If + End If + Return Nothing + End Function + + Private Function GetQName(ByVal xe As XElement) As String + Dim prefix As String = xe.GetPrefixOfNamespace(xe.Name.Namespace) + If xe.Name.Namespace = XNamespace.None Or prefix Is Nothing Then + Return xe.Name.LocalName.ToString() + Else + Return prefix + ":" & xe.Name.LocalName.ToString() + End If + End Function + + Private Function GetQName(ByVal xa As XAttribute) As String + Dim prefix As String = _ + xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace) + If xa.Name.Namespace = XNamespace.None Or prefix Is Nothing Then + Return xa.Name.ToString() + Else + Return prefix + ":" & xa.Name.LocalName + End If + End Function + + Public Function NameWithPredicate(ByVal el As XElement) As String + If el.Parent IsNot Nothing AndAlso el.Parent.Elements(el.Name).Count() <> 1 Then + Return GetQName(el) + "[" & _ + (el.ElementsBeforeSelf(el.Name).Count() + 1) & "]" + Else + Return GetQName(el) + End If + End Function + + Sub Main() + Dim aw As XNamespace = "http://www.adventure-works.com" + Dim doc As XDocument = _ + + + + + Text + Other Text + textBoldTextotherText + + + + + doc.Save("Test.xml") + Console.WriteLine(File.ReadAllText("Test.xml")) + Console.WriteLine("------") + For Each obj As XObject In doc.DescendantNodes() + Console.WriteLine(obj.GetXPath()) + Dim el As XElement = TryCast(obj, XElement) + If el IsNot Nothing Then + For Each at As XAttribute In el.Attributes() + Console.WriteLine(at.GetXPath()) + Next + End If + Next + End Sub +End Module +``` + +This example produces the following output: ```output diff --git a/docs/standard/linq/load-xml-file.md b/docs/standard/linq/load-xml-file.md new file mode 100644 index 0000000000000..132a0f611769a --- /dev/null +++ b/docs/standard/linq/load-xml-file.md @@ -0,0 +1,55 @@ +--- +title: How to load XML from a file - LINQ to XML +description: You can use the XElement.Load method in C# and Visual Basic to load an XML document from a file. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3ed38487-8028-4209-9872-c8dce0ed4dfe +--- + +# How to load XML from a file (LINQ to XML) + +This article shows how to load XML from a file in C# and Visual Basic using the method. + +## Example: Load XML document from a file + +The following example shows how to load an XML document from a file by providing with the URI that references the file. The example loads books.xml and outputs the XML tree to the console. + +The contents of books.xml are shown in [Sample XML file: Books](sample-xml-file-books.md). + +```csharp +XElement booksFromFile = XElement.Load(@"books.xml"); +Console.WriteLine(booksFromFile); +``` + +```vb +Dim booksFromFile As XElement = XElement.Load("books.xml") +Console.WriteLine(booksFromFile) +``` + +This example produces the following output: + +```xml + + + Garghentini, Davide + XML Developer's Guide + Computer + 44.95 + 2000-10-01 + An in-depth look at creating applications + with XML. + + + Garcia, Debra + Midnight Rain + Fantasy + 5.95 + 2000-12-16 + A former architect battles corporate zombies, + an evil sorceress, and her own childhood to become queen + of the world. + + +``` diff --git a/docs/standard/linq/maintain-name-value-pairs.md b/docs/standard/linq/maintain-name-value-pairs.md new file mode 100644 index 0000000000000..65e17d3bb2026 --- /dev/null +++ b/docs/standard/linq/maintain-name-value-pairs.md @@ -0,0 +1,167 @@ +--- +title: Maintain name-value pairs - LINQ to XML +description: Learn how to use LINQ to XML methods to maintain a set of name-value pairs. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 7b04b0f1-af64-42eb-8737-83f8861b5915 +--- + +# Maintain name-value pairs (LINQ to XML) + +Many applications have to maintain information that is best kept as name-value pairs. This information might be configuration information or global settings. LINQ to XML contains methods that make it easy to maintain a set of name-value pairs. You can either keep the information as attributes or as a set of child elements. + +One difference between keeping the information as attributes or as child elements is that attributes have the constraint that there can be only one attribute with a particular name for an element. This limitation doesn't apply to child elements. + +## SetAttributeValue and SetElementValue + +The two methods that facilitate keeping name-value pairs are and . These two methods have similar semantics. + + can add, modify, and remove attributes of an element. + +- If you call with a name of an attribute that doesn't exist, the method creates a new attribute and adds it to the specified element. +- If you call with a name of an existing attribute and with some specified content, the contents of the attribute are replaced with the specified content. +- If you call with a name of an existing attribute, and specify `null` for the content, the attribute is removed from its parent. + + can add, modify, and remove child elements of an element. + +- If you call with a name of a child element that doesn't exist, the method creates a new element and adds it to the specified element. +- If you call with a name of an existing element and with some specified content, the contents of the element are replaced with the specified content. +- If you call with a name of an existing element, and specify `null` for the content, the element is removed from its parent. + +## Example: Use `SetAttributeValue` to create and maintain a list of name-value pairs + +The following example creates an element with no attributes. It then uses the method to create and maintain a list of name-value pairs. + +```csharp +// Create an element with no content. +XElement root = new XElement("Root"); + +// Add a number of name-value pairs as attributes. +root.SetAttributeValue("Top", 22); +root.SetAttributeValue("Left", 20); +root.SetAttributeValue("Bottom", 122); +root.SetAttributeValue("Right", 300); +root.SetAttributeValue("DefaultColor", "Color.Red"); +Console.WriteLine(root); + +// Replace the value of Top. +root.SetAttributeValue("Top", 10); +Console.WriteLine(root); + +// Remove DefaultColor. +root.SetAttributeValue("DefaultColor", null); +Console.WriteLine(root); +``` + +```vb +' Create an element with no content. +Dim root As XElement = + +' Add a number of name-value pairs as attributes. +root.SetAttributeValue("Top", 22) +root.SetAttributeValue("Left", 20) +root.SetAttributeValue("Bottom", 122) +root.SetAttributeValue("Right", 300) +root.SetAttributeValue("DefaultColor", "Color.Red") +Console.WriteLine(root) + +' Replace the value of Top. +root.SetAttributeValue("Top", 10) +Console.WriteLine(root) + +' Remove DefaultColor. +root.SetAttributeValue("DefaultColor", Nothing) +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + + +``` + +## Example: Use `SetElementValue` to create and maintain a list of name-value pairs + +The following example creates an element with no child elements. It then uses the method to create and maintain a list of name-value pairs. + +```csharp +// Create an element with no content. +XElement root = new XElement("Root"); + +// Add a number of name-value pairs as elements. +root.SetElementValue("Top", 22); +root.SetElementValue("Left", 20); +root.SetElementValue("Bottom", 122); +root.SetElementValue("Right", 300); +root.SetElementValue("DefaultColor", "Color.Red"); +Console.WriteLine(root); +Console.WriteLine("----"); + +// Replace the value of Top. +root.SetElementValue("Top", 10); +Console.WriteLine(root); +Console.WriteLine("----"); + +// Remove DefaultColor. +root.SetElementValue("DefaultColor", null); +Console.WriteLine(root); +``` + +```vb +' Create an element with no content. +Dim root As XElement = + +' Add a number of name-value pairs as elements. +root.SetElementValue("Top", 22) +root.SetElementValue("Left", 20) +root.SetElementValue("Bottom", 122) +root.SetElementValue("Right", 300) +root.SetElementValue("DefaultColor", "Color.Red") +Console.WriteLine(root) +Console.WriteLine("----") + +' Replace the value of Top. +root.SetElementValue("Top", 10) +Console.WriteLine(root) +Console.WriteLine("----") + +' Remove DefaultColor. +root.SetElementValue("DefaultColor", Nothing) +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + 22 + 20 + 122 + 300 + Color.Red + +---- + + 10 + 20 + 122 + 300 + Color.Red + +---- + + 10 + 20 + 122 + 300 + +``` + +## See also + +- +- diff --git a/docs/standard/media/using-linq/plinq-diagram.png b/docs/standard/linq/media/index/plinq-diagram.png similarity index 100% rename from docs/standard/media/using-linq/plinq-diagram.png rename to docs/standard/linq/media/index/plinq-diagram.png diff --git a/docs/standard/linq/mixed-declarative-imperative-code-bugs.md b/docs/standard/linq/mixed-declarative-imperative-code-bugs.md new file mode 100644 index 0000000000000..01babd9e2502f --- /dev/null +++ b/docs/standard/linq/mixed-declarative-imperative-code-bugs.md @@ -0,0 +1,247 @@ +--- +title: Mixed declarative/imperative code bugs - LINQ to XML +description: Learn how to recognize and avoid problems that can occur when code iterates along an axis making changes. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: fada62d0-0680-4e73-945a-2b00d7a507af +--- + +# Mixed declarative/imperative code bugs (LINQ to XML) + +LINQ to XML contains various methods that allow you to modify an XML tree directly. You can add elements, delete elements, change the contents of an element, add attributes, and so on. This programming interface is described in [Modify XML trees](in-memory-xml-tree-modification-vs-functional-construction.md). If you're iterating through one of the axes, such as , and you're modifying the XML tree as you iterate through the axis, you can end up with some strange bugs. + +This problem is sometimes known as "The Halloween Problem". + +When you write some code using LINQ that iterates through a collection, you're writing code in a declarative style. It's more akin to describing *what* you want, rather that *how* you want to get it done. If you write code that 1) gets the first element, 2) tests it for some condition, 3) modifies it, and 4) puts it back into the list, then this would be imperative code. You're telling the computer *how* to do what you want done. + +Mixing these styles of code in the same operation is what leads to problems. Consider the following: + +Suppose you have a linked list with three items in it (a, b, and c): + +> a -> b -> c + +Now, suppose that you want to move through the linked list, adding three new items (a', b', and c'). You want the resulting linked list to look like this: + + > a -> a' -> b -> b' -> c -> c' + +So you write code that iterates through the list, and for every item, adds a new item right after it. What happens is that your code will first see the `a` element, and insert `a'` after it. Now, your code will move to the next node in the list, which is now `a'`, so it adds a new item between a' and b to the list! + +How would you solve this? Well, you might make a copy of the original linked list, and create a completely new list. Or if you're writing purely imperative code, you might find the first item, add the new item, and then advance twice in the linked list, advancing over the element that you just added. + +## Example: Adding while iterating + +For example, suppose you want to write code to create a duplicate of every element in a tree: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +foreach (XElement e in root.Elements()) + root.Add(new XElement(e.Name, (string)e)); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +For Each e As XElement In root.Elements() + root.Add(New XElement(e.Name, e.Value)) +Next +``` + +This code goes into an infinite loop. The `foreach` statement iterates through the `Elements()` axis, adding new elements to the `doc` element. It ends up iterating also through the elements it just added. And because it allocates new objects with every iteration of the loop, it will eventually consume all available memory. + +You can fix this problem by pulling the collection into memory using the standard query operator, as follows: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +foreach (XElement e in root.Elements().ToList()) + root.Add(new XElement(e.Name, (string)e)); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +For Each e As XElement In root.Elements().ToList() + root.Add(New XElement(e.Name, e.Value)) +Next +Console.WriteLine(root) +``` + +Now the code works. The resulting XML tree is the following: + +```xml + + 1 + 2 + 3 + 1 + 2 + 3 + +``` + +## Example: Deleting while iterating + +If you want to delete all nodes at a certain level, you might be tempted to write code like the following: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +foreach (XElement e in root.Elements()) + e.Remove(); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +For Each e As XElement In root.Elements() + e.Remove() +Next +Console.WriteLine(root) +``` + +However, this doesn't do what you want. In this situation, after you've removed the first element, A, it's removed from the XML tree contained in root, and the code in the Elements method that does the iterating can't find the next element. + +This example produces the following output: + +```xml + + 2 + 3 + +``` + +The solution again is to call to materialize the collection, as follows: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +foreach (XElement e in root.Elements().ToList()) + e.Remove(); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +For Each e As XElement In root.Elements().ToList() + e.Remove() +Next +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + +``` + +Alternatively, you can eliminate the iteration altogether by calling on the parent element: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +root.RemoveAll(); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +root.RemoveAll() +Console.WriteLine(root) +``` + +## Example: Why LINQ can't automatically handle these issues + +One approach would be to always bring everything into memory instead of doing lazy evaluation. However, it would be very expensive in terms of performance and memory use. In fact, if LINQ, and LINQ to XML, were to take this approach, it would fail in real-world situations. + +Another possible approach would be to put some sort of transaction syntax into LINQ, and have the compiler attempt to analyze the code to determine if any particular collection needed to be materialized. However, attempting to determine all code that has side-effects is incredibly complex. Consider the following code: + +```csharp +var z = + from e in root.Elements() + where TestSomeCondition(e) + select DoMyProjection(e); +``` + +```vb +Dim z = _ + From e In root.Elements() _ + Where (TestSomeCondition(e)) _ + Select DoMyProjection(e) +``` + +Such analysis code would need to analyze the methods TestSomeCondition and DoMyProjection, and all methods that those methods called, to determine if any code had side-effects. But the analysis code could not just look for any code that had side-effects. It would need to select for just the code that had side-effects on the child elements of `root` in this situation. + +LINQ to XML doesn't attempt to do any such analysis. It's up to you to avoid these problems. + +## Example: Use declarative code to generate a new XML tree rather than modify the existing tree + +To avoid such problems, don't mix declarative and imperative code, even if you know exactly the semantics of your collections and the semantics of the methods that modify the XML tree. If you write code that avoids problems, your code will need to be maintained by other developers in the future, and they may not be as clear on the issues. If you mix declarative and imperative coding styles, your code will be more brittle. If you write code that materializes a collection so that these problems are avoided, note it with comments as appropriate in your code, so that maintenance programmers will understand the issue. + +If performance and other considerations allow, use only declarative code. Don't modify your existing XML tree. Instead, generate a new one as shown in the following example: + +```csharp +XElement root = new XElement("Root", + new XElement("A", "1"), + new XElement("B", "2"), + new XElement("C", "3") +); +XElement newRoot = new XElement("Root", + root.Elements(), + root.Elements() +); +Console.WriteLine(newRoot); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + +Dim newRoot As XElement = New XElement("Root", _ + root.Elements(), root.Elements()) +Console.WriteLine(newRoot) +``` diff --git a/docs/csharp/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md b/docs/standard/linq/modify-elements-attributes-nodes-xml-tree.md similarity index 65% rename from docs/csharp/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md rename to docs/standard/linq/modify-elements-attributes-nodes-xml-tree.md index b71d7528d1d72..b1e7f0631db15 100644 --- a/docs/csharp/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md +++ b/docs/standard/linq/modify-elements-attributes-nodes-xml-tree.md @@ -4,38 +4,40 @@ description: Learn about methods and properties that you can use to modify an el ms.date: 07/20/2015 ms.assetid: 0ed22e4e-4c6b-4eb1-b0eb-06685efd8c33 --- -# Modifying Elements, Attributes, and Nodes in an XML Tree -The following table summarizes the methods and properties that you can use to modify an element, its child elements, or its attributes. - - The following methods modify an . - -|Method|Description| -|------------|-----------------| -||Replaces an element with parsed XML.| -||Removes all content (child nodes and attributes) of an element.| -||Removes the attributes of an element.| -||Replaces all content (child nodes and attributes) of an element.| -||Replaces the attributes of an element.| -||Sets the value of an attribute. Creates the attribute if it doesn't exist. If the value is set to `null`, removes the attribute.| -||Sets the value of a child element. Creates the element if it doesn't exist. If the value is set to `null`, removes the element.| -||Replaces the content (child nodes) of an element with the specified text.| -||Sets the value of an element.| - - The following methods modify an . - -|Method|Description| -|------------|-----------------| -||Sets the value of an attribute.| -||Sets the value of an attribute.| - - The following methods modify an (including an or ). - -|Method|Description| -|------------|-----------------| -||Replaces a node with new content.| - - The following methods modify an (an or ). - -|Method|Description| -|------------|-----------------| -||Replaces the children nodes with new content.| + +# Modify elements, attributes, and nodes in an XML tree (LINQ to XML) + +The following table summarizes the methods and properties that you can use to modify an element, its child elements, or its attributes. + +The following methods modify an : + +|Method|Description| +|------------|-----------------| +||Replaces an element with parsed XML.| +||Removes all content (child nodes and attributes) of an element.| +||Removes the attributes of an element.| +||Replaces all content (child nodes and attributes) of an element.| +||Replaces the attributes of an element.| +||Sets the value of an attribute. Creates the attribute if it doesn't exist. If the value is set to `null`, removes the attribute.| +||Sets the value of a child element. Creates the element if it doesn't exist. If the value is set to `null`, removes the element.| +||Replaces the content (child nodes) of an element with the specified text.| +||Sets the value of an element.| + +The following methods modify an : + +|Method|Description| +|------------|-----------------| +||Sets the value of an attribute.| +||Sets the value of an attribute.| + + The following methods modify an (including an or ): + +|Method|Description| +|------------|-----------------| +||Replaces a node with new content.| + + The following methods modify an (an or ): + +|Method|Description| +|------------|-----------------| +||Replaces the children nodes with new content:| diff --git a/docs/standard/linq/modify-office-open-xml-document.md b/docs/standard/linq/modify-office-open-xml-document.md new file mode 100644 index 0000000000000..e115c9815bc9d --- /dev/null +++ b/docs/standard/linq/modify-office-open-xml-document.md @@ -0,0 +1,270 @@ +--- +title: How to modify an Office Open XML document - LINQ to XML +description: This article presents an example for C# and Visual Basic that opens an Office Open XML document, modifies it, and saves it. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 467d489c-2b1b-453b-a757-8ac180e82a96 +--- +# How to modify an Office Open XML document (LINQ to XML) + +This article presents an example for C# and Visual Basic that opens an Office Open XML document, modifies it, and saves it. + +For more information on Office Open XML, see [Open XML SDK](https://github.com/OfficeDev/Open-XML-SDK) and [www.ericwhite.com](http://ericwhite.com/). + +## Example + +This example finds the first paragraph element in the document. It retrieves the text from the paragraph, and deletes all text runs. It creates a new text run that consists of the text of the first paragraph converted to upper case. It then serializes the changed XML into the Open XML package and closes it. + +The example operates on Office Open XML document described in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +It makes use of the following: + +- The `StringConcatenate` extension method, defined as part of the example. +- Classes found in the WindowsBase assembly. +- Types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite)) + { + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + XDocument xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + PackagePart stylePart = null; + XDocument styleDoc = null; + + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + + XElement paraNode = xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + .FirstOrDefault(); + + string paraText = ParagraphText(paraNode); + + // remove all text runs + paraNode.Descendants(w + "r").Remove(); + + paraNode.Add( + new XElement(w + "r", + new XElement(w + "t", paraText.ToUpper()) + ) + ); + + // Save the XML into the package + using (XmlWriter xw = + XmlWriter.Create(documentPart.GetStream(FileMode.Create, FileAccess.Write))) + { + xDoc.Save(xw); + } + + Console.WriteLine("New first paragraph: >{0}<", paraText.ToUpper()); + } + } + } +} +``` + +```vb +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + Public Function ParagraphText(ByVal e As XElement) As String + Dim w As XNamespace = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ + ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite) + Dim docPackageRelationship As PackageRelationship = wdPackage _ + .GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", _ + UriKind.Relative), docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + Dim xDoc As XDocument = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = documentPart _ + .GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + Dim stylePart As PackagePart = Nothing + Dim styleDoc As XDocument = Nothing + + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = PackUriHelper.ResolvePartUri( _ + documentUri, styleRelation.TargetUri) + stylePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + + Dim paraNode As XElement = xDoc.Root.....FirstOrDefault() + + Dim paraText As String = ParagraphText(paraNode) + + ' Remove all text runs. + paraNode....Remove() + + paraNode.Add(<%= paraText.ToUpper() %>) + + ' Save the XML into the package. + Using xw As XmlWriter = _ + XmlWriter.Create(documentPart.GetStream(FileMode.Create, FileAccess.Write)) + xDoc.Save(xw) + End Using + + Console.WriteLine("New first paragraph: >{0}<", paraText.ToUpper()) + End If + End Using + End Sub +End Module +``` + +This example produces the following output: + +```output +New first paragraph: >PARSING WORDPROCESSINGML WITH LINQ TO XML< +``` + +If you open `SampleDoc.docx` after running this program, you can see that this program converted the first paragraph in the document to upper case. diff --git a/docs/standard/linq/namespaces-overview.md b/docs/standard/linq/namespaces-overview.md new file mode 100644 index 0000000000000..b66967464f192 --- /dev/null +++ b/docs/standard/linq/namespaces-overview.md @@ -0,0 +1,22 @@ +--- +title: Namespaces overview - LINQ to XML +description: Learn about XML names, XML namespaces, and XML namespace prefixes, and about the XName and XNamespace classes. +ms.date: 07/20/2015 +ms.assetid: 16283322-8238-4918-ab11-802ac6748eb7 +--- + +# Namespaces overview (LINQ to XML) + +This article introduces *XML names*, *XML namespaces*, *XML namespace prefixes*, and the and classes. + +XML names are often a source of complexity in XML programming. An XML name consists of an XML namespace (also called an XML namespace URI) and a local name. An XML namespace is similar to a namespace in a .NET program. It enables you to uniquely qualify the names of elements and attributes to avoid name conflicts between various parts of an XML document. When you've declared an XML namespace, you can select a local name that only has to be unique within that namespace. + +Another aspect of XML names is XML namespace prefixes, which cause most of the complexity of XML names. These prefixes enable you to create a shortcut for an XML namespace, which makes the XML document more concise and understandable. However, the meaning of an XML prefix depends on context, which adds complexity. For example, the XML prefix `aw` could be associated with one XML namespace in part of an XML tree, and with a different namespace in another part. + +One of the advantages of using LINQ to XML with C# is that you don't have to use XML prefixes. When LINQ to XML loads or parses an XML document, each XML prefix is resolved to its corresponding XML namespace. After that, when you work with a document that uses namespaces, you almost always access the namespaces through the namespace URI, and not through the namespace prefix. When developers work with XML names in LINQ to XML they always work with a fully-qualified XML name (that is, an XML namespace and a local name). However, LINQ to XML does allow you to work with and control namespace prefixes as needed. + +When using LINQ to XML with Visual Basic and XML literals, you must use namespace prefixes when working with documents in namespaces. + +In LINQ to XML, the class that represents XML names is . XML names appear frequently throughout the LINQ to XML API, and wherever an XML name is required, you will find an parameter. However, you rarely work directly with an . contains an implicit conversion from string. + +For more information, see and . diff --git a/docs/standard/linq/parse-string.md b/docs/standard/linq/parse-string.md new file mode 100644 index 0000000000000..e7db69c619039 --- /dev/null +++ b/docs/standard/linq/parse-string.md @@ -0,0 +1,99 @@ +--- +title: How to parse a string - LINQ to XML +description: You can parse a string with XElement.Parse to create an XML tree in C# and Visual Basic, and you can create an XML tree with XML literals in Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 81e5686c-9658-42d8-a7e3-b11be0a2c98b +--- + +# How to parse a string (LINQ to XML) + +This article shows how to parse a string to create an XML tree in C# and in Visual Basic. + +## Example + +The following C# code shows how to parse an XML string: + +```csharp +XElement contacts = XElement.Parse( + @" + + Patrick Hines + 206-555-0144 + 425-555-0145 +
+ 123 Main St + Mercer Island + WA + 68042 +
+ 10 +
+ + Gretchen Rivas + 206-555-0163 +
+ 123 Main St + Mercer Island + WA + 68042 +
+ 11 +
+
"); +Console.WriteLine(contacts); +``` + +You can parse a string in Visual Basic in a similar manner. However, it's more efficient to use XML literals, as shown in following code, because XML literals don't suffer from the same performance penalties as parsing XML from a string. + +By using XML literals, you can just copy and paste your XML into your Visual Basic program. + +> [!NOTE] +> Parsing text or loading an XML document from a text file is less efficient than functional construction. If you're initializing an XML tree from code, it takes less processor time to use functional construction than to parse text. + +```vb +Dim contacts as XElement = _ + + + Patrick Hines + 206-555-0144 + 425-555-0145 +
+ 123 Main St + Mercer Island + WA + 68042 +
+ 10 +
+ + Gretchen Rivas + 206-555-0163 +
+ 123 Main St + Mercer Island + WA + 68042 +
+ 11 +
+
+``` + +The root `Contacts` node has two `Contact` nodes. To access some specific data in your parsed XML, use the [XElement.Elements()](xref:System.Xml.Linq.XContainer.Elements) method, which in this case returns the child elements of the root `Contacts` node. The following example prints the first `Contact` node to the console: + +```csharp +List contactNodes = contacts.Elements("Contact").ToList(); +Console.WriteLine(contactNodes[0]); +``` + +```vb +Dim contactNodes As List(Of XElement) = contacts.Elements("Contact").ToList() +Console.WriteLine(contactNodes(0)) +``` + +## See also + +- [How to find an element with a specific attribute](find-element-specific-attribute.md) diff --git a/docs/standard/linq/perform-streaming-transform-large-xml-documents.md b/docs/standard/linq/perform-streaming-transform-large-xml-documents.md new file mode 100644 index 0000000000000..26347ca10641b --- /dev/null +++ b/docs/standard/linq/perform-streaming-transform-large-xml-documents.md @@ -0,0 +1,584 @@ +--- +title: How to perform streaming transform of large XML documents - LINQ to XML +description: Learn how to perform streaming transform of large XML documents to achieve a small memory footprint. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 5f16d1f8-5370-4b55-b0c8-e497df163037 +--- + +# How to perform streaming transform of large XML documents (LINQ to XML) + +Sometimes you have to transform large XML files, and write your application so that the memory footprint of the application is predictable. If you try to populate an XML tree with a very large XML file, your memory usage will be proportional to the size of the file (that is, excessive). Therefore, you should use a streaming technique instead. + +Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. Note that if you use a query operator that materializes its source before yielding the first item, you won't retain a small memory footprint for your application. + +Even if you use the technique described in [How to stream XML fragments with access to header information](stream-xml-fragments-access-header-information.md), if you try to assemble an XML tree that contains the transformed document, memory usage will be too great. + +There are two main approaches. One approach is to use the deferred processing characteristics of . Another approach is to create an , and use the capabilities of LINQ to XML to write elements to an . This article demonstrates both approaches. + +## Example: Use the deferred execution capabilities of `XStreamingElement` to stream the output + +The following example builds on the example in [How to stream XML fragments with access to header information](stream-xml-fragments-access-header-information.md). + +This example uses the deferred execution capabilities of to stream the output. This example can transform a very large document while maintaining a small memory footprint. + +Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would be prepared to parse an invalid document. + +The following is the source document, Source.xml: + +```xml + + + + A. Datum Corporation + + 0001 + + + 0002 + + + 0003 + + + 0004 + + + + Fabrikam, Inc. + + 0005 + + + 0006 + + + 0007 + + + 0008 + + + + Southridge Video + + 0009 + + + 0010 + + + +``` + +```csharp +static IEnumerable StreamCustomerItem(string uri) +{ + using (XmlReader reader = XmlReader.Create(uri)) + { + XElement name = null; + XElement item = null; + + reader.MoveToContent(); + + // Parse the file, save header information when encountered, and yield the + // Item XElement objects as they're created. + // Loop through Customer elements. + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Customer") + { + // move to Name element + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element && + reader.Name == "Name") + { + name = XElement.ReadFrom(reader) as XElement; + break; + } + } + + // loop through Item elements + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.EndElement) + break; + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Item") + { + item = XElement.ReadFrom(reader) as XElement; + if (item != null) + { + XElement tempRoot = new XElement("Root", + new XElement(name) + ); + tempRoot.Add(item); + yield return item; + } + } + } + } + } + } +} + +static void Main(string[] args) +{ + XStreamingElement root = new XStreamingElement("Root", + from el in StreamCustomerItem("Source.xml") + select new XElement("Item", + new XElement("Customer", (string)el.Parent.Element("Name")), + new XElement(el.Element("Key")) + ) + ); + root.Save("Test.xml"); + Console.WriteLine(File.ReadAllText("Test.xml")); +} +``` + +```vb +Module Module1 + Sub Main() + Dim root = New XStreamingElement("Root", + From el In New StreamCustomerItem("Source.xml") + Select + <%= el.Parent..Value %> + <%= el. %> + + ) + root.Save("Test.xml") + Console.WriteLine(My.Computer.FileSystem.ReadAllText("Test.xml")) + End Sub +End Module + +Public Class StreamCustomerItem + Implements IEnumerable(Of XElement) + + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + End Sub + + Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator + Return New StreamCustomerItemEnumerator(_uri) + End Function + + Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator + Return Me.GetEnumerator() + End Function +End Class + +Public Class StreamCustomerItemEnumerator + Implements IEnumerator(Of XElement) + + Private _current As XElement + Private _customerName As String + Private _reader As Xml.XmlReader + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + + Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current + Get + Return _current + End Get + End Property + + Public ReadOnly Property Current1 As Object Implements IEnumerator.Current + Get + Return Me.Current + End Get + End Property + + Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext + Dim item As XElement + Dim name As XElement + + ' Parse the file, save header information when encountered, and return the + ' current Item XElement. + + ' loop through Customer elements + While _reader.Read() + If _reader.NodeType = Xml.XmlNodeType.Element Then + Select Case _reader.Name + Case "Customer" + ' move to Name element + While _reader.Read() + + If _reader.NodeType = Xml.XmlNodeType.Element AndAlso + _reader.Name = "Name" Then + + name = TryCast(XElement.ReadFrom(_reader), XElement) + _customerName = If(name IsNot Nothing, name.Value, "") + Exit While + End If + + End While + Case "Item" + item = TryCast(XElement.ReadFrom(_reader), XElement) + Dim tempRoot = + <%= _customerName %> + <%= item %> + + _current = item + Return True + End Select + End If + End While + + Return False + End Function + + Public Sub Reset() Implements IEnumerator.Reset + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + +#Region "IDisposable Support" + Private disposedValue As Boolean ' To detect redundant calls + + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + _reader.Close() + End If + End If + Me.disposedValue = True + End Sub + + Public Sub Dispose() Implements IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + +End Class +``` + +This example produces the following output: + +```xml + + + + A. Datum Corporation + 0001 + + + A. Datum Corporation + 0002 + + + A. Datum Corporation + 0003 + + + A. Datum Corporation + 0004 + + + Fabrikam, Inc. + 0005 + + + Fabrikam, Inc. + 0006 + + + Fabrikam, Inc. + 0007 + + + Fabrikam, Inc. + 0008 + + + Southridge Video + 0009 + + + Southridge Video + 0010 + + +``` + +## Example: Use LINQ to XML to write elements to an XmlWriter + +The following example also builds on the example in [How to stream XML fragments with access to header information](stream-xml-fragments-access-header-information.md). + +This example uses the capability of LINQ to XML to write elements to an . This example can transform a very large document while maintaining a small memory footprint. + +Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would either validate the source document with an XSD, or would be prepared to parse an invalid document. + +This example uses the same source document, Source.xml, as the previous example. It also produces exactly the same output. + +Using for streaming the output XML is preferred to writing to an . + +```csharp +static IEnumerable StreamCustomerItem(string uri) +{ + using (XmlReader reader = XmlReader.Create(uri)) + { + XElement name = null; + XElement item = null; + + reader.MoveToContent(); + + // Parse the file, save header information when encountered, and yield the + // Item XElement objects as they're created. + // Loop through Customer elements. + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Customer") + { + // move to Name element + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element && + reader.Name == "Name") + { + name = XElement.ReadFrom(reader) as XElement; + break; + } + } + + // Loop through Item elements + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.EndElement) + break; + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Item") + { + item = XElement.ReadFrom(reader) as XElement; + if (item != null) { + XElement tempRoot = new XElement("Root", + new XElement(name) + ); + tempRoot.Add(item); + yield return item; + } + } + } + } + } + } +} + +static void Main(string[] args) +{ + IEnumerable srcTree = + from el in StreamCustomerItem("Source.xml") + select new XElement("Item", + new XElement("Customer", (string)el.Parent.Element("Name")), + new XElement(el.Element("Key")) + ); + XmlWriterSettings xws = new XmlWriterSettings(); + xws.OmitXmlDeclaration = true; + xws.Indent = true; + using (XmlWriter xw = XmlWriter.Create("Output.xml", xws)) { + xw.WriteStartElement("Root"); + foreach (XElement el in srcTree) + el.WriteTo(xw); + xw.WriteEndElement(); + } + + string str = File.ReadAllText("Output.xml"); + Console.WriteLine(str); +} +``` + +```vb +Module Module1 + Sub Main() + Dim srcTree = + From el In New StreamCustomerItem("Source.xml") + Select + <%= el.Parent..Value %> + <%= el. %> + + + Dim xws = New Xml.XmlWriterSettings() + xws.OmitXmlDeclaration = True + xws.Indent = True + Using xw = Xml.XmlWriter.Create("Output.xml", xws) + xw.WriteStartElement("Root") + For Each el In srcTree + el.WriteTo(xw) + Next + xw.WriteEndElement() + End Using + + Dim s = My.Computer.FileSystem.ReadAllText("Output.xml") + Console.WriteLine(s) + End Sub +End Module + +Public Class StreamCustomerItem + Implements IEnumerable(Of XElement) + + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + End Sub + + Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator + Return New StreamCustomerItemEnumerator(_uri) + End Function + + Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator + Return Me.GetEnumerator() + End Function +End Class + +Public Class StreamCustomerItemEnumerator + Implements IEnumerator(Of XElement) + + Private _current As XElement + Private _customerName As String + Private _reader As Xml.XmlReader + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + + Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current + Get + Return _current + End Get + End Property + + Public ReadOnly Property Current1 As Object Implements IEnumerator.Current + Get + Return Me.Current + End Get + End Property + + Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext + Dim item As XElement + Dim name As XElement + + ' Parse the file, save header information when encountered, and return the + ' current Item XElement. + + ' loop through Customer elements + While _reader.Read() + If _reader.NodeType = Xml.XmlNodeType.Element Then + Select Case _reader.Name + Case "Customer" + ' move to Name element + While _reader.Read() + + If _reader.NodeType = Xml.XmlNodeType.Element AndAlso + _reader.Name = "Name" Then + + name = TryCast(XElement.ReadFrom(_reader), XElement) + _customerName = If(name IsNot Nothing, name.Value, "") + Exit While + End If + + End While + Case "Item" + item = TryCast(XElement.ReadFrom(_reader), XElement) + Dim tempRoot = + <%= _customerName %> + <%= item %> + + _current = item + Return True + End Select + End If + End While + + Return False + End Function + + Public Sub Reset() Implements IEnumerator.Reset + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + +#Region "IDisposable Support" + Private disposedValue As Boolean ' To detect redundant calls + + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + _reader.Close() + End If + End If + Me.disposedValue = True + End Sub + + Public Sub Dispose() Implements IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + +End Class +``` + +This example produces the following output: + +```xml + + + A. Datum Corporation + 0001 + + + A. Datum Corporation + 0002 + + + A. Datum Corporation + 0003 + + + A. Datum Corporation + 0004 + + + Fabrikam, Inc. + 0005 + + + Fabrikam, Inc. + 0006 + + + Fabrikam, Inc. + 0007 + + + Fabrikam, Inc. + 0008 + + + Southridge Video + 0009 + + + Southridge Video + 0010 + + +``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transformations-of-text-to-xml.md b/docs/standard/linq/perform-streaming-transformations-text-xml.md similarity index 51% rename from docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transformations-of-text-to-xml.md rename to docs/standard/linq/perform-streaming-transformations-text-xml.md index 750f7f36e2396..0fd21971b70dd 100644 --- a/docs/csharp/programming-guide/concepts/linq/how-to-perform-streaming-transformations-of-text-to-xml.md +++ b/docs/standard/linq/perform-streaming-transformations-text-xml.md @@ -1,18 +1,24 @@ --- -title: "How to perform streaming transformations of text to XML (C#)" -description: Learn how to do a streaming transformation of text to XML in C#, where you stream the text file a line at a time and use a LINQ query to process the text file. +title: How to perform streaming transformations of text to XML in C# - LINQ to XML +description: You can use an extension method that releases a line at a time to stream a text file for processing. This technique reduces memory requirements compared to techniques which load the entire file and then process it. ms.date: 07/20/2015 +dev_langs: + - "csharp" ms.assetid: 9b3bd941-d0ff-4f2d-ae41-7c3b81d8fae6 --- -# How to perform streaming transformations of text to XML (C#) -One approach to processing a text file is to write an extension method that streams the text file a line at a time using the `yield return` construct. You then can write a LINQ query that processes the text file in a lazy deferred fashion. If you then use to stream output, you then can create a transformation from the text file to XML that uses a minimal amount of memory, regardless of the size of the source text file. +# How to perform streaming transformations of text to XML in C# (LINQ to XML) - There are some caveats regarding streaming transformations. A streaming transformation is best applied in situations where you can process the entire file once, and if you can process the lines in the order that they occur in the source document. If you have to process the file more than once, or if you have to sort the lines before you can process them, you will lose many of the benefits of using a streaming technique. +You can use an extension method that releases a line at a time to stream a text file for processing. This technique reduces memory requirements compared to techniques which load the entire file and then process it. -## Example +The extension method can provide the line using the `yield return` construct. A LINQ query can process the stream in a lazy deferred fashion. If you use to stream output, you can create a transformation from the text file to XML that uses a minimal amount of memory, regardless of the size of the source text file. - The following text file, People.txt, is the source for this example. +> [!NOTE] +> The technique is best applied in situations in which you can process the entire file once, taking the lines in order from the source document. Processing the file more than once, or sorting before processing, reduces the performance benefits of a streaming technique. + +## Example Use an extension method to stream text + +The example uses the following text file, People.txt, as its source: ```text #This is a comment @@ -21,7 +27,7 @@ One approach to processing a text file is to write an extension method that stre 3,David,Wright,Inventor ``` - The following code contains an extension method that streams the lines of the text file in a deferred fashion. +In the code for the example, extension method `Lines` provides the text a line at a time: ```csharp public static class StreamReaderSequence @@ -61,7 +67,7 @@ class Program } ``` - This example produces the following output: +The example produces the following output: ```xml diff --git a/docs/csharp/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md b/docs/standard/linq/performance-chained-queries.md similarity index 56% rename from docs/csharp/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md rename to docs/standard/linq/performance-chained-queries.md index 772e1a3e9bffe..b94bd337d1b98 100644 --- a/docs/csharp/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md +++ b/docs/standard/linq/performance-chained-queries.md @@ -1,12 +1,16 @@ --- -title: "Performance of Chained Queries (LINQ to XML) (C#)" -description: Learn about the performance of chained queries. A chained query is a query that uses another query as its source. +title: Performance of chained queries - LINQ to XML +description: Learn about chained queries can perform as well as a single larger, more complicated query. ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" ms.assetid: b2f1d715-8946-4dc0-8d56-fb3d1bba54a6 --- -# Performance of Chained Queries (LINQ to XML) (C#) -One of the most important benefits of LINQ (and LINQ to XML) is that chained queries can perform as well as a single larger, more complicated query. +# Performance of chained queries (LINQ to XML) + +One of the most important benefits of LINQ (and LINQ to XML) is that chained queries can perform as well as a single query that is larger and more complicated than the chained queries. A chained query is a query that uses another query as its source. For example, in the following simple code, `query2` has `query1` as its source: @@ -30,6 +34,18 @@ foreach (var i in query2) Console.WriteLine("{0}", (int)i); ``` +```vb +Dim root As New XElement("Root", New XElement("Child", 1), New XElement("Child", 2), New XElement("Child", 3), New XElement("Child", 4)) + +Dim query1 = From x In root.Elements("Child") Where CInt(x) >= 3x + +Dim query2 = From e In query1 Where CInt(e) Mod 2 = 0e + +For Each i As var In query2 + Console.WriteLine("{0}", CInt(i)) +Next +``` + This example produces the following output: ```output @@ -39,15 +55,12 @@ This example produces the following output: This chained query provides the same performance profile as iterating through a linked list. - The axis has essentially the same performance as iterating through a linked list. is implemented as an iterator with deferred execution. This means that it does some work in addition to iterating through the linked list, such as allocating the iterator object and keeping track of execution state. This work can be divided into two categories: the work that is done at the time the iterator is set up, and the work that is done during each iteration. The setup work is a small, fixed amount of work and the work done during each iteration is proportional to the number of items in the source collection. - -- In `query1`, the `where` clause causes the query to call the method. This method is also implemented as an iterator. The setup work consists of instantiating the delegate that will reference the lambda expression, plus the normal setup for an iterator. With each iteration, the delegate is called to execute the predicate. The setup work and the work done during each iteration is the similar to the work done while iterating through the axis. - +- In `query1`, the `where` clause (`Where` in Visual Basic) causes the query to call the method. This method is also implemented as an iterator. The setup work consists of instantiating the delegate that will reference the lambda expression, plus the normal setup for an iterator. With each iteration, the delegate is called to execute the predicate. The setup work and the work done during each iteration is similar to the work done while iterating through the axis. - In `query1`, the select clause causes the query to call the method. This method has the same performance profile as the method. +- In `query2`, both the `where` clause (`Where` in Visual Basic) and the `select` clause have the same performance profile as in `query1`. -- In `query2`, both the `where` clause and the `select` clause have the same performance profile as in `query1`. - -The iteration through `query2` is therefore directly proportional to the number of items in the source of the first query, in other words, linear time. A corresponding Visual Basic example would have the same performance profile. +The iteration through `query2` is therefore directly proportional to the number of items in the source of the first query, in other words, linear time. -For more information on iterators, see [yield](../../../language-reference/keywords/yield.md). +For more information on iterators, see [yield](../../csharp/language-reference/keywords/yield.md). -For a more detailed tutorial on chaining queries together, see [Tutorial: Chaining Queries Together](./deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). +For a more detailed tutorial on chaining queries together, see [Tutorial: Chain queries together (C#)](chain-queries-example.md). diff --git a/docs/standard/linq/populate-xml-tree-file-system.md b/docs/standard/linq/populate-xml-tree-file-system.md new file mode 100644 index 0000000000000..6350ada4ef8e6 --- /dev/null +++ b/docs/standard/linq/populate-xml-tree-file-system.md @@ -0,0 +1,147 @@ +--- +title: How to populate an XML tree from the file system - LINQ to XML +description: Learn how to populate an XML tree from the file system in C# or Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 2aa2ccac-4a22-47ae-9107-3bb8df232576 +--- + +# How to populate an XML tree from the file system (LINQ to XML) + +A common and useful application of XML trees is as a hierarchical name-value data store. You can populate an XML tree with hierarchical data, and then query it, transform it, and if necessary, serialize it. For this use, many of the XML-specific semantics, such as namespaces and white space behavior, aren't important. Instead, you're using the XML tree as a small, in-memory, single-user hierarchical database. + +## Example: Populate an XML tree and then query it + +The following example uses recursion to populate an XML tree with data about the files in the local file system. It then queries the tree, totalling all the file sizes. + +```csharp +class Program +{ + static XElement CreateFileSystemXmlTree(string source) + { + DirectoryInfo di = new DirectoryInfo(source); + return new XElement("Dir", + new XAttribute("Name", di.Name), + from d in Directory.GetDirectories(source) + select CreateFileSystemXmlTree(d), + from fi in di.GetFiles() + select new XElement("File", + new XElement("Name", fi.Name), + new XElement("Length", fi.Length) + ) + ); + } + + static void Main(string[] args) + { + XElement fileSystemTree = CreateFileSystemXmlTree("C:/Tmp"); + Console.WriteLine(fileSystemTree); + Console.WriteLine("------"); + long totalFileSize = + (from f in fileSystemTree.Descendants("File") + select (long)f.Element("Length")).Sum(); + Console.WriteLine("Total File Size:{0}", totalFileSize); + } +} +``` + +```vb +Module Module1 + Function CreateFileSystemXmlTree(ByVal source As String) As XElement + Dim di As DirectoryInfo = New DirectoryInfo(source) + Return > + <%= From d In Directory.GetDirectories(source) _ + Select CreateFileSystemXmlTree(d) %> + <%= From fi In di.GetFiles() _ + Select + <%= fi.Name %> + <%= fi.Length %> + %> + + End Function + + Sub Main() + Dim fileSystemTree As XElement = CreateFileSystemXmlTree("C:/Tmp") + Console.WriteLine(fileSystemTree) + Console.WriteLine("------") + Dim totalFileSize As Long = _ + ( _ + From f In fileSystemTree... _ + Select CLng(f.(0)) _ + ).Sum() + Console.WriteLine("Total File Size:{0}", totalFileSize) + End Sub +End Module +``` + +The example produces output similar to the following: + +```xml + + + + + + ConsoleApplication1.exe + 4608 + + + ConsoleApplication1.pdb + 11776 + + + ConsoleApplication1.vshost.exe + 9568 + + + ConsoleApplication1.vshost.exe.manifest + 473 + + + + + + + + ConsoleApplication1.csproj.FileListAbsolute.txt + 322 + + + ConsoleApplication1.exe + 4608 + + + ConsoleApplication1.pdb + 11776 + + + + + + AssemblyInfo.cs + 1454 + + + + ConsoleApplication1.csproj + 2546 + + + ConsoleApplication1.sln + 937 + + + ConsoleApplication1.suo + 10752 + + + Program.cs + 269 + + + +------ +Total File Size:59089 +``` diff --git a/docs/standard/linq/populate-xml-tree-xmlwriter.md b/docs/standard/linq/populate-xml-tree-xmlwriter.md new file mode 100644 index 0000000000000..8131ce0bfea6e --- /dev/null +++ b/docs/standard/linq/populate-xml-tree-xmlwriter.md @@ -0,0 +1,113 @@ +--- +title: How to populate an XML tree with an XmlWriter - LINQ to XML +description: To populate an XML tree in C# and Visual Basic, create an XMLWriter using CreateWriter, then write to the XmlWriter. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: cd5674d1-5c54-4efc-ba68-e23b2875295f +--- + +# How to populate an XML tree with an XmlWriter (LINQ to XML) + +One way to populate an XML tree is to use to create an , and then write to the . The XML tree is populated with all nodes that are written to the . + +You'd typically use this method when you use LINQ to XML with another class that expects to write to an , such as . + +## Example: Create an XmlWriter to accept the output of an XSLT transformation + +You can use to create an to accept the output of an XSLT transformation. This is shown in the following example, which does the following: + +- Creates an XML tree and an to read from it. +- Creates a new tree and an to write to it. +- Invokes the XSLT transformation, providing it with the and the . + +The transformation then populates the new tree. + +```csharp +string xslMarkup = @" + + + + + + + + + + + +"; + +XDocument xmlTree = new XDocument( + new XElement("Parent", + new XElement("Child1", "Child1 data"), + new XElement("Child2", "Child2 data") + ) +); + +XDocument newTree = new XDocument(); +using (XmlWriter writer = newTree.CreateWriter()) +{ + // Load the style sheet. + XslCompiledTransform xslt = new XslCompiledTransform(); + xslt.Load(XmlReader.Create(new StringReader(xslMarkup))); + + // Execute the transformation and output the results to a writer. + xslt.Transform(xmlTree.CreateReader(), writer); +} + +Console.WriteLine(newTree); +``` + +```vb +Dim xslMarkup As XDocument = _ + + + + + + + + + + + + + + +Dim xmlTree As XDocument = _ + + + Child1 data + Child2 data + + +Dim newTree As XDocument = New XDocument() +Using writer As XmlWriter = newTree.CreateWriter() + ' Load the style sheet. + Dim xslt As XslCompiledTransform = New XslCompiledTransform() + xslt.Load(xslMarkup.CreateReader()) + + ' Execute the transformation and output the results to a writer. + xslt.Transform(xmlTree.CreateReader(), writer) +End Using + +Console.WriteLine(newTree) +``` + +This example produces the following output: + +```xml + + Child1 data + Child2 data + +``` + +## See also + +- +- +- +- [XML trees](functional-construction.md) diff --git a/docs/standard/linq/pre-atomization-xname-objects.md b/docs/standard/linq/pre-atomization-xname-objects.md new file mode 100644 index 0000000000000..15c588ea78381 --- /dev/null +++ b/docs/standard/linq/pre-atomization-xname-objects.md @@ -0,0 +1,169 @@ +--- +title: Pre-Atomization of XName objects - LINQ to XML +description: Learn how to pre-atomize to improve performance when you create a large number of elements with the same name. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: e84fbbe7-f072-4771-bfbb-059d18e1ad15 +--- + +# Pre-Atomization of XName objects (LINQ to XML) + +One way to improve performance in LINQ to XML is to pre-atomize objects. Pre-atomization means that you assign a string to an object before you create the XML tree by using the constructors of the and classes. Then, instead of passing a string to the constructor, which would use the implicit conversion from string to , you pass the initialized object. + +This improves performance when you create a large XML tree in which names are repeated. To do this, you declare and initialize objects before you construct the XML tree, and then use the objects instead of specifying strings for the element and attribute names. This technique can yield significant performance gains if you're creating a large number of elements or attributes with the same name. + +You should test pre-atomization with your scenario to decide if you should use it. + +## Example: Create elements in various ways, with and without pre-atomization + +The following example demonstrates pre-atomization. + +```csharp +XName Root = "Root"; +XName Data = "Data"; +XName ID = "ID"; + +XElement root = new XElement(Root, + new XElement(Data, + new XAttribute(ID, "1"), + "4,100,000"), + new XElement(Data, + new XAttribute(ID, "2"), + "3,700,000"), + new XElement(Data, + new XAttribute(ID, "3"), + "1,150,000") +); + +Console.WriteLine(root); +``` + +```vb +Dim root1 As XName = "Root" +Dim data As XName = "Data" +Dim id As XName = "ID" + +Dim root2 As New XElement(root1, New XElement(data, New XAttribute(id, "1"), "4,100,000"), + New XElement(data, New XAttribute(id, "2"), "3,700,000"), + New XElement(data, New XAttribute(id, "3"), "1,150,000")) + +Console.WriteLine(root2) +``` + +This example produces the following output: + +```xml + + 4,100,000 + 3,700,000 + 1,150,000 + +``` + +The following example shows the same technique for an XML document in a namespace: + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XName Root = aw + "Root"; +XName Data = aw + "Data"; +XName ID = "ID"; + +XElement root = new XElement(Root, + new XAttribute(XNamespace.Xmlns + "aw", aw), + new XElement(Data, + new XAttribute(ID, "1"), + "4,100,000"), + new XElement(Data, + new XAttribute(ID, "2"), + "3,700,000"), + new XElement(Data, + new XAttribute(ID, "3"), + "1,150,000") +); + +Console.WriteLine(root); +``` + +```vb +Dim aw As XNamespace = "http://www.adventure-works.com" +Dim root1 As XName = aw + "Root" +Dim data As XName = aw + "Data" +Dim id As XName = "ID" + +Dim root2 As New XElement(root1, New XAttribute(XNamespace.Xmlns + "aw", aw), + New XElement(data, New XAttribute(id, "1"), "4,100,000"), + New XElement(data, New XAttribute(id, "2"), "3,700,000"), + New XElement(data, New XAttribute(id, "3"), "1,150,000")) + +Console.WriteLine(root2) +``` + +This example produces the following output: + +```xml + + 4,100,000 + 3,700,000 + 1,150,000 + +``` + +The following example is more similar to what you will likely encounter in the real world. In this example, the content of the element is supplied by a query: + +```csharp +XName Root = "Root"; +XName Data = "Data"; +XName ID = "ID"; + +DateTime t1 = DateTime.Now; +XElement root = new XElement(Root, + from i in System.Linq.Enumerable.Range(1, 100000) + select new XElement(Data, + new XAttribute(ID, i), + i * 5) +); +DateTime t2 = DateTime.Now; + +Console.WriteLine("Time to construct:{0}", t2 - t1); +``` + +```vb +Dim root1 As XName = "Root" +Dim data As XName = "Data" +Dim id As XName = "ID" + +Dim sw As Stopwatch = Stopwatch.StartNew() +Dim root2 As New XElement(root1, From i In Enumerable.Range(1, 100000) + Select New XElement(data, New XAttribute(ID, i), i * 5)) +sw.Stop() +Console.WriteLine($"Time to construct: {sw.ElapsedMilliseconds} milliseconds") +``` + +The previous example performs better than the following example, in which names aren't pre-atomized: + +```csharp +DateTime t1 = DateTime.Now; +XElement root = new XElement("Root", + from i in System.Linq.Enumerable.Range(1, 100000) + select new XElement("Data", + new XAttribute("ID", i), + i * 5) +); +DateTime t2 = DateTime.Now; + +Console.WriteLine("Time to construct:{0}", t2 - t1); +``` + +```vb +Dim sw As Stopwatch = Stopwatch.StartNew() +Dim root As New XElement("Root", From i In Enumerable.Range(1, 100000) + Select New XElement("Data", New XAttribute("ID", i), i * 5)) +sw.Stop() +Console.WriteLine($"Time to construct: {sw.ElapsedMilliseconds} milliseconds") +``` + +## See also + +- [Atomized XName and XNamespace objects](atomized-xname-xnamespace-objects.md) diff --git a/docs/standard/linq/preserve-white-space-loading-parsing-xml.md b/docs/standard/linq/preserve-white-space-loading-parsing-xml.md new file mode 100644 index 0000000000000..0057b30375fbe --- /dev/null +++ b/docs/standard/linq/preserve-white-space-loading-parsing-xml.md @@ -0,0 +1,33 @@ +--- +title: Preserve white space while loading or parsing XML - LINQ to XML +description: You can control the white space behavior of LINQ to XML methods that populate XML trees. For instance, you can remove indentation for in-memory processing, or leave it as is. +ms.date: 07/20/2015 +ms.assetid: f3ff58c4-55aa-4fcd-b933-e3a2ee6e706c +--- + +# Preserve white space while loading or parsing XML (LINQ to XML) + +This article describes how to control the white space behavior of LINQ to XML. + +A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), do some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for LINQ to XML. + +Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in LINQ to XML, you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. + +This article describes the white space behavior of methods that populate XML trees. For information about controlling white space when you serialize XML trees, see [Preserve white space while serializing](preserve-white-space-serializing.md). + +## Behavior of methods that populate XML trees + +The following methods in the and classes populate an XML tree. You can populate an XML tree from a file, a , an , or a string: + +- +- +- +- + +If the method doesn't take as an argument, the method won't preserve insignificant white space. + +In most cases, if the method takes as an argument, you can optionally preserve insignificant white space as text nodes in the XML tree. However, if the method is loading the XML from an , then the determines whether white space will be preserved or not. Setting will have no effect. + +With these methods, if white space is preserved, insignificant white space is inserted into the XML tree as nodes. If white space isn't preserved, text nodes aren't inserted. + +You can create an XML tree by using an . Nodes that are written to the are populated in the tree. However, when you build an XML tree using this method, all nodes are preserved, regardless of whether the node is white space or not, or whether the white space is significant or not. diff --git a/docs/standard/linq/preserve-white-space-serializing.md b/docs/standard/linq/preserve-white-space-serializing.md new file mode 100644 index 0000000000000..3937c29c438cf --- /dev/null +++ b/docs/standard/linq/preserve-white-space-serializing.md @@ -0,0 +1,27 @@ +--- +title: Preserve white space while serializing - LINQ to XML +description: You can control white space in various ways when serializing an XML tree. +ms.date: 07/20/2015 +ms.assetid: 0c4f8b98-483b-4cf8-86be-fa146eef90dc +--- + +# Preserve white space while serializing (LINQ to XML) + +This article describes how to control white space when serializing an XML tree. + +A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), do some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for LINQ to XML. + +Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in LINQ to XML, you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. + +## White-space behavior of methods that serialize XML trees + +The following methods in the and classes serialize an XML tree. You can serialize an XML tree to a file, a , or an . The `ToString` method serializes to a string. + +- +- +- [XElement.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) +- [XDocument.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) + +If the method doesn't take as an argument, then the method will format (indent) the serialized XML. In this case, all insignificant white space in the XML tree is discarded. + +If the method does take as an argument, then you can specify that the method not format (indent) the serialized XML. In this case, all white space in the XML tree is preserved. diff --git a/docs/standard/linq/program-nodes.md b/docs/standard/linq/program-nodes.md new file mode 100644 index 0000000000000..39f8ce1f7af32 --- /dev/null +++ b/docs/standard/linq/program-nodes.md @@ -0,0 +1,251 @@ +--- +title: Programming with nodes - LINQ to XML +description: Learn how to code at the node level of an XML tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: c38df0f2-c805-431a-93ff-9103a4284c2f +--- + +# Programming with nodes (LINQ to XML) + +LINQ to XML developers who need to write programs such as an XML editor, a transform system, or a report writer often need code that works at a finer level of granularity than elements and attributes. They often need to work at the node level, manipulating text nodes, processing instructions, and processing comments. This article provides information about programming at the node level. + +## Example: The `Parent` property values of the child nodes of XDocument are set to `null` + +The property contains the parent , not the parent node. Child nodes of have no parent . Their parent is the document, so the property for those nodes is set to `null`. + +The following example demonstrates this: + +```csharp +XDocument doc = XDocument.Parse(@""); +Console.WriteLine(doc.Nodes().OfType().First().Parent == null); +Console.WriteLine(doc.Root.Parent == null); +``` + +```vb +Dim doc As XDocument = XDocument.Parse("") +Console.WriteLine(doc.Nodes().OfType(Of XComment).First().Parent Is Nothing) +Console.WriteLine(doc.Root.Parent Is Nothing) +``` + +This example produces the following output: + +```output +True +True +``` + +## Example: Adding text may or may not create a new text node + +In a number of XML programming models, adjacent text nodes are always merged. This is sometimes called normalization of text nodes. LINQ to XML doesn't normalize text nodes. If you add two text nodes to the same element, it will result in adjacent text nodes. However, if you add content specified as a string rather than as an node, LINQ to XML might merge the string with an adjacent text node. The following example demonstrates this. + +```csharp +XElement xmlTree = new XElement("Root", "Content"); + +Console.WriteLine(xmlTree.Nodes().OfType().Count()); + +// this doesn't add a new text node +xmlTree.Add("new content"); +Console.WriteLine(xmlTree.Nodes().OfType().Count()); + +// this does add a new, adjacent text node +xmlTree.Add(new XText("more text")); +Console.WriteLine(xmlTree.Nodes().OfType().Count()); +``` + +```vb +Dim xmlTree As XElement = Content +Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) + +' This doesn't add a new text node. +xmlTree.Add("new content") +Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) + +'// This does add a new, adjacent text node. +xmlTree.Add(New XText("more text")) +Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) +``` + + This example produces the following output: + +```output +1 +1 +2 +``` + +## Example: Setting a text node value to the empty string doesn't delete the node + +In some XML programming models, text nodes are guaranteed to not contain the empty string. The reasoning is that such a text node has no impact on serialization of the XML. However, for the same reason that adjacent text nodes are possible, if you remove the text from a text node by setting its value to the empty string, the text node itself won't be deleted. + +```csharp +XElement xmlTree = new XElement("Root", "Content"); +XText textNode = xmlTree.Nodes().OfType().First(); + +// the following line doesn't cause the removal of the text node. +textNode.Value = ""; + +XText textNode2 = xmlTree.Nodes().OfType().First(); +Console.WriteLine(">>{0}<<", textNode2); +``` + +```vb +Dim xmlTree As XElement = Content +Dim textNode As XText = xmlTree.Nodes().OfType(Of XText)().First() + +' The following line doesn't cause the removal of the text node. +textNode.Value = "" + +Dim textNode2 As XText = xmlTree.Nodes().OfType(Of XText)().First() +Console.WriteLine(">>{0}<<", textNode2) +``` + +This example produces the following output: + +```output +>><< +``` + +## Example: An element with one empty text node is serialized differently from one with no text node + +If an element contains only a child text node that's empty, it's serialized with the long tag syntax: ``. If an element contains no child nodes whatsoever, it's serialized with the short tag syntax: ``. + +```csharp +XElement child1 = new XElement("Child1", + new XText("") +); +XElement child2 = new XElement("Child2"); +Console.WriteLine(child1); +Console.WriteLine(child2); +``` + +```vb +Dim child1 As XElement = New XElement("Child1", _ + New XText("") _ +) +Dim child2 As XElement = New XElement("Child2") +Console.WriteLine(child1) +Console.WriteLine(child2) +``` + +This example produces the following output: + +```xml + + +``` + +## Example: Namespaces are attributes in the LINQ to XML tree + +Even though namespace declarations have identical syntax to attributes, in some programming interfaces, such as XSLT and XPath, namespace declarations aren't considered to be attributes. However, in LINQ to XML, namespaces are stored as objects in the XML tree. If you iterate through the attributes of an element that contains a namespace declaration, the namespace declaration is one of the items in the returned collection. The property indicates whether an attribute is a namespace declaration. + +```csharp +XElement root = XElement.Parse( +@""); +foreach (XAttribute att in root.Attributes()) + Console.WriteLine("{0} IsNamespaceDeclaration:{1}", att, att.IsNamespaceDeclaration); +``` + +```vb +Dim root As XElement = _ + +For Each att As XAttribute In root.Attributes() + Console.WriteLine("{0} IsNamespaceDeclaration:{1}", att, _ + att.IsNamespaceDeclaration) +Next +``` + +This example produces the following output: + +```output +xmlns="http://www.adventure-works.com" IsNamespaceDeclaration:True +xmlns:fc="www.fourthcoffee.com" IsNamespaceDeclaration:True +AnAttribute="abc" IsNamespaceDeclaration:False +``` + +## Example: XPath axis methods don't return the child text nodes of XDocument + +LINQ to XML allows for child text nodes of an , as long as the text nodes contain only white space. However, the XPath object model doesn't include white space as child nodes of a document, so when you iterate through the children of an using the axis, white space text nodes will be returned. However, when you iterate through the children of an using the XPath axis methods, white space text nodes won't be returned. + +```csharp +// Create a document with some white space child nodes of the document. +XDocument root = XDocument.Parse( +@" + + + + +", LoadOptions.PreserveWhitespace); + +// count the white space child nodes using LINQ to XML +Console.WriteLine(root.Nodes().OfType().Count()); + +// count the white space child nodes using XPathEvaluate +Console.WriteLine(((IEnumerable)root.XPathEvaluate("text()")).OfType().Count()); +``` + +```vb +' Create a document with some white space child nodes of the document. +Dim root As XDocument = XDocument.Parse( _ +"" & _ +vbNewLine & "" & vbNewLine & "" & vbNewLine, _ +LoadOptions.PreserveWhitespace) + +' Count the white space child nodes using LINQ to XML. +Console.WriteLine(root.Nodes().OfType(Of XText)().Count()) + +' Count the white space child nodes using XPathEvaluate. +Dim nodes As IEnumerable = CType(root.XPathEvaluate("text()"), IEnumerable) +Console.WriteLine(nodes.OfType(Of XText)().Count()) +``` + +This example produces the following output: + +```output +3 +0 +``` + +### The XML declaration node of an XDocument is a property, not a child node + +When you iterate through the child nodes of an , you won't see the XML declaration object. It's a property of the document, not a child node of it. + +```csharp +XDocument doc = new XDocument( + new XDeclaration("1.0", "utf-8", "yes"), + new XElement("Root") +); +doc.Save("Temp.xml"); +Console.WriteLine(File.ReadAllText("Temp.xml")); + +// this shows that there is only one child node of the document +Console.WriteLine(doc.Nodes().Count()); +``` + +```vb +Dim doc As XDocument = _ + + + +doc.Save("Temp.xml") +Console.WriteLine(File.ReadAllText("Temp.xml")) + +' This shows that there is only one child node of the document. +Console.WriteLine(doc.Nodes().Count()) +``` + +This example produces the following output: + +```output + + +1 +``` diff --git a/docs/standard/linq/project-anonymous-type.md b/docs/standard/linq/project-anonymous-type.md new file mode 100644 index 0000000000000..8d4b55cd7da89 --- /dev/null +++ b/docs/standard/linq/project-anonymous-type.md @@ -0,0 +1,76 @@ +--- +title: How to project an anonymous type - LINQ to XML +description: You can project to an anonymous type rather than create a type just for use in the projection. This article provides an example for C# and Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 5cb9be13-5ac4-4373-a034-b3520a5b2dec +--- +# How to project an anonymous type (LINQ to XML) + +In some cases, you might want to project a query to a new type, but the query would be your only use for the new type. Rather than create the type, you can project to an anonymous type. Anonymous types provide a convenient way to encapsulate a set of read-only properties in an object without having to explicitly define a type first. If you write a query that creates an object of an anonymous type in the `select` clause, the query returns an of the type. + +The following example shows shows creation of an object of an anonymous type that's initialized with two properties, `Amount` and `Message`. + +```csharp +var v = new { Amount = 108, Message = "Hello" }; +``` + +```vb +Dim v = New With { .Amount = 108, .Message = "Hello" }; +``` + +The type of each property is inferred by the compiler. The type name is generated by the compiler and isn't available at the source code level. + +For more information about anonymous types, see: + +- [Anonymous Types (C# Programming Guide)](../../csharp/programming-guide/classes-and-structs/anonymous-types.md) +- [Anonymous Types (Visual Basic)](../../visual-basic/programming-guide/language-features/objects-and-classes/anonymous-types.md) + +## Example: Project an anonymous type by creating objects in the `select` clause + +In this example, the `select` clause projects an anonymous type. The example then uses `var` to create the `IEnumerable` object. Within the `foreach` loop, the iteration variable becomes an instance of the anonymous type created in the query expression. + +This example uses XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md). + +```csharp +XElement custOrd = XElement.Load("CustomersOrders.xml"); +var custList = + from el in custOrd.Element("Customers").Elements("Customer") + select new { + CustomerID = (string)el.Attribute("CustomerID"), + CompanyName = (string)el.Element("CompanyName"), + ContactName = (string)el.Element("ContactName") + }; +foreach (var cust in custList) + Console.WriteLine("{0}:{1}:{2}", cust.CustomerID, cust.CompanyName, cust.ContactName); +``` + +```vb +Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") +Dim custList = _ + From el In custOrd.. _ + Select New With { _ + .CustomerID = el.@, _ + .CompanyName = el..Value, _ + .ContactName = el..Value _ + } +For Each cust In custList + Console.WriteLine("{0}:{1}:{2}", cust.CustomerID, cust.CompanyName, cust.ContactName) +Next +``` + +This example produces the following output: + +```output +GREAL:Great Lakes Food Market:Howard Snyder +HUNGC:Hungry Coyote Import Store:Yoshi Latimer +LAZYK:Lazy K Kountry Store:John Steel +LETSS:Let's Stop N Shop:Jaime Yorres +``` + +## See also + +- [Anonymous Types (C# Programming Guide)](../../csharp/programming-guide/classes-and-structs/anonymous-types.md) +- [Anonymous Types (Visual Basic)](../../visual-basic/programming-guide/language-features/objects-and-classes/anonymous-types.md) diff --git a/docs/standard/linq/project-new-type.md b/docs/standard/linq/project-new-type.md new file mode 100644 index 0000000000000..0ede41b5a4983 --- /dev/null +++ b/docs/standard/linq/project-new-type.md @@ -0,0 +1,86 @@ +--- +title: How to project a new type - LINQ to XML +description: Your query can return an IEnumerable of a type other than the common ones. This article shows how in an example. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 48145cf9-1e0b-4e73-bbfd-28fc04800dc4 +--- + +# How to project a new type (LINQ to XML) + +Other examples in this section have shown queries that return results as of , of `string`, and of `int`. These are common result types, but they're not appropriate for every scenario. In many cases, you'll want your queries to return an of some other type. + +## Example: Define a new type and have the `select` statement create an instance of the type + +This example shows how to instantiate objects in the `select` clause. The code first invokes a constructor to define a new class, and then modifies the `select` statement so that the expression is a new instance of the new class. The example uses XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +class NameQty +{ + public string name; + public int qty; + public NameQty(string n, int q) + { + name = n; + qty = q; + } +}; + +class Program { + public static void Main() + { + XElement po = XElement.Load("PurchaseOrder.xml"); + + IEnumerable nqList = + from n in po.Descendants("Item") + select new NameQty( + (string)n.Element("ProductName"), + (int)n.Element("Quantity") + ); + + foreach (NameQty n in nqList) + Console.WriteLine(n.name + ":" + n.qty); + } +} +``` + +```vb +Public Class NameQty + Public name As String + Public qty As Integer + Public Sub New(ByVal n As String, ByVal q As Integer) + name = n + qty = q + End Sub +End Class + +Public Class Program + Shared Sub Main() + Dim po As XElement = XElement.Load("PurchaseOrder.xml") + + Dim nqList As IEnumerable(Of NameQty) = _ + From n In po... _ + Select New NameQty( _ + n..Value, CInt(n..Value)) + + For Each n As NameQty In nqList + Console.WriteLine(n.name & ":" & n.qty) + Next + End Sub +End Class +``` + +This example uses the method that was introduced in the [How to retrieve a single child element](retrieve-single-child-element.md) article. It also uses casts to retrieve the values of the elements that are returned by the method. + +This example produces the following output: + +```output +Lawnmower:1 +Baby Monitor:2 +``` + +## See also + +- [Projections and Transformations (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md) diff --git a/docs/standard/linq/project-object-graph.md b/docs/standard/linq/project-object-graph.md new file mode 100644 index 0000000000000..ac808767e480c --- /dev/null +++ b/docs/standard/linq/project-object-graph.md @@ -0,0 +1,543 @@ +--- +title: How to project an object graph - LINQ to XML +description: You can use C# or Visual Basic to project or populate an object graph from XML. The example in this article shows how. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 293d15d5-3eaf-48de-9a02-3e13cb117b5b +--- + +# How to project an object graph (LINQ to XML) + +You can use C# or Visual Basic to project or populate an object graph from XML. + +## Example: Populate an object graph from XML + +This example populates an object graph with the `Address`, `PurchaseOrder`, and `PurchaseOrderItem` classes from XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +class Address +{ + public enum AddressUse + { + Shipping, + Billing, + } + + private AddressUse addressType; + private string name; + private string street; + private string city; + private string state; + private string zip; + private string country; + + public AddressUse AddressType { + get { return addressType; } set { addressType = value; } + } + + public string Name { + get { return name; } set { name = value; } + } + + public string Street { + get { return street; } set { street = value; } + } + + public string City { + get { return city; } set { city = value; } + } + + public string State { + get { return state; } set { state = value; } + } + + public string Zip { + get { return zip; } set { zip = value; } + } + + public string Country { + get { return country; } set { country = value; } + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append($"Type: {(addressType == AddressUse.Shipping ? "Shipping" : "Billing")}\n"); + sb.Append($"Name: {name}\n"); + sb.Append($"Street: {street}\n"); + sb.Append($"City: {city}\n"); + sb.Append($"State: {state}\n"); + sb.Append($"Zip: {zip}\n"); + sb.Append($"Country: {country}\n"); + return sb.ToString(); + } +} + +class PurchaseOrderItem +{ + private string partNumber; + private string productName; + private int quantity; + private Decimal usPrice; + private string comment; + private DateTime shipDate; + + public string PartNumber { + get { return partNumber; } set { partNumber = value; } + } + + public string ProductName { + get { return productName; } set { productName = value; } + } + + public int Quantity { + get { return quantity; } set { quantity = value; } + } + + public Decimal USPrice { + get { return usPrice; } set { usPrice = value; } + } + + public string Comment { + get { return comment; } set { comment = value; } + } + + public DateTime ShipDate { + get { return shipDate; } set { shipDate = value; } + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append($"PartNumber: {partNumber}\n"); + sb.Append($"ProductName: {productName}\n"); + sb.Append($"Quantity: {quantity}\n"); + sb.Append($"USPrice: {usPrice}\n"); + if (comment != null) + sb.Append($"Comment: {comment}\n"); + if (shipDate != DateTime.MinValue) + sb.Append($"ShipDate: {shipDate:d}\n"); + return sb.ToString(); + } +} + +class PurchaseOrder +{ + private string purchaseOrderNumber; + private DateTime orderDate; + private string comment; + private List
addresses; + private List items; + + public string PurchaseOrderNumber { + get { return purchaseOrderNumber; } set { purchaseOrderNumber = value; } + } + + public DateTime OrderDate { + get { return orderDate; } set { orderDate = value; } + } + + public string Comment { + get { return comment; } set { comment = value; } + } + + public List
Addresses { + get { return addresses; } set { addresses = value; } + } + + public List Items { + get { return items; } set { items = value; } + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append($"PurchaseOrderNumber: {purchaseOrderNumber}\n"); + sb.Append($"OrderDate: {orderDate:d}\n"); + sb.Append("\n"); + sb.Append("Addresses\n"); + sb.Append("=====\n"); + foreach (Address address in addresses) + { + sb.Append(address); + sb.Append("\n"); + } + sb.Append("Items\n"); + sb.Append("=====\n"); + foreach (PurchaseOrderItem item in items) + { + sb.Append(item); + sb.Append("\n"); + } + return sb.ToString(); + } +} + +class Program { + public static void Main() + { + XElement po = XElement.Load("PurchaseOrder.xml"); + PurchaseOrder purchaseOrder = new PurchaseOrder { + PurchaseOrderNumber = (string)po.Attribute("PurchaseOrderNumber"), + OrderDate = (DateTime)po.Attribute("OrderDate"), + Addresses = ( + from a in po.Elements("Address") + select new Address { + AddressType = ((string)a.Attribute("Type") == "Shipping") ? + Address.AddressUse.Shipping : + Address.AddressUse.Billing, + Name = (string)a.Element("Name"), + Street = (string)a.Element("Street"), + City = (string)a.Element("City"), + State = (string)a.Element("State"), + Zip = (string)a.Element("Zip"), + Country = (string)a.Element("Country") + } + ).ToList(), + Items = ( + from i in po.Element("Items").Elements("Item") + select new PurchaseOrderItem { + PartNumber = (string)i.Attribute("PartNumber"), + ProductName = (string)i.Element("ProductName"), + Quantity = (int)i.Element("Quantity"), + USPrice = (Decimal)i.Element("USPrice"), + Comment = (string)i.Element("Comment"), + ShipDate = (i.Element("ShipDate") != null) ? + (DateTime)i.Element("ShipDate") : + DateTime.MinValue + } + ).ToList() + }; + Console.WriteLine(purchaseOrder); + } +} +``` + +```vb +Class Address + Public Enum AddressUse + Shipping + Billing + End Enum + + Private addressTypeVal As AddressUse + Private nameVal As String + Private streetVal As String + Private cityVal As String + Private stateVal As String + Private zipVal As String + Private countryVal As String + + Public Property AddressType() As AddressUse + Get + Return addressTypeVal + End Get + Set(ByVal value As AddressUse) + addressTypeVal = value + End Set + End Property + + Public Property Name() As String + Get + Return nameVal + End Get + Set(ByVal value As String) + nameVal = value + End Set + End Property + + Public Property Street() As String + Get + Return streetVal + End Get + Set(ByVal value As String) + streetVal = value + End Set + End Property + + Public Property City() As String + Get + Return cityVal + End Get + Set(ByVal value As String) + cityVal = value + End Set + End Property + + Public Property State() As String + Get + Return stateVal + End Get + Set(ByVal value As String) + stateVal = value + End Set + End Property + + Public Property Zip() As String + Get + Return zipVal + End Get + Set(ByVal value As String) + zipVal = value + End Set + End Property + + Public Property Country() As String + Get + Return countryVal + End Get + Set(ByVal value As String) + countryVal = value + End Set + End Property + + Public Overrides Function ToString() As String + Dim sb As StringBuilder = New StringBuilder() + sb.Append(String.Format("Type: {0}" + vbNewLine, _ + IIf(AddressType = AddressUse.Shipping, "Shipping", "Billing"))) + sb.Append(String.Format("Name: {0}" + vbNewLine, Name)) + sb.Append(String.Format("Street: {0}" + vbNewLine, Street)) + sb.Append(String.Format("City: {0}" + vbNewLine, City)) + sb.Append(String.Format("State: {0}" + vbNewLine, State)) + sb.Append(String.Format("Zip: {0}" + vbNewLine, Zip)) + sb.Append(String.Format("Country: {0}" + vbNewLine, Country)) + Return sb.ToString() + End Function +End Class + +Class PurchaseOrderItem + Private partNumberVal As String + Private productNameVal As String + Private quantityVal As Integer + Private usPriceVal As Decimal + Private commentVal As String + Private shipDateVal As DateTime + + Public Property PartNumber() As String + Get + Return partNumberVal + End Get + Set(ByVal value As String) + partNumberVal = value + End Set + End Property + + Public Property ProductName() As String + Get + Return productNameVal + End Get + Set(ByVal value As String) + productNameVal = value + End Set + End Property + + Public Property Quantity() As Integer + Get + Return quantityVal + End Get + Set(ByVal value As Integer) + quantityVal = value + End Set + End Property + + Public Property USPrice() As Decimal + Get + Return usPriceVal + End Get + Set(ByVal value As Decimal) + usPriceVal = value + End Set + End Property + + Public Property Comment() As String + Get + Return commentVal + End Get + Set(ByVal value As String) + commentVal = value + End Set + End Property + + Public Property ShipDate() As DateTime + Get + Return shipDateVal + End Get + Set(ByVal value As DateTime) + shipDateVal = value + End Set + End Property + + Public Overrides Function ToString() As String + Dim sb As StringBuilder = New StringBuilder() + sb.Append(String.Format("PartNumber: {0}" + vbNewLine, PartNumber)) + sb.Append(String.Format("ProductName: {0}" + vbNewLine, ProductName)) + sb.Append(String.Format("Quantity: {0}" + vbNewLine, Quantity)) + sb.Append(String.Format("USPrice: {0}" + vbNewLine, USPrice)) + If (Comment <> Nothing) Then + sb.Append(String.Format("Comment: {0}" + vbNewLine, Comment)) + End If + If (ShipDate <> DateTime.MinValue) Then + sb.Append(String.Format("ShipDate: {0:d}" + vbNewLine, ShipDate)) + End If + Return sb.ToString() + End Function +End Class + +Class PurchaseOrder + Private purchaseOrderNumberVal As String + Private orderDateVal As DateTime + Private commentVal As String + Private addressesVal As List(Of Address) + Private itemsVal As List(Of PurchaseOrderItem) + + Public Property PurchaseOrderNumber() As String + Get + Return purchaseOrderNumberVal + End Get + Set(ByVal value As String) + purchaseOrderNumberVal = value + End Set + End Property + + Public Property OrderDate() As DateTime + Get + Return orderDateVal + End Get + Set(ByVal value As DateTime) + orderDateVal = value + End Set + End Property + + Public Property Comment() As String + Get + Return commentVal + End Get + Set(ByVal value As String) + commentVal = value + End Set + End Property + + Public Property Addresses() As List(Of Address) + Get + Return addressesVal + End Get + Set(ByVal value As List(Of Address)) + addressesVal = value + End Set + End Property + + Public Property Items() As List(Of PurchaseOrderItem) + Get + Return itemsVal + End Get + Set(ByVal value As List(Of PurchaseOrderItem)) + itemsVal = value + End Set + End Property + + Public Overrides Function ToString() As String + Dim sb As StringBuilder = New StringBuilder() + sb.Append(String.Format("PurchaseOrderNumber: {0}" _ + + vbNewLine, PurchaseOrderNumber)) + sb.Append(String.Format("OrderDate: {0:d}" + vbNewLine, OrderDate)) + sb.Append(vbNewLine) + sb.Append("Addresses" + vbNewLine) + sb.Append("=====" + vbNewLine) + For Each address As Address In Addresses + sb.Append(address) + sb.Append(vbNewLine) + Next + sb.Append("Items" + vbNewLine) + sb.Append("=====" + vbNewLine) + For Each item As PurchaseOrderItem In Items + sb.Append(item) + sb.Append(vbNewLine) + Next + Return sb.ToString() + End Function +End Class + +Sub Main() + Dim po As XElement = XElement.Load("PurchaseOrder.xml") + Dim purchOrder = New PurchaseOrder With { _ + .PurchaseOrderNumber = po.@, _ + .OrderDate = Convert.ToDateTime(po.@), _ + .Addresses = ( _ + From a In po.
_ + Select New Address With { _ + .AddressType = IIf(a.@ = "Shipping", _ + Address.AddressUse.Shipping, _ + Address.AddressUse.Billing), _ + .Name = a..Value, _ + .Street = a..Value, _ + .City = a..Value, _ + .State = a..Value, _ + .Zip = a..Value, _ + .Country = a..Value _ + } _ + ).ToList(), _ + .Items = ( _ + From i In po.. _ + Select New PurchaseOrderItem With { _ + .PartNumber = i.@, _ + .ProductName = i..Value, _ + .Quantity = i..Value, _ + .USPrice = i..Value, _ + .Comment = i..Value, _ + .ShipDate = IIf(i..Value <> Nothing, _ + Convert.ToDateTime(i..Value), _ + DateTime.MinValue) _ + } _ + ).ToList() _ + } + Console.WriteLine(purchOrder) +End Sub +``` + +The result of the LINQ query is returned as an of `PurchaseOrderItem`. The items in the `PurchaseOrder` class are of type of `PurchaseOrderItem`. The code uses the extension method to create a collection from the results of the query. + +This example produces the following output: + +```output +PurchaseOrderNumber: 99503 +OrderDate: 10/20/1999 + +Addresses +===== +Type: Shipping +Name: Ellen Adams +Street: 123 Maple Street +City: Mill Valley +State: CA +Zip: 10999 +Country: USA + +Type: Billing +Name: Tai Yee +Street: 8 Oak Avenue +City: Old Town +State: PA +Zip: 95819 +Country: USA + +Items +===== +PartNumber: 872-AA +ProductName: Lawnmower +Quantity: 1 +USPrice: 148.95 +Comment: Confirm this is electric + +PartNumber: 926-AA +ProductName: Baby Monitor +Quantity: 2 +USPrice: 39.98 +ShipDate: 5/21/1999 +``` + +## See also + +- +- diff --git a/docs/standard/linq/project-xml-different-shape.md b/docs/standard/linq/project-xml-different-shape.md new file mode 100644 index 0000000000000..56414d14563d7 --- /dev/null +++ b/docs/standard/linq/project-xml-different-shape.md @@ -0,0 +1,446 @@ +--- +title: Project XML in a different shape - LINQ to XML +description: Learn how to project XML in a shape that differs from the source XML. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4cb6b14a-32dc-4a2a-813e-bf9368fa8d86 +--- + +# Project XML in a different shape (LINQ to XML) + +This article shows an example of projecting XML in a shape that differs from the source XML. + +Many typical XML transformations consist of chained queries, as in this example. It's common to start with some form of XML, project intermediate results as collections of anonymous types or named types, and then project the results back into XML of an entirely different shape from the source XML. + +## Example: Retrieve paragraph nodes and identify the style and text of each paragraph + +This example retrieves the paragraph nodes from a WordprocessingML document and identifies the style and text of each paragraph. Then it projects XML of a different shape. The example builds on the previous examples in this tutorial. The statement that was added to do the projection is pointed out by comments in the code. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes from the WindowsBase assembly. It uses types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = ParagraphText(para.ParagraphNode) + }; + + // The following is the new code that projects XML in a new shape. + XElement root = new XElement("Root", + from p in paraWithText + select new XElement("Paragraph", + new XElement("StyleName", p.StyleName), + new XElement("Text", p.Text) + ) + ); + + Console.WriteLine(root); + } +} +``` + +```vb +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + Public Function ParagraphText(ByVal e As XElement) As String + Dim w As XNamespace = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ + ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (Not (styleRelation Is Nothing)) Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = ParagraphText(para.ParagraphNode) _ + } + + ' Following is the new code that projects XML in a new shape + Dim root As XElement = _ + + <%= _ + From p In paraWithText _ + Select _ + + <%= p.StyleName %> + <%= p.Text %> + _ + %> + + + Console.WriteLine(root) + End Sub +End Module +``` + +The C# version of this example produces the following output: + +```xml + + + Heading1 + Parsing WordprocessingML with LINQ to XML + + + Normal + + + + Normal + The following example prints to the console. + + + Normal + + + + Code + using System; + + + Code + + + + Code + class Program { + + + Code + public static void (string[] args) { + + + Code + Console.WriteLine("Hello World"); + + + Code + } + + + Code + } + + + Normal + + + + Normal + This example produces the following output: + + + Normal + + + + Code + Hello World + + +``` + +The Visual Basic version of this example produces the following output: + +```xml + + + Heading1 + Parsing WordprocessingML with LINQ to XML + + + Normal + + + + Normal + The following example prints to the console. + + + Normal + + + + Code + Imports System + + + Code + + + + Code + Class Program + + + Code + Public Shared Sub Main(ByVal args() As String) + + + Code + Console.WriteLine("Hello World") + + + Code + End Sub + + + Code + End Class + + + Normal + + + + Normal + This example produces the following output: + + + Normal + + + + Code + Hello World + + +``` + +The next article in this tutorial shows how to find all the text in a Word document: + +- [Find text in Word documents](find-text-word-documents.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) diff --git a/docs/standard/linq/query-linq-xml-xpath.md b/docs/standard/linq/query-linq-xml-xpath.md new file mode 100644 index 0000000000000..daed948f81ebe --- /dev/null +++ b/docs/standard/linq/query-linq-xml-xpath.md @@ -0,0 +1,59 @@ +--- +title: How to query LINQ to XML using XPath - LINQ to XML +description: Learn the extension methods that enable you to query an XML tree by using XPath. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: ee5af263-4ab1-45e5-b792-33a3221b426d +--- + +# How to query LINQ to XML using XPath (LINQ to XML) + +This article introduces the extension methods that enable you to query an XML tree by using XPath. For detailed information about using these extension methods, see . + +> [!NOTE] +> Unless you have a very specific reason for querying using XPath, such as extensive use of legacy code, using XPath with LINQ to XML isn't recommended. XPath queries won't perform as well as LINQ to XML queries. + +## Example + +The following example creates a small XML tree and uses to select a set of elements. + +```csharp +XElement root = new XElement("Root", + new XElement("Child1", 1), + new XElement("Child1", 2), + new XElement("Child1", 3), + new XElement("Child2", 4), + new XElement("Child2", 5), + new XElement("Child2", 6) +); +IEnumerable list = root.XPathSelectElements("./Child2"); +foreach (XElement el in list) + Console.WriteLine(el); +``` + +```vb +Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + +Dim list As IEnumerable(Of XElement) = root.XPathSelectElements("./Child2") +For Each el As XElement In list + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```xml +4 +5 +6 +``` diff --git a/docs/standard/linq/query-xdocument-vs-query-xelement.md b/docs/standard/linq/query-xdocument-vs-query-xelement.md new file mode 100644 index 0000000000000..5736a28143432 --- /dev/null +++ b/docs/standard/linq/query-xdocument-vs-query-xelement.md @@ -0,0 +1,174 @@ +--- +title: Query an XDocument vs. Query an XElement - LINQ to XML +description: Write slightly different queries for XML documents loaded by XDocument.Load and XElement.Load. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 46221ff5-62ee-4de8-93ba-66465facb5c1 +--- + +# Query an `XDocument` vs. query an `XElement` (LINQ to XML) + +The query you write when you load a document via differs slighty from what you write when you load via . + +## Comparison of `XDocument.Load` and `XElement.Load` + +When you load an XML document into an via , the at the root of the XML tree contains the root element of the loaded document. However, when you load the same XML document into an via , the root of the tree is an node, and the root element of the loaded document is the one allowed child node of the . The LINQ to XML axes operate relative to the root node. + +## Example: Load an XML tree using `XElement.Load`, then query for child elements + +This first example loads an XML tree using . It then queries for the child elements of the root of the tree. + +```csharp +// Create a simple document and write it to a file +File.WriteAllText("Test.xml", @" + 1 + 2 + 3 +"); + +Console.WriteLine("Querying tree loaded with XElement.Load"); +Console.WriteLine("----"); +XElement doc = XElement.Load("Test.xml"); +IEnumerable childList = + from el in doc.Elements() + select el; +foreach (XElement e in childList) + Console.WriteLine(e); +``` + +```vb +' Create a simple document and write it to a file +File.WriteAllText("Test.xml", "" + Environment.NewLine + _ + " 1" + Environment.NewLine + _ + " 2" + Environment.NewLine + _ + " 3" + Environment.NewLine + _ + "") + +Console.WriteLine("Querying tree loaded with XElement.Load") +Console.WriteLine("----") +Dim doc As XElement = XElement.Load("Test.xml") +Dim childList As IEnumerable(Of XElement) = _ + From el In doc.Elements() _ + Select el +For Each e As XElement In childList + Console.WriteLine(e) +Next +``` + +This example produces the following output: + +```output +Querying tree loaded with XElement.Load +---- +1 +2 +3 +``` + +## Example: Load an XML tree using `XDocument.Load`, then query for child elements + +The next example does the same as the one above, but the XML tree has been loaded into an , rather than an . + +```csharp +// Create a simple document and write it to a file +File.WriteAllText("Test.xml", @" + 1 + 2 + 3 +"); + +Console.WriteLine("Querying tree loaded with XDocument.Load"); +Console.WriteLine("----"); +XDocument doc = XDocument.Load("Test.xml"); +IEnumerable childList = + from el in doc.Elements() + select el; +foreach (XElement e in childList) + Console.WriteLine(e); +``` + +```vb +' Create a simple document and write it to a file +File.WriteAllText("Test.xml", "" + Environment.NewLine + _ + " 1" + Environment.NewLine + _ + " 2" + Environment.NewLine + _ + " 3" + Environment.NewLine + _ + "") + +Console.WriteLine("Querying tree loaded with XDocument.Load") +Console.WriteLine("----") +Dim doc As XDocument = XDocument.Load("Test.xml") +Dim childList As IEnumerable(Of XElement) = _ + From el In doc.Elements() _ + Select el +For Each e As XElement In childList + Console.WriteLine(e) +Next +``` + +This example produces the following output: + +```output +Querying tree loaded with XDocument.Load +---- + + 1 + 2 + 3 + +``` + +Notice that the same query returned the one `Root` node instead of the three child nodes. + +One approach to dealing with this is to use the property before accessing the axes methods, as follows: + +```csharp +// Create a simple document and write it to a file +File.WriteAllText("Test.xml", @" + 1 + 2 + 3 +"); + +Console.WriteLine("Querying tree loaded with XDocument.Load"); +Console.WriteLine("----"); +XDocument doc = XDocument.Load("Test.xml"); +IEnumerable childList = + from el in doc.Root.Elements() + select el; +foreach (XElement e in childList) + Console.WriteLine(e); +``` + +```vb +' Create a simple document and write it to a file +File.WriteAllText("Test.xml", "" + Environment.NewLine + _ + " 1" + Environment.NewLine + _ + " 2" + Environment.NewLine + _ + " 3" + Environment.NewLine + _ + "") + +Console.WriteLine("Querying tree loaded with XDocument.Load") +Console.WriteLine("----") +Dim doc As XDocument = XDocument.Load("Test.xml") +Dim childList As IEnumerable(Of XElement) = _ + From el In doc.Root.Elements() _ + Select el +For Each e As XElement In childList + Console.WriteLine(e) +Next +``` + +This query now performs in the same way as the query on the tree rooted in . + +This example produces the following output: + +```output +Querying tree loaded with XDocument.Load +---- +1 +2 +3 +``` diff --git a/docs/standard/linq/query-xml-trees-overview.md b/docs/standard/linq/query-xml-trees-overview.md new file mode 100644 index 0000000000000..367ca3092605d --- /dev/null +++ b/docs/standard/linq/query-xml-trees-overview.md @@ -0,0 +1,36 @@ +--- +title: Query XML trees overview - LINQ to XML +description: Learn how to query an XML tree, and how to combine querying and functional construction to reshape a tree. +ms.date: 07/20/2015 +ms.assetid: 2e35c1ab-08c8-4378-9ca8-8ff344756eda +--- + +# Query XML trees overview (LINQ to XML) + +After you've instantiated an XML tree, writing queries is the most effective way to extract data from the tree. Also, querying combined with functional construction enables you to generate a new XML document that has a different shape from the original document. + +For background information about LINQ queries, see: + +- [Introduction to LINQ Queries (C#)](../../csharp/programming-guide/concepts/linq/introduction-to-linq-queries.md) +- [Writing Your First LINQ Query (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/writing-your-first-linq-query.md) + +## In this section + +This section of articles provides information, including examples, about LINQ to XML queries. It comprises the following subsections: + +|Article|Description| +|-----------|-----------------| +|[Basic queries](find-element-specific-attribute.md)|Provides common examples of querying XML trees.| +|[Projections and transformations](work-dictionaries-linq-xml.md)|Provides common examples of projecting from and transforming XML trees.| +|[Advanced query techniques](join-two-collections.md)|Provides query techniques that are useful in more advanced scenarios.| +|[LINQ to XML for XPath users](comparison-xpath-linq-xml.md)|Presents a number of XPath expressions and their LINQ to XML equivalents.| +|[Introduction to pure functional transformations](introduction-pure-functional-transformations.md)|Presents a small tutorial on writing queries in the style of functional programming.| + +## See also + +- [Language-Integrated Query (LINQ) (C#)](../../csharp/programming-guide/concepts/linq/index.md) +- [Introduction to LINQ Queries (C#)](../../csharp/programming-guide/concepts/linq/introduction-to-linq-queries.md) +- [LINQ in Visual Basic](../../visual-basic/programming-guide/language-features/linq/index.md) +- [Language-Integrated Query (LINQ) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/index.md) +- [Getting Started with LINQ in Visual Basic](../../visual-basic/programming-guide/concepts/linq/getting-started-with-linq.md) +- [Writing Your First LINQ Query (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/writing-your-first-linq-query.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md b/docs/standard/linq/read-write-encoded-document.md similarity index 58% rename from docs/visual-basic/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md rename to docs/standard/linq/read-write-encoded-document.md index 60d5bdb7453e1..c31bfdc037d11 100644 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-read-and-write-an-encoded-document.md +++ b/docs/standard/linq/read-write-encoded-document.md @@ -1,9 +1,14 @@ --- -title: "How to: Read and Write an Encoded Document" +title: How to read and write an encoded document - LINQ to XML +description: Learn how to add an XDeclaration to an XML tree to create an encoded XML document. ms.date: 07/20/2015 -ms.assetid: 159d868f-5ac8-40f2-95ca-07dd925f35c6 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 84f64e71-39a6-42c6-ad68-f052bb158a03 --- -# How to: Read and Write an Encoded Document (Visual Basic) + +# How to read and write an encoded document (LINQ to XML) To create an encoded XML document, you add an to the XML tree, setting the encoding to the desired code page name. @@ -11,12 +16,45 @@ Any value returned by is a valid value. If you read an encoded document, the property will be set to the code page name. -If you set to a valid code page name, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] will serialize with the specified encoding. +If you set to a valid code page name, LINQ to XML will serialize with the specified encoding. -## Example +## Example: Create two documents that have different encoding and identify the encoding. The following example creates two documents, one with utf-8 encoding, and one with utf-16 encoding. It then loads the documents and prints the encoding to the console. +```csharp +Console.WriteLine("Creating a document with utf-8 encoding"); +XDocument encodedDoc8 = new XDocument( + new XDeclaration("1.0", "utf-8", "yes"), + new XElement("Root", "Content") +); +encodedDoc8.Save("EncodedUtf8.xml"); +Console.WriteLine("Encoding is:{0}", encodedDoc8.Declaration.Encoding); +Console.WriteLine(); + +Console.WriteLine("Creating a document with utf-16 encoding"); +XDocument encodedDoc16 = new XDocument( + new XDeclaration("1.0", "utf-16", "yes"), + new XElement("Root", "Content") +); +encodedDoc16.Save("EncodedUtf16.xml"); +Console.WriteLine("Encoding is:{0}", encodedDoc16.Declaration.Encoding); +Console.WriteLine(); + +XDocument newDoc8 = XDocument.Load("EncodedUtf8.xml"); +Console.WriteLine("Encoded document:"); +Console.WriteLine(File.ReadAllText("EncodedUtf8.xml")); +Console.WriteLine(); +Console.WriteLine("Encoding of loaded document is:{0}", newDoc8.Declaration.Encoding); +Console.WriteLine(); + +XDocument newDoc16 = XDocument.Load("EncodedUtf16.xml"); +Console.WriteLine("Encoded document:"); +Console.WriteLine(File.ReadAllText("EncodedUtf16.xml")); +Console.WriteLine(); +Console.WriteLine("Encoding of loaded document is:{0}", newDoc16.Declaration.Encoding); +``` + ```vb Console.WriteLine("Creating a document with utf-8 encoding") Dim encodedDoc8 As XDocument = _ @@ -52,7 +90,7 @@ Console.WriteLine("Encoding of loaded document is:{0}", newDoc16.Declaration.Enc This example produces the following output: -```console +```output Creating a document with utf-8 encoding Encoding is:utf-8 @@ -75,4 +113,3 @@ Encoding of loaded document is:utf-16 ## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/standard/linq/refactor-extension-method.md b/docs/standard/linq/refactor-extension-method.md new file mode 100644 index 0000000000000..3b061ec87d72c --- /dev/null +++ b/docs/standard/linq/refactor-extension-method.md @@ -0,0 +1,428 @@ +--- +title: Refactor using an extension method - LINQ to XML +description: Learn how to refactor the concatenation of strings using a pure function that's implemented as an extension method. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: c5fc123d-af10-4a2f-b8e4-db921efb2639 +--- + +# Refactor using an extension method (LINQ to XML) + +This example builds on the previous example, [Retrieve the text of the paragraphs](retrieve-text-paragraphs.md), by refactoring the concatenation of strings using a pure function that's implemented as an extension method. + +The previous example used the standard query operator to concatenate multiple strings into one string. However, it's more convenient to write an extension method to do this, because the resulting query is smaller and simpler. + +## Example: Retrieve the paragraphs, their styles, and their text + +This example processes a WordprocessingML document, retrieving the paragraphs and the style and text for each paragraph. This example builds on the previous examples in this tutorial. + +The example contains multiple overloads of the `StringConcatenate` method. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes from the WindowsBase assembly. It uses types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} +``` + +```vb + _ +Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() +End Function + + _ +Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ +ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() +End Function + + _ +Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ +ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() +End Function + + _ +Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ +ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() +End Function +``` + +## Example: Use all four overloads of the `StringConcatenate` method + +There are four overloads of the `StringConcatenate` method. One overload simply takes a collection of strings and returns a single string. Another overload can take a collection of any type, and a delegate that projects from a singleton of the collection to a string. There are two more overloads that allow you to specify a separator string. + +The following code uses all four overloads: + +```csharp +string[] numbers = { "one", "two", "three" }; + +Console.WriteLine("{0}", numbers.StringConcatenate()); +Console.WriteLine("{0}", numbers.StringConcatenate(":")); + +int[] intNumbers = { 1, 2, 3 }; +Console.WriteLine("{0}", intNumbers.StringConcatenate(i => i.ToString())); +Console.WriteLine("{0}", intNumbers.StringConcatenate(i => i.ToString(), ":")); +``` + +```vb +Dim numbers As String() = {"one", "two", "three"} + +Console.WriteLine("{0}", numbers.StringConcatenate()) +Console.WriteLine("{0}", numbers.StringConcatenate(":")) + +Dim intNumbers As Integer() = {1, 2, 3} +Console.WriteLine("{0}", intNumbers.StringConcatenate(Function(i) i.ToString())) +Console.WriteLine("{0}", intNumbers.StringConcatenate(Function(i) i.ToString(), ":")) +``` + +This example produces the following output: + +```output +onetwothree +one:two:three: +123 +1:2:3: +``` + +## Example: Use the new extension method + +Now the example can be modified to take advantage of the new extension method: + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = para + .ParagraphNode + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(e => (string)e) + }; + + foreach (var p in paraWithText) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); + } +} +``` + +```vb +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ + ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = para.ParagraphNode...StringConcatenate(Function(e) CStr(e)) _ + } + + For Each p In paraWithText + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + + End Sub +End Module +``` + + This example produces the following output: + +```output +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >using System;< +StyleName:Code >< +StyleName:Code >class Program {< +StyleName:Code > public static void (string[] args) {< +StyleName:Code > Console.WriteLine("Hello World");< +StyleName:Code > }< +StyleName:Code >}< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` + +This refactoring is a variant of refactoring into a pure function. The next article in this tutorial shows in more detail how to refactor this code into pure functions: + +- [Refactor using a pure function](refactor-pure-function.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) +- [Refactor into pure functions](refactor-pure-functions.md) diff --git a/docs/standard/linq/refactor-pure-function.md b/docs/standard/linq/refactor-pure-function.md new file mode 100644 index 0000000000000..578d767e5df45 --- /dev/null +++ b/docs/standard/linq/refactor-pure-function.md @@ -0,0 +1,331 @@ +--- +title: Refactor using a pure function - LINQ to XML +description: Learn how to refactor using a pure function +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: a3416a45-9e12-4e4a-9747-897f06eef510 +--- +# Refactor using a pure function (LINQ to XML) + +The following example refactors the previous example, [Refactor using an extension method](refactor-extension-method.md), to use a pure function. It moves the code that finds the text of a paragraph to the pure static method `ParagraphText`. + +## Example: Retrieve the paragraph nodes and their styles + +This example processes a WordprocessingML document, retrieving the paragraph nodes. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The refactored code is called out in comments in the code below. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes from the WindowsBase assembly. It uses types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + // This is a new method that assembles the paragraph text. + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, + styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = ParagraphText(para.ParagraphNode) + }; + + foreach (var p in paraWithText) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); + } +} +``` + +```vb +Imports +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb = New StringBuilder() + For Each s In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + ' This is a new method that assembles the paragraph text. + Public Function ParagraphText(ByVal e As XElement) As String + Dim w = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ + ByVal defaultStyle As String) As String + If styleNode Is Nothing Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If styleRelation IsNot Nothing Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = ParagraphText(para.ParagraphNode) _ + } + + For Each p In paraWithText + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + End Sub +End Module +``` + +This example produces the same output as before the refactoring: + +```output +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >using System;< +StyleName:Code >< +StyleName:Code >class Program {< +StyleName:Code > public static void (string[] args) {< +StyleName:Code > Console.WriteLine("Hello World");< +StyleName:Code > }< +StyleName:Code >}< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` + +```output +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >Imports System< +StyleName:Code >< +StyleName:Code >Class Program< +StyleName:Code > Public Shared Sub Main(ByVal args() As String)< +StyleName:Code > Console.WriteLine("Hello World")< +StyleName:Code > End Sub< +StyleName:Code >End Class< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` + +The next article in this tutorial shows how to project XML into a different shape: + +- [Project XML in a different shape](project-xml-different-shape.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) +- [Refactor using an extension method](refactor-extension-method.md) +- [Refactor into pure functions](refactor-pure-functions.md) diff --git a/docs/standard/linq/refactor-pure-functions.md b/docs/standard/linq/refactor-pure-functions.md new file mode 100644 index 0000000000000..2c4cb649e3140 --- /dev/null +++ b/docs/standard/linq/refactor-pure-functions.md @@ -0,0 +1,162 @@ +--- +title: Refactor into pure functions - LINQ to XML +description: Learn about pure functions and how to use them to refactor code. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 2944a0d4-fd33-4e2e-badd-abb0f9be2fcc +--- + +# Refactor into pure functions (LINQ to XML) + +An important aspect of pure functional transformations is learning how to refactor code using pure functions. + +> [!NOTE] +> The common nomenclature in functional programming is that you refactor programs using pure functions. In Visual Basic and C++, this aligns with the use of functions in the respective languages. However, in C#, functions are called methods. For the purposes of this discussion, a pure function is implemented as a method in C#. + +As noted previously in this section, a pure function has two useful characteristics: + +- It has no side effects. The function doesn't change any variables or the data of any type outside of the function. +- It's consistent. Given the same set of input data, it will always return the same output value. + +One way of transitioning to functional programming is to refactor existing code to eliminate unnecessary side effects and external dependencies. In this way, you can create pure function versions of existing code. + +This article discusses what a pure function is and what it's not. The [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) tutorial shows how to manipulate a WordprocessingML document, and includes two examples of how to refactor using a pure function. + +The following examples contrast two non-pure functions and a pure function. + +## Example: Implement a non-pure function that changes a static class member + +In the following code, the `HyphenatedConcat` function isn't a pure function, because it modifies the `aMember` static class member: + +```csharp +public class Program +{ + private static string aMember = "StringOne"; + + public static void HyphenatedConcat(string appendStr) + { + aMember += '-' + appendStr; + } + + public static void Main() + { + HyphenatedConcat("StringTwo"); + Console.WriteLine(aMember); + } +} +``` + +```vb +Module Module1 + Dim aMember As String = "StringOne" + + Public Sub HyphenatedConcat(ByVal appendStr As String) + aMember = aMember & "-" & appendStr + End Sub + + Sub Main() + HyphenatedConcat("StringTwo") + Console.WriteLine(aMember) + End Sub +End Module +``` + +This example produces the following output: + +```output +StringOne-StringTwo +``` + +Note that it's irrelevant whether the data being modified has `public` or `private` access, or is a `static` member, `shared` member, or instance member. A pure function doesn't change any data outside of the function. + +## Example: Implement a non-pure function that changes a parameter + +Furthermore, the following version of this same function isn't pure because it modifies the contents of its parameter, `sb`. + +```csharp +public class Program +{ + public static void HyphenatedConcat(StringBuilder sb, String appendStr) + { + sb.Append('-' + appendStr); + } + + public static void Main() + { + StringBuilder sb1 = new StringBuilder("StringOne"); + HyphenatedConcat(sb1, "StringTwo"); + Console.WriteLine(sb1); + } +} +``` + +```vb +Module Module1 + Public Sub HyphenatedConcat(ByVal sb As StringBuilder, ByVal appendStr As String) + sb.Append("-" & appendStr) + End Sub + + Sub Main() + Dim sb1 As StringBuilder = New StringBuilder("StringOne") + HyphenatedConcat(sb1, "StringTwo") + Console.WriteLine(sb1) + End Sub +End Module +``` + +This version of the program produces the same output as the first version, because the `HyphenatedConcat` function has changed the value (state) of its first parameter by invoking the member function. Note that this alteration occurs despite the fact that `HyphenatedConcat` uses call-by-value parameter passing. + +> [!IMPORTANT] +> For reference types, if you pass a parameter by value, it results in a copy of the reference to an object being passed. This copy is still associated with the same instance data as the original reference (until the reference variable is assigned to a new object). Call-by-reference isn't necessarily required for a function to modify a parameter. + +## Example: Implement a pure function + +This next version of the program shows how to implement the `HyphenatedConcat` function as a pure function. + +```csharp +class Program +{ + public static string HyphenatedConcat(string s, string appendStr) + { + return (s + '-' + appendStr); + } + + public static void Main(string[] args) + { + string s1 = "StringOne"; + string s2 = HyphenatedConcat(s1, "StringTwo"); + Console.WriteLine(s2); + } +} +``` + +```vb +Module Module1 + Public Function HyphenatedConcat(ByVal s As String, ByVal appendStr As String) As String + Return (s & "-" & appendStr) + End Function + + Sub Main() + Dim s1 As String = "StringOne" + Dim s2 As String = HyphenatedConcat(s1, "StringTwo") + Console.WriteLine(s2) + End Sub +End Module +``` + +Again, this version produces the same line of output: `StringOne-StringTwo`. Note that to retain the concatenated value, it's stored in the intermediate variable `s2`. + +One approach that can be very useful is to write functions that are locally impure (that is, they declare and modify local variables) but are globally pure. Such functions have many of the desirable composability characteristics, but avoid some of the more convoluted functional programming idioms, such as having to use recursion when a simple loop would accomplish the same thing. + +## Standard query operators + +An important characteristic of the standard query operators is that they're implemented as pure functions. + +For more information, see [Standard Query Operators Overview (C#)](../../csharp/programming-guide/concepts/linq/standard-query-operators-overview.md) and [Standard Query Operators Overview (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/standard-query-operators-overview.md). + +## See also + +- [Introduction to pure functional transformations](introduction-pure-functional-transformations.md) +- [Functional programming vs. imperative programming](functional-vs-imperative-programming.md) diff --git a/docs/standard/linq/reference.md b/docs/standard/linq/reference.md new file mode 100644 index 0000000000000..620459b11c08a --- /dev/null +++ b/docs/standard/linq/reference.md @@ -0,0 +1,20 @@ +--- +title: Reference - LINQ to XML +description: Find LINQ to XML reference articles. +ms.date: 07/20/2015 +ms.assetid: 815b45e2-3527-4dee-9986-b1277a693cde +--- + +# Reference (LINQ to XML) + +This article contains links to the LINQ to XML reference articles. + +For reference documentation for the LINQ to XML classes, see . + +For reference documentation for the extension methods that help you validate XML trees against an XSD file, see . + +For reference documentation for the extension methods that enable you to evaluate XPath queries on an XML tree, see . + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/remove-elements-attributes-nodes-xml-tree.md b/docs/standard/linq/remove-elements-attributes-nodes-xml-tree.md new file mode 100644 index 0000000000000..676addaa21448 --- /dev/null +++ b/docs/standard/linq/remove-elements-attributes-nodes-xml-tree.md @@ -0,0 +1,100 @@ +--- +title: Remove elements, attributes, and nodes from an XML tree - LINQ to XML +description: Learn how to remove elements, attributes, and other types of nodes from an XML tree. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 07dd06d6-1117-4077-bf98-9120cf51176e +--- + +# Remove elements, attributes, and nodes from an XML tree (LINQ to XML) + +You can modify an XML tree, removing elements, attributes, and other types of nodes. + +Removing a single element or a single attribute from an XML document is straightforward. However, when removing collections of elements or attributes, you should first materialize a collection into a list, and then delete the elements or attributes from the list. The best approach is to use the extension method to do this. + +The main reason to use this approach is that most of the collections you retrieve from an XML tree are yielded using deferred execution. If you don't first materialize them into a list, or if you don't use the extension methods, you may encounter a certain class of bugs. For more information, see [Mixed declarative/imperative code bugs](mixed-declarative-imperative-code-bugs.md). + +The following methods remove nodes and attributes from an XML tree. + +|Method|Description| +|------------|-----------------| +||Remove an from its parent.| +||Remove the child nodes from an .| +||Remove content and attributes from an .| +||Remove the attributes of an .| +||Remove the attribute if you pass the value `null`.| +||Remove the child element if you pass the value `null`.| +||Remove an from its parent.| +||Remove every attribute or element in the source collection from its parent element.| + +## Example: Remove a single element, and remove a collection of elements in two ways + +This example demonstrates three approaches to removing elements. First, it removes a single element. Second, it retrieves a collection of elements, materializes them using the operator, and then removes the collection. Finally, it retrieves a collection of elements and removes them using the extension method. + +For more information on the operator, see [Converting Data Types (C#)](../../csharp/programming-guide/concepts/linq/converting-data-types.md) and [Converting Data Types (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/converting-data-types.md). + +```csharp +XElement root = XElement.Parse(@" + + + + + + + + + + + + + + + +"); +root.Element("Child1").Element("GrandChild1").Remove(); +root.Element("Child2").Elements().ToList().Remove(); +root.Element("Child3").Elements().Remove(); +Console.WriteLine(root); +``` + +```vb +Dim root As XElement = _ + + + + + + + + + + + + + + + + + +root...Remove() +root..Elements().ToList().Remove() +root..Elements().Remove() +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + + + + + + + +``` + +The first grandchild element was removed from `Child1`, and all grandchildren elements were removed from `Child2` and from `Child3`. diff --git a/docs/standard/linq/retrieve-collection-attributes.md b/docs/standard/linq/retrieve-collection-attributes.md new file mode 100644 index 0000000000000..045da5f27e18f --- /dev/null +++ b/docs/standard/linq/retrieve-collection-attributes.md @@ -0,0 +1,53 @@ +--- +title: How to retrieve a collection of attributes - LINQ to XML +description: Learn how to use the XElement.Attributes method to retrieve the attributes of an element. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: a49ee7a3-b2c2-4d49-9b5c-b7c6c41f4f13 +--- + +# How to retrieve a collection of attributes (LINQ to XML) + +This article shows the use of the method to retrieve the attributes of an element. + +## Example: Iterate through the attributes of an element + +The following example shows how to iterate through the collection of attributes of an element. + +```csharp +XElement val = new XElement("Value", + new XAttribute("ID", "1243"), + new XAttribute("Type", "int"), + new XAttribute("ConvertableTo", "double"), + "100"); +IEnumerable listOfAttributes = + from att in val.Attributes() + select att; +foreach (XAttribute a in listOfAttributes) + Console.WriteLine(a); +``` + +```vb +Dim val = _ + 100 +Dim listOfAttributes As IEnumerable(Of XAttribute) = _ + From att In val.Attributes() _ + Select att +For Each att As XAttribute In listOfAttributes + Console.WriteLine(att) +Next +``` + +This example produces the following output: + +```output +ID="1243" +Type="int" +ConvertableTo="double" +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-collection-elements.md b/docs/standard/linq/retrieve-collection-elements.md new file mode 100644 index 0000000000000..2f88b63285820 --- /dev/null +++ b/docs/standard/linq/retrieve-collection-elements.md @@ -0,0 +1,50 @@ +--- +title: How to retrieve a collection of elements - LINQ to XML +description: Learn how to use the XContainer.Elements method to retrieve a collection of child elements of an element. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: b849668c-7976-4974-b8e1-1cd587d34258 +--- + +# How to retrieve a collection of elements (LINQ to XML) + +This article demonstrates the method, which retrieves a collection of the child elements of an element. + +## Example: Iterate through the child elements of an element + +This example iterates through the child elements of the `purchaseOrder` element. It uses XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +XElement po = XElement.Load("PurchaseOrder.xml"); +IEnumerable childElements = + from el in po.Elements() + select el; +foreach (XElement el in childElements) + Console.WriteLine("Name: " + el.Name); +``` + +```vb +Dim po As XElement = XElement.Load("PurchaseOrder.xml") +Dim childElements As IEnumerable(Of XElement) +childElements = _ + From el In po.Elements() _ + Select el +For Each el As XElement In childElements + Console.WriteLine("Name: " & el.Name.ToString()) +Next +``` + +This example produces the following output: + +```output +Name: Address +Name: Address +Name: DeliveryNotes +Name: Items +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-paragraphs-office-open-xml-document.md b/docs/standard/linq/retrieve-paragraphs-office-open-xml-document.md new file mode 100644 index 0000000000000..48a16f7528c6f --- /dev/null +++ b/docs/standard/linq/retrieve-paragraphs-office-open-xml-document.md @@ -0,0 +1,316 @@ +--- +title: How to retrieve paragraphs from an Office Open XML document - LINQ to XML +description: This article provides an example that opens an Office Open XML document and retrieves a collection of all of the paragraphs in the document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: cc2687cf-d648-451e-88ac-3847c6c967c8 +--- + +# How to retrieve paragraphs from an Office Open XML document (LINQ to XML) + +This article provides an example that opens an Office Open XML document and retrieves a collection of all of the paragraphs in the document. + +For more information on Office Open XML, see [Open XML SDK](https://github.com/OfficeDev/Open-XML-SDK) and [Eric White's Blog](http://www.ericwhite.com/). + +## Example: Retrieve the paragraphs from an Office Open XML document + +The example opens an Office Open XML package, and uses the relationships within the package to find the document and the style parts. It then queries the document and projects a collection that has the paragraph information. Each object of the collection represents a paragraph, and contains the paragraph node, the style name, and the text. + +The example operates on the Office Open XML document described in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +It makes use of the following: + +- The `StringConcatenate` extension method, defined as part of the example. +- Classes found in the WindowsBase assembly. +- Types in the namespace. + +```csharp +public static class LocalExtensions +{ + public static string StringConcatenate(this IEnumerable source) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (string s in source) + sb.Append(s).Append(separator); + return sb.ToString(); + } + + public static string StringConcatenate(this IEnumerable source, + Func func, string separator) + { + StringBuilder sb = new StringBuilder(); + foreach (T item in source) + sb.Append(func(item)).Append(separator); + return sb.ToString(); + } +} + +class Program +{ + public static string ParagraphText(XElement e) + { + XNamespace w = e.Name.Namespace; + return e + .Elements(w + "r") + .Elements(w + "t") + .StringConcatenate(element => (string)element); + } + + static void Main(string[] args) + { + const string fileName = "SampleDoc.docx"; + + const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; + const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + XNamespace w = wordmlNamespace; + + XDocument xDoc = null; + XDocument styleDoc = null; + + using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) + { + PackageRelationship docPackageRelationship = + wdPackage + .GetRelationshipsByType(documentRelationshipType) + .FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = + PackUriHelper + .ResolvePartUri( + new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = + wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType) + .FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } + } + + string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph" && + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + + // Find all paragraphs in the document. + var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + + // Retrieve the text of each paragraph. + var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = ParagraphText(para.ParagraphNode) + }; + + foreach (var p in paraWithText) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); + } +} +``` + +```vb +Imports + +Module Module1 + _ + Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As String In source + sb.Append(s) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String)) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each s As T In source + sb.Append(s).Append(separator) + Next + Return sb.ToString() + End Function + + _ + Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ + ByVal func As Func(Of T, String), ByVal separator As String) As String + Dim sb As StringBuilder = New StringBuilder() + For Each item As T In source + sb.Append(func(item)).Append(separator) + Next + Return sb.ToString() + End Function + + Public Function ParagraphText(ByVal e As XElement) As String + Dim w As XNamespace = e.Name.Namespace + Return (e..).StringConcatenate(Function(element) CStr(element)) + End Function + + ' The following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) _ + As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage _ + .GetRelationshipsByType(documentRelationshipType) _ + .FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = _ + PackUriHelper _ + .ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Retrieve the text of each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = ParagraphText(para.ParagraphNode) _ + } + + For Each p In paraWithText + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >using System;< +StyleName:Code >< +StyleName:Code >class Program {< +StyleName:Code > public static void (string[] args) {< +StyleName:Code > Console.WriteLine("Hello World");< +StyleName:Code > }< +StyleName:Code >}< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` diff --git a/docs/standard/linq/retrieve-paragraphs-styles.md b/docs/standard/linq/retrieve-paragraphs-styles.md new file mode 100644 index 0000000000000..247cb91f8d1d2 --- /dev/null +++ b/docs/standard/linq/retrieve-paragraphs-styles.md @@ -0,0 +1,219 @@ +--- +title: Retrieve the paragraphs and their styles - LINQ to XML +description: Learn how to retrieve paragraph nodes and their styles from a WordprocessingML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: c2f767f8-57b1-4b4b-af04-89ffb1f7067d +--- + +# Retrieve the paragraphs and their styles (LINQ to XML) + +In this example, we write a query that retrieves the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. + +This query builds on the query in the previous example, [Find the default paragraph style](find-default-paragraph-style.md), which retrieves the default style from the list of styles. This information is required so that the query can identify the style of paragraphs that don't have a style explicitly set. Paragraph styles are set through the `w:pPr` element; if a paragraph doesn't contain this element, it's formatted with the default style. + +This article explains the significance of some pieces of the query, then shows the query as part of a complete working example. + +## Example: Retrieve all the paragraphs in a document, and the paragraph styles + +The following code is a query to retrieve all the paragraphs in a document and their styles: + +```csharp +xDoc.Root.Element(w + "body").Descendants(w + "p") +``` + +```vb +xDoc.Root.... +``` + +This expression is similar to the source of the query in the previous example, [Find the default paragraph style](find-default-paragraph-style.md). The main difference is that it uses the axis instead of the axis. The query uses the axis because in documents that have sections, the paragraphs won't be the direct children of the body element; rather, the paragraphs will be two levels down in the hierarchy. By using the axis, the code will work whether or not the document uses sections. + +## Example: Use a `let` clause to determine the element that contains the style node + +The following query uses a `let` clause to determine the element that contains the style node: + +```csharp +let styleNode = para.Elements(w + "pPr").Elements(w + "pStyle").FirstOrDefault() +``` + + ```vb +Let styleNode As XElement = para...FirstOrDefault() +``` + +The `let` clause (`Let` in the Visual Basic version) first uses the axis to find all elements named `pPr`, then uses the extension method to find all child elements named `pStyle`, and finally uses the standard query operator to convert the collection to a singleton. If the collection is empty, `styleNode` is set to `null` (`Nothing` in the Visual Basic version). This is a useful idiom to look for the `pStyle` descendant node. Note that if the `pPr` child node doesn't exist, the code doesn't fail by throwing an exception; instead, `styleNode` is set to `null` (`Nothing`), which is the desired behavior of this `let`(`Let`) clause. + +If there is no element, then `styleNode` is set to `null` (`Nothing`). + +The query projects a collection of an anonymous type with two members, `StyleName` and `ParagraphNode`. + +## Example: Retrieve the paragraph nodes from a WordprocessingML document + +This example processes a WordprocessingML document, retrieving the paragraph nodes. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes found in the WindowsBase assembly. It uses types in the namespace. + +```csharp +const string fileName = "SampleDoc.docx"; + +const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; +const string stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; +const string wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; +XNamespace w = wordmlNamespace; + +XDocument xDoc = null; +XDocument styleDoc = null; + +using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) +{ + PackageRelationship docPackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } +} + +string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph"&& + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + +// Following is the new query that finds all paragraphs in the +// document and their styles. +var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + +foreach (var p in paragraphs) + Console.WriteLine("StyleName:{0}", p.StyleName); +``` + +```vb +Imports + +Module Module1 + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Following is the new query that finds all paragraphs in the + ' document and their styles. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault() _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + For Each p In paragraphs + Console.WriteLine("StyleName:{0}", p.StyleName) + Next + + End Sub +End Module +``` + +This example produces the following output: + +```output +StyleName:Heading1 +StyleName:Normal +StyleName:Normal +StyleName:Normal +StyleName:Code +StyleName:Code +StyleName:Code +StyleName:Code +StyleName:Code +StyleName:Code +StyleName:Code +StyleName:Normal +StyleName:Normal +StyleName:Normal +StyleName:Code +``` + +The next article in this tutorial shows how to create a query to retrieve the text of paragraphs: + +- [Retrieve the text of the paragraphs](retrieve-text-paragraphs.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) diff --git a/docs/standard/linq/retrieve-shallow-value-element.md b/docs/standard/linq/retrieve-shallow-value-element.md new file mode 100644 index 0000000000000..e85245f1ea184 --- /dev/null +++ b/docs/standard/linq/retrieve-shallow-value-element.md @@ -0,0 +1,114 @@ +--- +title: How to retrieve the shallow value of an element - LINQ to XML +description: Use the `ShallowValue` extension method to retrieve the shallow value of an element. The shallow value is the value of that element only; that is, it doesn't include the values of descendant elements. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 924a2699-72f6-4be1-aaa6-de62f8ec73b9 +--- +# How to retrieve the shallow value of an element (LINQ to XML) + +This article shows how to retrieve the shallow value of an element, which is the value of that element only, not including values of descendent elements. Retrieving the shallow value is useful when you want to select elements based on their content. + +When you use casting or the property to retrieve an element value, the value includes the descendants. To retrieve the shallow value you can use the `ShallowValue` extension method, as shown in the following example. The example declares an extension method that retrieves the shallow value of an element. It then uses the extension method in a query to list all elements that contain a calculated value. + +## Example: Use the `ShallowValue` extension method to retrieve the shallow value of an element + +The examples uses the text file Report.xml that contains the following: + +```xml + + +
+ + =Customer.CustomerId.Heading + =Customer.Name.Heading + + + =Customer.CustomerId + =Customer.Name + +
+
+``` + +Here is the code for the example: + +```csharp +public static class MyExtensions +{ + public static string ShallowValue(this XElement xe) + { + return xe + .Nodes() + .OfType() + .Aggregate(new StringBuilder(), + (s, c) => s.Append(c), + s => s.ToString()); + } +} + +class Program +{ + static void Main(string[] args) + { + XElement root = XElement.Load("Report.xml"); + + IEnumerable query = from el in root.Descendants() + where el.ShallowValue().StartsWith("=") + select el; + + foreach (var q in query) + { + Console.WriteLine("{0}{1}{2}", + q.Name.ToString().PadRight(8), + q.Attribute("Name").ToString().PadRight(20), + q.ShallowValue()); + } + } +} +``` + +```vb +Module Module1 + _ + Public Function ShallowValue(ByVal xe As XElement) + Return xe _ + .Nodes() _ + .OfType(Of XText)() _ + .Aggregate(New StringBuilder(), _ + Function(s, c) s.Append(c), _ + Function(s) s.ToString()) + End Function + + Sub Main() + Dim root As XElement = XElement.Load("Report.xml") + + Dim query As IEnumerable(Of XElement) = _ + From el In root.Descendants() _ + Where (el.ShallowValue().StartsWith("=")) _ + Select el + + For Each q As XElement In query + Console.WriteLine("{0}{1}{2}", _ + q.Name.ToString().PadRight(8), _ + q.Attribute("Name").ToString().PadRight(20), _ + q.ShallowValue()) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +Column Name="CustomerId" =Customer.CustomerId.Heading +Column Name="Name" =Customer.Name.Heading +Column Name="CustomerId" =Customer.CustomerId +Column Name="Name" =Customer.Name +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-single-attribute.md b/docs/standard/linq/retrieve-single-attribute.md new file mode 100644 index 0000000000000..b82a523c24684 --- /dev/null +++ b/docs/standard/linq/retrieve-single-attribute.md @@ -0,0 +1,147 @@ +--- +title: How to retrieve a single attribute - LINQ to XML +description: Retrieve a single attribute of an element, given the attribute name. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 1b6b07b9-933f-47e9-874e-e790cab49dc5 +--- + +# How to retrieve a single attribute (LINQ to XML) + +This article explains how to retrieve a single attribute of an element, given the attribute name. This is useful for writing query expressions where you want to find an element that has a particular attribute. + +The method of the class returns the with the specified name. + +## Example: Retrieve attribute values, given the element and attribute names + +The following example uses the method to create an element named `PhoneNumbers`. It then finds all the descendant elements named `Phone` and, for each, uses the method to obtain and output the value of the attribute named `type`: + +```csharp +XElement cust = new XElement("PhoneNumbers", + new XElement("Phone", + new XAttribute("type", "home"), + "555-555-5555"), + new XElement("Phone", + new XAttribute("type", "work"), + "555-555-6666") +); +IEnumerable elList = + from el in cust.Descendants("Phone") + select el; +foreach (XElement el in elList) + Console.WriteLine((string)el.Attribute("type")); +``` + +```vb +Dim cust As XElement = + 555-555-5555 + 555-555-6666 + +Dim elList = From el In cust... +For Each e As XElement In elList + Console.WriteLine(e.@type) +Next +``` + +This example produces the following output: + +```output +home +work +``` + +## Example: Retrieve an attribute value with a cast + +You can retrieve the value of an attribute by casting it, just as you do for with objects. The following example demonstrates this: + +```csharp +XElement cust = new XElement("PhoneNumbers", + new XElement("Phone", + new XAttribute("type", "home"), + "555-555-5555"), + new XElement("Phone", + new XAttribute("type", "work"), + "555-555-6666") +); +IEnumerable elList = + from el in cust.Descendants("Phone") + select el; +foreach (XElement el in elList) + Console.WriteLine((string)el.Attribute("type")); +``` + +```vb +Dim cust As XElement = + 555-555-5555 + 555-555-6666 + +Dim elList As IEnumerable(Of XElement) = _ + From el In cust... _ + Select el +For Each el As XElement In elList + Console.WriteLine(el.@type) +Next +``` + +This example produces the following output: + +```output +home +work +``` + +LINQ to XML provides explicit cast operators for the class to `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. + +## Example: Cast for an attribute in a namespace + +The following example shows the same code for an attribute that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement cust = new XElement(aw + "PhoneNumbers", + new XElement(aw + "Phone", + new XAttribute(aw + "type", "home"), + "555-555-5555"), + new XElement(aw + "Phone", + new XAttribute(aw + "type", "work"), + "555-555-6666") +); +IEnumerable elList = + from el in cust.Descendants(aw + "Phone") + select el; +foreach (XElement el in elList) + Console.WriteLine((string)el.Attribute(aw + "type")); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim cust As XElement = _ + + 555-555-5555 + 555-555-6666 + + Dim elList As IEnumerable(Of XElement) = _ + From el In cust... _ + Select el + For Each el As XElement In elList + Console.WriteLine(el.@aw:type) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +home +work +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-single-child-element.md b/docs/standard/linq/retrieve-single-child-element.md new file mode 100644 index 0000000000000..3b39b08016f1c --- /dev/null +++ b/docs/standard/linq/retrieve-single-child-element.md @@ -0,0 +1,65 @@ +--- +title: How to retrieve a single child element - LINQ to XML +description: Retrieve the first child element that has a specified name. You can use XContainer.Element in C#, and array indexer notation in Visual Basic. +ms.date: 07/20/2015 +ms.assetid: ce37db9e-76fa-46eb-b4cc-e8f32d22ad90 +--- + +# How to retrieve a single child element (LINQ to XML) + +This article explains how to retrieve a single child element, the first child element that has a specified name. In C# you do this with the method. In Visual Basic you do it with array indexer notation. + +## Example: Retrieve the first element that has a specified name + +The following example retrieves the first `DeliveryNotes` element from the XML document in [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +XElement po = XElement.Load("PurchaseOrder.xml"); +XElement e = po.Element("DeliveryNotes"); +Console.WriteLine(e); +``` + +```vb +Dim po As XElement = XElement.Load("PurchaseOrder.xml") +Dim e As XElement = po.(0) +Console.WriteLine(e) +``` + +This example produces the following output: + +```xml +Please leave packages in shed by driveway. +``` + +## Example: Retrieve from XML that's in a namespace + +The following example does the same thing as the one above, but for XML that's in a namespace. It uses the XML document [Sample XML file: Typical purchase order in a namespace](sample-xml-file-typical-purchase-order-namespace.md). For more information about namespaces, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement po = XElement.Load("PurchaseOrderInNamespace.xml"); +XNamespace aw = "http://www.adventure-works.com"; +XElement e = po.Element(aw + "DeliveryNotes"); +Console.WriteLine(e); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim po As XElement = XElement.Load("PurchaseOrderInNamespace.xml") + Dim e As XElement = po.(0) + Console.WriteLine(e) + End Sub +End Module +``` + +This example produces the following output: + +```xml +Please leave packages in shed by driveway. +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-text-paragraphs.md b/docs/standard/linq/retrieve-text-paragraphs.md new file mode 100644 index 0000000000000..03d5ef80ce6c6 --- /dev/null +++ b/docs/standard/linq/retrieve-text-paragraphs.md @@ -0,0 +1,257 @@ +--- +title: Retrieve the text of the paragraphs - LINQ to XML +description: Learn how to find the paragraph nodes in a WordprocessingML document, and to retrieve the text from each node as a string. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 127d635e-e559-408f-90c8-2bb621ca50ac +--- + +# Retrieve the text of the paragraphs (LINQ to XML) + +This example builds on the previous example, [Retrieve the paragraphs and their styles](retrieve-paragraphs-styles.md). This new example retrieves the text of each paragraph as a string. + +To retrieve the text, this example adds an additional query that iterates through the collection of anonymous types and projects a new collection of an anonymous type with the addition of a new member, `Text`. It uses the standard query operator to concatenate multiple strings into one string. + +This technique (that is, first projecting to a collection of an anonymous type, then using this collection to project to a new collection of an anonymous type) is a common and useful one. This query could have been written without projecting to the first anonymous type. However, because of lazy evaluation, doing so doesn't use much additional processing power. The technique does create more short-lived objects on the heap, but that doesn't substantially degrade performance. + +Of course, it would be possible to write a single query that contains the functionality to retrieve the paragraphs, the style of each paragraph, and the text of each paragraph. However, it's often useful to break up a more complicated query into multiple queries because the resulting code is more modular and easier to maintain. Further, if you need to reuse a portion of the query, it's easier to refactor if the queries are written in this manner. + +These queries, which are chained together, use the processing model that's examined in the article [Chain queries example](chain-queries-example.md). + +## Example: Determine the element node, style name, and text of each paragraph + +This example processes a WordprocessingML document, determining the element node, style name, and text of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. + +The instructions for creating the source document for this example are in [Create the source Office Open XML document](create-source-office-open-xml-document.md). + +This example uses classes from the WindowsBase assembly. It uses types in the namespace. + +```csharp +const string fileName = "SampleDoc.docx"; + +const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; +const string stylesRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; +const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; +XNamespace w = wordmlNamespace; + +XDocument xDoc = null; +XDocument styleDoc = null; + +using (Package wdPackage = Package.Open(fileName, FileMode.Open, FileAccess.Read)) +{ + PackageRelationship docPackageRelationship = + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault(); + if (docPackageRelationship != null) + { + Uri documentUri = PackUriHelper.ResolvePartUri(new Uri("/", UriKind.Relative), + docPackageRelationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())); + + // Find the styles part. There will only be one. + PackageRelationship styleRelation = + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault(); + if (styleRelation != null) + { + Uri styleUri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri); + PackagePart stylePart = wdPackage.GetPart(styleUri); + + // Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())); + } + } +} + +string defaultStyle = + (string)( + from style in styleDoc.Root.Elements(w + "style") + where (string)style.Attribute(w + "type") == "paragraph"&& + (string)style.Attribute(w + "default") == "1" + select style + ).First().Attribute(w + "styleId"); + +// Find all paragraphs in the document. +var paragraphs = + from para in xDoc + .Root + .Element(w + "body") + .Descendants(w + "p") + let styleNode = para + .Elements(w + "pPr") + .Elements(w + "pStyle") + .FirstOrDefault() + select new + { + ParagraphNode = para, + StyleName = styleNode != null ? + (string)styleNode.Attribute(w + "val") : + defaultStyle + }; + +// Following is the new query that retrieves the text of +// each paragraph. +var paraWithText = + from para in paragraphs + select new + { + ParagraphNode = para.ParagraphNode, + StyleName = para.StyleName, + Text = para + .ParagraphNode + .Elements(w + "r") + .Elements(w + "t") + .Aggregate( + new StringBuilder(), + (s, i) => s.Append((string)i), + s => s.ToString() + ) + }; + +foreach (var p in paraWithText) + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text); +``` + +```vb +Imports + +Module Module1 + ' Following function is required because Visual Basic doesn't support short circuit evaluation + Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ + ByVal defaultStyle As String) As String + If (styleNode Is Nothing) Then + Return defaultStyle + Else + Return styleNode.@w:val + End If + End Function + + Sub Main() + Dim fileName = "SampleDoc.docx" + + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + Dim stylesRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" + Dim wordmlNamespace = _ + "http://schemas.openxmlformats.org/wordprocessingml/2006/main" + + Dim xDoc As XDocument = Nothing + Dim styleDoc As XDocument = Nothing + Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = _ + wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Load the document XML in the part into an XDocument instance. + xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) + + ' Find the styles part. There will only be one. + Dim styleRelation As PackageRelationship = _ + documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() + If (styleRelation IsNot Nothing) Then + Dim styleUri As Uri = _ + PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) + Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) + + ' Load the style XML in the part into an XDocument instance. + styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) + End If + End If + End Using + + Dim defaultStyle As String = _ + ( _ + From style In styleDoc.Root. _ + Where style.@w:type = "paragraph" And _ + style.@w:default = "1" _ + Select style _ + ).First().@w:styleId + + ' Find all paragraphs in the document. + Dim paragraphs = _ + From para In xDoc.Root.... _ + Let styleNode As XElement = para...FirstOrDefault _ + Select New With { _ + .ParagraphNode = para, _ + .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ + } + + ' Following is the new query that retrieves the text of + ' each paragraph. + Dim paraWithText = _ + From para In paragraphs _ + Select New With { _ + .ParagraphNode = para.ParagraphNode, _ + .StyleName = para.StyleName, _ + .Text = para.ParagraphNode.. _ + .Aggregate(New StringBuilder(), _ + Function(s As StringBuilder, i As String) s.Append(CStr(i)), _ + Function(s As StringBuilder) s.ToString) _ + } + + For Each p In paraWithText + Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) + Next + + End Sub +End Module +``` + +The C# version of this example produces the following output: + +```conssole +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >using System;< +StyleName:Code >< +StyleName:Code >class Program {< +StyleName:Code > public static void (string[] args) {< +StyleName:Code > Console.WriteLine("Hello World");< +StyleName:Code > }< +StyleName:Code >}< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` + +The Visual Basic version of this example produces the following output: + +```output +StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< +StyleName:Normal >< +StyleName:Normal >The following example prints to the console.< +StyleName:Normal >< +StyleName:Code >Imports System< +StyleName:Code >< +StyleName:Code >Class Program< +StyleName:Code > Public Shared Sub Main(ByVal args() As String)< +StyleName:Code > Console.WriteLine("Hello World")< +StyleName:Code > End Sub< +StyleName:Code >End Class< +StyleName:Normal >< +StyleName:Normal >This example produces the following output:< +StyleName:Normal >< +StyleName:Code >Hello World< +``` + +The next article in this tutorial shows how to use an extension method, instead of , to concatenate multiple strings into a single string: + +- [Refactor using an extension method](refactor-extension-method.md) + +## See also + +- [Tutorial: Manipulate content in a WordprocessingML document](xml-shape-wordprocessingml-documents.md) +- [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md) diff --git a/docs/standard/linq/retrieve-value-attribute.md b/docs/standard/linq/retrieve-value-attribute.md new file mode 100644 index 0000000000000..879f1cb953cc9 --- /dev/null +++ b/docs/standard/linq/retrieve-value-attribute.md @@ -0,0 +1,72 @@ +--- +title: How to retrieve the value of an attribute - LINQ to XML +description: Retrieve the value of an attribute. You can cast an XAttribute to the desired type, or use the XAttribute.Value property. +ms.date: 07/20/2015 +ms.assetid: 817bbe89-5979-4234-bf0c-46f63692ac8c +--- + +# How to retrieve the value of an attribute (LINQ to XML) + +This article shows how to obtain the value of attributes. There are two main ways: You can cast an to the desired type; the explicit conversion operator then converts the contents of the element or attribute to the specified type. Alternatively, you can use the property. However, casting is generally the better approach. If you cast the attribute to a nullable value type, the code is simpler to write when retrieving the value of an attribute that might or might not exist. For examples of this technique, see [How to retrieve the value of an element](retrieve-value-element.md). + +## Example: Use a cast to retrieve the value of an attribute + +To retrieve the value of an attribute in C#, you cast the object to your desired type. In Visual Basic, you can use the integrated attribute property to retrieve the value. + +```csharp +XElement root = new XElement("Root", + new XAttribute("Attr", "abcde") + ); +Console.WriteLine(root); +string str = (string)root.Attribute("Attr"); +Console.WriteLine(str); +``` + +```vb +Dim root As XElement = +Console.WriteLine(root) +Dim str As String = root.@Attr +Console.WriteLine(str) +``` + +This example produces the following output: + +```output + +abcde +``` + +## Example: Use a cast to retrieve from XML that's in a namespace + +The following example shows how to retrieve the value of an attribute if the attribute is in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement root = new XElement(aw + "Root", + new XAttribute(aw + "Attr", "abcde") + ); +string str = (string)root.Attribute(aw + "Attr"); +Console.WriteLine(str); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = + Dim str As String = root.@aw:Attr + Console.WriteLine(str) + End Sub +End Module +``` + +This example produces the following output: + +```output +abcde +``` + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/standard/linq/retrieve-value-element.md b/docs/standard/linq/retrieve-value-element.md new file mode 100644 index 0000000000000..941c3845f018a --- /dev/null +++ b/docs/standard/linq/retrieve-value-element.md @@ -0,0 +1,242 @@ +--- +title: How to retrieve the value of an element - LINQ to XML +description: "Learn the two main ways to get the value of an element or attribute: cast to the desired type, or use the XElement.Value and XAttribute.Value properties." +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4228c007-07c9-4cf2-a45b-e7074c109581 +--- + +# How to retrieve the value of an element (LINQ to XML) + +This article shows how to get the value of elements. There are two main ways to get the value: + +- Cast an or an to the desired type. The explicit conversion operator then converts the contents of the element or attribute to the specified type and assigns it to your variable. + +- Use the or properties. You can also set the value using these properties. + +With C#, casting is generally the better approach. If you cast the element or attribute to a nullable value type, the code is simpler to write when retrieving the value of an element (or attribute) that may not exist. The last example in this article demonstrates this. However, you can't set the contents of an element through casting, as you can through property. + +With Visual Basic, the better approach is to use the property. + +## String cast example + +To retrieve the value of an element, cast the object to your desired type. You can cast an element to a string, as follows: + +```csharp +XElement e = new XElement("StringElement", "abcde"); +Console.WriteLine(e); +Console.WriteLine("Value of e:" + (string)e); +``` + +```vb +Dim e As XElement = abcde +Console.WriteLine(e) +Console.WriteLine("Value of e:" & e.Value) +``` + +This example produces the following output: + +```output +abcde +Value of e:abcde +``` + +## Integer cast example + +You can also cast elements to types other than string. For example, if you have an element that contains an integer, you can cast it to `int`, as shown in the following code: + +```csharp +XElement e = new XElement("Age", "44"); +Console.WriteLine(e); +Console.WriteLine("Value of e:" + (int)e); +``` + +```vb +Dim e As XElement = 44 +Console.WriteLine(e) +Console.WriteLine("Value of e:" & CInt(e)) +``` + +This example produces the following output: + +```output +44 +Value of e:44 +``` + +LINQ to XML provides explicit cast operators for the following data types: `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. + +LINQ to XML provides the same cast operators for objects. + +## Value property example + +You can use the property to retrieve the contents of an element: + +```csharp +XElement e = new XElement("StringElement", "abcde"); +Console.WriteLine(e); +Console.WriteLine("Value of e:" + e.Value); +``` + +```vb +Dim e As XElement = abcde +Console.WriteLine(e) +Console.WriteLine("Value of e:" & e.Value) +``` + +This example produces the following output: + +```output +abcde +Value of e:abcde +``` + +## Element might not exist example + +Sometimes you try to retrieve the value of an element even though you're not sure if it exists. In this case, when you assign the casted element to a nullable reference type or nullable value type, if the element doesn't exist, the assigned variable is set to `null` (C#) or `nothing` (Visual Basic). The following code shows that when the element may not exist, it's easier to use casting than to use the property. + +```csharp +XElement root = new XElement("Root", + new XElement("Child1", "child 1 content"), + new XElement("Child2", "2") +); + +// The following assignments show why it's easier to use +// casting when the element might or might not exist. + +string c1 = (string)root.Element("Child1"); +Console.WriteLine("c1:{0}", c1 == null ? "element doesn't exist" : c1); + +int? c2 = (int?)root.Element("Child2"); +Console.WriteLine("c2:{0}", c2 == null ? "element doesn't exist" : c2.ToString()); + +string c3 = (string)root.Element("Child3"); +Console.WriteLine("c3:{0}", c3 == null ? "element doesn't exist" : c3); + +int? c4 = (int?)root.Element("Child4"); +Console.WriteLine("c4:{0}", c4 == null ? "element doesn't exist" : c4.ToString()); + +Console.WriteLine(); + +// The following assignments show the required code when using +// the Value property when the element might or might not exist. +// Notice that this is more difficult than the casting approach. + +XElement e1 = root.Element("Child1"); +string v1; +if (e1 == null) + v1 = null; +else + v1 = e1.Value; +Console.WriteLine("v1:{0}", v1 == null ? "element doesn't exist" : v1); + +XElement e2 = root.Element("Child2"); +int? v2; +if (e2 == null) + v2 = null; +else + v2 = Int32.Parse(e2.Value); +Console.WriteLine("v2:{0}", v2 == null ? "element doesn't exist" : v2.ToString()); + +XElement e3 = root.Element("Child3"); +string v3; +if (e3 == null) + v3 = null; +else + v3 = e3.Value; +Console.WriteLine("v3:{0}", v3 == null ? "element doesn't exist" : v3); + +XElement e4 = root.Element("Child4"); +int? v4; +if (e4 == null) + v4 = null; +else + v4 = Int32.Parse(e4.Value); +Console.WriteLine("v4:{0}", v4 == null ? "element doesn't exist" : v4.ToString()); +``` + +```vb +Dim root As XElement = + child 1 content + 2 + + +' The following assignments show why it's easier to use +' casting when the element might or might not exist. + +Dim c1 As String = CStr(root.Element("Child1")) +Console.WriteLine("c1:{0}", IIf(c1 Is Nothing, "element doesn't exist", c1)) + +Dim c2 As Nullable(Of Integer) = CType(root.Element("Child2"), Nullable(Of Integer)) +Console.WriteLine("c2:{0}", IIf(Not (c2.HasValue), "element doesn't exist", c2.ToString())) + +Dim c3 As String = CStr(root.Element("Child3")) +Console.WriteLine("c3:{0}", IIf(c3 Is Nothing, "element doesn't exist", c3)) + +Dim c4 As Nullable(Of Integer) = CType(root.Element("Child4"), Nullable(Of Integer)) +Console.WriteLine("c4:{0}", IIf(Not (c4.HasValue), "element doesn't exist", c4.ToString())) + +Console.WriteLine() + +' The following assignments show the required code when using +' the Value property when the attribute might or might not exist. +' Notice that this is more difficult than the casting approach. + +Dim e1 As XElement = root.Element("Child1") +Dim v1 As String +If (e1 Is Nothing) Then + v1 = Nothing +Else + v1 = e1.Value +End If +Console.WriteLine("v1:{0}", IIf(v1 Is Nothing, "element doesn't exist", v1)) + +Dim e2 As XElement = root.Element("Child2") +Dim v2 As Nullable(Of Integer) +If (e2 Is Nothing) Then + v2 = Nothing +Else + v2 = e2.Value +End If +Console.WriteLine("v2:{0}", IIf(Not (v2.HasValue), "element doesn't exist", v2)) + +Dim e3 As XElement = root.Element("Child3") +Dim v3 As String +If (e3 Is Nothing) Then + v3 = Nothing +Else + v3 = e3.Value +End If +Console.WriteLine("v3:{0}", IIf(v3 Is Nothing, "element doesn't exist", v3)) + +Dim e4 As XElement = root.Element("Child4") +Dim v4 As Nullable(Of Integer) +If (e4 Is Nothing) Then + v4 = Nothing +Else + v4 = e4.Value +End If +Console.WriteLine("v4:{0}", IIf(Not (v4.HasValue), "element doesn't exist", v4)) +``` + +This example produces the following output: + +```output +c1:child 1 content +c2:2 +c3:element doesn't exist +c4:element doesn't exist + +v1:child 1 content +v2:2 +v3:element doesn't exist +v4:element doesn't exist +``` + +In general, you can write simpler code by casting to retrieve the contents of elements and attributes. + +## See also + +- [LINQ to XML axes overview](linq-xml-axes-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md b/docs/standard/linq/sample-xml-file-books.md similarity index 65% rename from docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md rename to docs/standard/linq/sample-xml-file-books.md index 9387e1b83fc01..cf01022602ddb 100644 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-books-linq-to-xml.md +++ b/docs/standard/linq/sample-xml-file-books.md @@ -1,11 +1,12 @@ --- -title: "Sample XML File: Books (LINQ to XML)" +title: "Sample XML file: Books - LINQ to XML" +description: This XML file—which is used in examples—has data about books. ms.date: 07/20/2015 -ms.assetid: 27ca5847-2289-40c0-8331-ede67ec59d1c +ms.assetid: b75ab1a2-fb76-4df9-bd01-c45ec22a29ef --- -# Sample XML File: Books (LINQ to XML) +# Sample XML file: Books (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. The file contains information about books. +The following XML file is used in various examples in the LINQ to XML documentation. The file contains information about books. ## books.xml @@ -36,4 +37,4 @@ The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq] ## See also -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) +- [Sample XML Documents (LINQ to XML)](sample-xml-file-typical-purchase-order.md) diff --git a/docs/standard/linq/sample-xml-file-consolidated-purchase-orders.md b/docs/standard/linq/sample-xml-file-consolidated-purchase-orders.md new file mode 100644 index 0000000000000..e5ce214d89938 --- /dev/null +++ b/docs/standard/linq/sample-xml-file-consolidated-purchase-orders.md @@ -0,0 +1,141 @@ +--- +title: "Sample XML file: Consolidated purchase orders - LINQ to XML" +description: This XML file—which is used in examples—has data about consolidated purchase orders. +ms.date: 07/20/2015 +ms.assetid: 9d9698a5-95f2-4564-813b-ba536cdf3bfb +--- +# Sample XML file: Consolidated purchase orders (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file is a set of purchase orders with different shapes from multiple companies. Purchase orders from each company are in separate namespaces. + +## ConsolidatedPurchaseOrders.xml + +```xml + + + +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+ Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +
+ +
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+ Please notify by email before shipping. + + + Power Supply + 1 + 45.99 + + +
+ +
+ Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA +
+
+ Jessica Arnold + 4055 Madison Ave + Buffalo + NY + 98112 + USA +
+ Please don't deliver on Saturday. + + + Computer Keyboard + 1 + 29.99 + + + Wireless Mouse + 1 + 14.99 + + +
+ + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + + Chris Preston + 123 Main St. + Seattle + WA + 98113 + USA + + Ship only complete order. + + Litware Networking Card + 1 + 20.99 + + + Litware 17in LCD Monitor + 1 + 199.99 + + +
+``` diff --git a/docs/standard/linq/sample-xml-file-customers-orders-namespace.md b/docs/standard/linq/sample-xml-file-customers-orders-namespace.md new file mode 100644 index 0000000000000..d29e4438a3dff --- /dev/null +++ b/docs/standard/linq/sample-xml-file-customers-orders-namespace.md @@ -0,0 +1,427 @@ +--- +title: "Sample XML file: Customers and orders in a namespace- LINQ to XML" +description: This XML file—which is used in examples—has data, in a namespace, about customers and orders. +ms.date: 07/20/2015 +ms.assetid: 2da1c474-f658-4dca-a457-c35ef5ba4aff +--- +# Sample XML file: Customers and orders in a namespace (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains customers and orders. The XML is in a namespace. + +## CustomersOrdersInNamespace.xml + +```xml + + + + + Great Lakes Food Market + Howard Snyder + Marketing Manager + (503) 555-7555 + +
2732 Baker Blvd.
+ Eugene + OR + 97403 + USA +
+
+ + Hungry Coyote Import Store + Yoshi Latimer + Sales Representative + (503) 555-6874 + (503) 555-2376 + +
City Center Plaza 516 Main St.
+ Elgin + OR + 97827 + USA +
+
+ + Lazy K Kountry Store + John Steel + Marketing Manager + (509) 555-7969 + (509) 555-6221 + +
12 Orchestra Terrace
+ Walla Walla + WA + 99362 + USA +
+
+ + Let's Stop N Shop + Jaime Yorres + Owner + (415) 555-5938 + +
87 Polk St. Suite 5
+ San Francisco + CA + 94117 + USA +
+
+
+ + + GREAL + 6 + 1997-05-06T00:00:00 + 1997-05-20T00:00:00 + + 2 + 3.35 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 8 + 1997-07-04T00:00:00 + 1997-08-01T00:00:00 + + 2 + 4.42 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 1 + 1997-07-31T00:00:00 + 1997-08-28T00:00:00 + + 2 + 116.53 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1997-07-31T00:00:00 + 1997-08-28T00:00:00 + + 2 + 18.53 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 6 + 1997-09-04T00:00:00 + 1997-10-02T00:00:00 + + 1 + 57.15 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1997-09-25T00:00:00 + 1997-10-23T00:00:00 + + 3 + 76.13 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-01-06T00:00:00 + 1998-02-03T00:00:00 + + 2 + 719.78 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1998-03-09T00:00:00 + 1998-04-06T00:00:00 + + 2 + 33.68 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1998-04-07T00:00:00 + 1998-05-05T00:00:00 + + 2 + 25.19 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-04-22T00:00:00 + 1998-05-20T00:00:00 + + 3 + 18.84 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-04-30T00:00:00 + 1998-06-11T00:00:00 + + 3 + 14.01 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + HUNGC + 3 + 1996-12-06T00:00:00 + 1997-01-03T00:00:00 + + 2 + 20.12 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 1 + 1996-12-25T00:00:00 + 1997-01-22T00:00:00 + + 3 + 30.34 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 3 + 1997-01-15T00:00:00 + 1997-02-12T00:00:00 + + 1 + 0.2 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 4 + 1997-07-16T00:00:00 + 1997-08-13T00:00:00 + + 1 + 45.13 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 8 + 1997-09-08T00:00:00 + 1997-10-06T00:00:00 + + 1 + 111.29 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + LAZYK + 1 + 1997-03-21T00:00:00 + 1997-04-18T00:00:00 + + 3 + 7.48 + Lazy K Kountry Store + 12 Orchestra Terrace + Walla Walla + WA + 99362 + USA + + + + LAZYK + 8 + 1997-05-22T00:00:00 + 1997-06-19T00:00:00 + + 2 + 11.92 + Lazy K Kountry Store + 12 Orchestra Terrace + Walla Walla + WA + 99362 + USA + + + + LETSS + 1 + 1997-06-25T00:00:00 + 1997-07-23T00:00:00 + + 2 + 13.73 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 8 + 1997-10-27T00:00:00 + 1997-11-24T00:00:00 + + 2 + 51.44 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 6 + 1997-11-10T00:00:00 + 1997-12-08T00:00:00 + + 2 + 45.97 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 4 + 1998-02-12T00:00:00 + 1998-03-12T00:00:00 + + 2 + 90.97 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + +
+``` diff --git a/docs/standard/linq/sample-xml-file-customers-orders.md b/docs/standard/linq/sample-xml-file-customers-orders.md new file mode 100644 index 0000000000000..32cee92d2e6f5 --- /dev/null +++ b/docs/standard/linq/sample-xml-file-customers-orders.md @@ -0,0 +1,431 @@ +--- +title: "Sample XML file: Customers and orders- LINQ to XML" +description: This XML file—which is used in examples—has data about customers and orders. +ms.date: 07/20/2015 +ms.assetid: d6d1c9ea-be74-4e6d-bfdd-d4bcc2d301cf +--- +# Sample XML file: Customers and orders (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains customers and orders. + +The article [Sample XSD file: Customers and orders](sample-xsd-file-customers-orders.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. + +For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to join two collections](join-two-collections.md). + +## CustomersOrders.xml + +```xml + + + + + Great Lakes Food Market + Howard Snyder + Marketing Manager + (503) 555-7555 + +
2732 Baker Blvd.
+ Eugene + OR + 97403 + USA +
+
+ + Hungry Coyote Import Store + Yoshi Latimer + Sales Representative + (503) 555-6874 + (503) 555-2376 + +
City Center Plaza 516 Main St.
+ Elgin + OR + 97827 + USA +
+
+ + Lazy K Kountry Store + John Steel + Marketing Manager + (509) 555-7969 + (509) 555-6221 + +
12 Orchestra Terrace
+ Walla Walla + WA + 99362 + USA +
+
+ + Let's Stop N Shop + Jaime Yorres + Owner + (415) 555-5938 + +
87 Polk St. Suite 5
+ San Francisco + CA + 94117 + USA +
+
+
+ + + GREAL + 6 + 1997-05-06T00:00:00 + 1997-05-20T00:00:00 + + 2 + 3.35 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 8 + 1997-07-04T00:00:00 + 1997-08-01T00:00:00 + + 2 + 4.42 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 1 + 1997-07-31T00:00:00 + 1997-08-28T00:00:00 + + 2 + 116.53 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1997-07-31T00:00:00 + 1997-08-28T00:00:00 + + 2 + 18.53 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 6 + 1997-09-04T00:00:00 + 1997-10-02T00:00:00 + + 1 + 57.15 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1997-09-25T00:00:00 + 1997-10-23T00:00:00 + + 3 + 76.13 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-01-06T00:00:00 + 1998-02-03T00:00:00 + + 2 + 719.78 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1998-03-09T00:00:00 + 1998-04-06T00:00:00 + + 2 + 33.68 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 3 + 1998-04-07T00:00:00 + 1998-05-05T00:00:00 + + 2 + 25.19 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-04-22T00:00:00 + 1998-05-20T00:00:00 + + 3 + 18.84 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + GREAL + 4 + 1998-04-30T00:00:00 + 1998-06-11T00:00:00 + + 3 + 14.01 + Great Lakes Food Market + 2732 Baker Blvd. + Eugene + OR + 97403 + USA + + + + HUNGC + 3 + 1996-12-06T00:00:00 + 1997-01-03T00:00:00 + + 2 + 20.12 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 1 + 1996-12-25T00:00:00 + 1997-01-22T00:00:00 + + 3 + 30.34 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 3 + 1997-01-15T00:00:00 + 1997-02-12T00:00:00 + + 1 + 0.2 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 4 + 1997-07-16T00:00:00 + 1997-08-13T00:00:00 + + 1 + 45.13 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + HUNGC + 8 + 1997-09-08T00:00:00 + 1997-10-06T00:00:00 + + 1 + 111.29 + Hungry Coyote Import Store + City Center Plaza 516 Main St. + Elgin + OR + 97827 + USA + + + + LAZYK + 1 + 1997-03-21T00:00:00 + 1997-04-18T00:00:00 + + 3 + 7.48 + Lazy K Kountry Store + 12 Orchestra Terrace + Walla Walla + WA + 99362 + USA + + + + LAZYK + 8 + 1997-05-22T00:00:00 + 1997-06-19T00:00:00 + + 2 + 11.92 + Lazy K Kountry Store + 12 Orchestra Terrace + Walla Walla + WA + 99362 + USA + + + + LETSS + 1 + 1997-06-25T00:00:00 + 1997-07-23T00:00:00 + + 2 + 13.73 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 8 + 1997-10-27T00:00:00 + 1997-11-24T00:00:00 + + 2 + 51.44 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 6 + 1997-11-10T00:00:00 + 1997-12-08T00:00:00 + + 2 + 45.97 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + + LETSS + 4 + 1998-02-12T00:00:00 + 1998-03-12T00:00:00 + + 2 + 90.97 + Let's Stop N Shop + 87 Polk St. Suite 5 + San Francisco + CA + 94117 + USA + + + +
+``` diff --git a/docs/standard/linq/sample-xml-file-multiple-purchase-orders-namespace.md b/docs/standard/linq/sample-xml-file-multiple-purchase-orders-namespace.md new file mode 100644 index 0000000000000..7d1928bea1caf --- /dev/null +++ b/docs/standard/linq/sample-xml-file-multiple-purchase-orders-namespace.md @@ -0,0 +1,106 @@ +--- +title: "Sample XML file: Multiple purchase orders in a namespace- LINQ to XML" +description: This XML file—which is used in examples—has data, in a namespace, about purchase orders. +ms.date: 07/20/2015 +ms.assetid: 595024f2-374a-4615-acb5-64fa1600f377 +--- +# Sample XML file: Multiple purchase orders in a namespace (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains several purchase orders. The XML is in a namespace. + +## PurchaseOrdersInNamespace.xml + +```xml + + + + + Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA + + + Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA + + Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + + + + + Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA + + + Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA + + Please notify me before shipping. + + + Power Supply + 1 + 45.99 + + + + + + Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA + + + Jessica Arnold + 4055 Madison Ave + Buffalo + NY + 98112 + USA + + + + Computer Keyboard + 1 + 29.99 + + + Wireless Mouse + 1 + 14.99 + + + + +``` diff --git a/docs/standard/linq/sample-xml-file-multiple-purchase-orders.md b/docs/standard/linq/sample-xml-file-multiple-purchase-orders.md new file mode 100644 index 0000000000000..e6c86c901d97c --- /dev/null +++ b/docs/standard/linq/sample-xml-file-multiple-purchase-orders.md @@ -0,0 +1,106 @@ +--- +title: "Sample XML file: Multiple purchase orders - LINQ to XML" +description: This XML file—which is used in examples—has data about purchase orders. +ms.date: 07/20/2015 +ms.assetid: 2d29fcaa-60df-43d4-8ccc-6cdba7c013e9 +--- +# Sample XML file: Multiple purchase orders (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains several purchase orders. + +## PurchaseOrders.xml + +```xml + + + +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+ Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +
+ +
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+
+ Cristian Osorio + 456 Main Street + Buffalo + NY + 98112 + USA +
+ Please notify me before shipping. + + + Power Supply + 1 + 45.99 + + +
+ +
+ Jessica Arnold + 4055 Madison Ave + Seattle + WA + 98112 + USA +
+
+ Jessica Arnold + 4055 Madison Ave + Buffalo + NY + 98112 + USA +
+ + + Computer Keyboard + 1 + 29.99 + + + Wireless Mouse + 1 + 14.99 + + +
+
+``` diff --git a/docs/standard/linq/sample-xml-file-numerical-data-namespace.md b/docs/standard/linq/sample-xml-file-numerical-data-namespace.md new file mode 100644 index 0000000000000..f9bb0c66195af --- /dev/null +++ b/docs/standard/linq/sample-xml-file-numerical-data-namespace.md @@ -0,0 +1,52 @@ +--- +title: "Sample XML file: Numerical data in a namespace - LINQ to XML" +description: This XML file—which is used in examples—has numerical data in a namespace. +ms.date: 07/20/2015 +ms.assetid: 51750cab-3c66-4511-90fb-b9d211308d31 +--- +# Sample XML file: Numerical data in a namespace (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains numerical data for summing, averaging, and grouping. The XML is in a namespace. + +## Data + +```xml + + 7.25 + + A + 3 + 24.50 + + + B + 1 + 89.99 + + + A + 5 + 4.95 + + + A + 3 + 66.00 + + + B + 10 + .99 + + + A + 15 + 29.00 + + + B + 8 + 6.99 + + +``` diff --git a/docs/standard/linq/sample-xml-file-numerical-data.md b/docs/standard/linq/sample-xml-file-numerical-data.md new file mode 100644 index 0000000000000..26bf480330b6f --- /dev/null +++ b/docs/standard/linq/sample-xml-file-numerical-data.md @@ -0,0 +1,52 @@ +--- +title: "Sample XML file: Numerical data - LINQ to XML" +description: This XML file—which is used in examples—has numerical data. +ms.date: 07/20/2015 +ms.assetid: 365cae86-a166-46df-b56a-0209d9771c27 +--- +# Sample XML file: Numerical data (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file contains numerical data for summing, averaging, and grouping. + +## Data.xml + +```xml + + 7.25 + + A + 3 + 24.50 + + + B + 1 + 89.99 + + + A + 5 + 4.95 + + + A + 3 + 66.00 + + + B + 10 + .99 + + + A + 15 + 29.00 + + + B + 8 + 6.99 + + +``` diff --git a/docs/standard/linq/sample-xml-file-test-configuration-namespace.md b/docs/standard/linq/sample-xml-file-test-configuration-namespace.md new file mode 100644 index 0000000000000..cda720a29ff1a --- /dev/null +++ b/docs/standard/linq/sample-xml-file-test-configuration-namespace.md @@ -0,0 +1,53 @@ +--- +title: "Sample XML file: Test configuration in a namespace - LINQ to XML" +description: This XML file—which is used in examples—has test configuration data in a namespace. +ms.date: 07/20/2015 +ms.assetid: e75ad1bc-5636-4623-9a34-a286a8c485d6 +--- +# Sample XML file: Test configuration in a namespace (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This is a test configuration file. The XML is in a namespace. + +## TestConfigInNamespace.xml + +```xml + + + + Convert number to string + Examp1.EXE + 1 + One + + + Find succeeding characters + Examp2.EXE + abc + def + + + Convert multiple numbers to strings + Examp2.EXE /Verbose + 123 + One Two Three + + + Find correlated key + Examp3.EXE + a1 + b1 + + + Count characters + FinalExamp.EXE + This is a test + 14 + + + Another Test + Examp2.EXE + Test Input + 10 + + +``` diff --git a/docs/standard/linq/sample-xml-file-test-configuration.md b/docs/standard/linq/sample-xml-file-test-configuration.md new file mode 100644 index 0000000000000..6f8a4af92a080 --- /dev/null +++ b/docs/standard/linq/sample-xml-file-test-configuration.md @@ -0,0 +1,53 @@ +--- +title: "Sample XML file: Test configuration - LINQ to XML" +description: This XML file—which is used in examples—has test configuration data. +ms.date: 07/20/2015 +ms.assetid: 45bfb509-c1d4-4b4f-9690-1cb0c9816516 +--- +# Sample XML file: Test configuration (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This is a test configuration file. + +## TestConfig.xml + +```xml + + + + Convert number to string + Examp1.EXE + 1 + One + + + Find succeeding characters + Examp2.EXE + abc + def + + + Convert multiple numbers to strings + Examp2.EXE /Verbose + 123 + One Two Three + + + Find correlated key + Examp3.EXE + a1 + b1 + + + Count characters + FinalExamp.EXE + This is a test + 14 + + + Another Test + Examp2.EXE + Test Input + 10 + + +``` diff --git a/docs/standard/linq/sample-xml-file-typical-purchase-order-namespace.md b/docs/standard/linq/sample-xml-file-typical-purchase-order-namespace.md new file mode 100644 index 0000000000000..fe6471464c8c0 --- /dev/null +++ b/docs/standard/linq/sample-xml-file-typical-purchase-order-namespace.md @@ -0,0 +1,51 @@ +--- +title: "Sample XML file: Typical purchase order in a namespace - LINQ to XML" +description: This XML file—which is used in examples—has data, in a namespace, about a purchase order. +ms.date: 07/20/2015 +ms.assetid: 84dc3339-ea32-4ccc-9af6-ab38ddfecced +--- +# Sample XML file: Typical purchase order in a namespace (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file is a typical purchase order. The XML is in a namespace. + +## PurchaseOrderInNamespace.xml + +```xml + + + + Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA + + + Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA + + Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + + +``` diff --git a/docs/standard/linq/sample-xml-file-typical-purchase-order.md b/docs/standard/linq/sample-xml-file-typical-purchase-order.md new file mode 100644 index 0000000000000..0ece2573047b7 --- /dev/null +++ b/docs/standard/linq/sample-xml-file-typical-purchase-order.md @@ -0,0 +1,48 @@ +--- +title: "Sample XML file: Typical purchase order - LINQ to XML" +description: This XML file—which is used in examples—has data about a purchase order. +ms.date: 07/20/2015 +ms.assetid: dcbfb859-24fc-4758-b01c-51d1b6f644e6 +--- +# Sample XML file: Typical purchase order (LINQ to XML) + +The following XML file is used in various examples in the LINQ to XML documentation. This file is a typical purchase order. + +## PurchaseOrder.xml + +```xml + + +
+ Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA +
+
+ Tai Yee + 8 Oak Avenue + Old Town + PA + 95819 + USA +
+ Please leave packages in shed by driveway. + + + Lawnmower + 1 + 148.95 + Confirm this is electric + + + Baby Monitor + 2 + 39.98 + 1999-05-21 + + +
+``` diff --git a/docs/standard/linq/sample-xsd-file-customers-orders.md b/docs/standard/linq/sample-xsd-file-customers-orders.md new file mode 100644 index 0000000000000..8d568073c2672 --- /dev/null +++ b/docs/standard/linq/sample-xsd-file-customers-orders.md @@ -0,0 +1,90 @@ +--- +title: "Sample XSD file: Customers and orders - LINQ to XML" +description: "This XSD file—which is used in examples—has a schema definition for 'Sample XML file: Customers and orders'." +ms.date: 07/20/2015 +ms.assetid: ef9911a3-7ac4-44fd-b36e-a0c0ad0a157d +--- +# Sample XSD file: Customers and orders (LINQ to XML) + +The following XSD file is used in various examples in the LINQ to XML documentation. This file contains a schema definition for the [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md). The schema uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. + +For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to join two collections](join-two-collections.md). + +## CustomersOrders.xsd + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/docs/standard/linq/scope-default-namespaces.md b/docs/standard/linq/scope-default-namespaces.md new file mode 100644 index 0000000000000..7f8852359e221 --- /dev/null +++ b/docs/standard/linq/scope-default-namespaces.md @@ -0,0 +1,139 @@ +--- +title: Scope of default namespaces - LINQ to XML +description: Default namespaces as represented in the XML tree aren't in scope for queries. Here are proper and improper ways of querying them. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: fe826236-830f-457a-9027-7ad62c909fae +--- + +# Scope of default namespaces (LINQ to XML) + +Default namespaces as represented in the XML tree aren't in scope for queries. If you have XML that's in a default namespace, you must combine a namespace with the local name to make a qualified name to be used in the query. + +A common mistake in querying an XML tree that has a default namespace is to write the query as if the XML weren't in a namespace. The first example shows a typical improper query of a default namespace. The second shows a proper query. + +## Example: Improper query of XML in a namespace + +This example shows the creation of XML in a namespace, and an improper query that returns an empty result set. + +```csharp +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +IEnumerable c1 = + from el in root.Elements("Child") + select el; +Console.WriteLine("Result set follows:"); +foreach (XElement el in c1) + Console.WriteLine((int)el); +Console.WriteLine("End of result set"); +``` + +```vb +Module Module1 + Sub Main() + Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el + Console.WriteLine("Result set follows:") + For Each el As XElement In c1 + Console.WriteLine(CInt(el)) + Next + Console.WriteLine("End of result set") + End Sub +End Module +``` + +This example produces the following output: + +```output +Result set follows: +End of result set +``` + +## Example: Proper query of XML in a namespace + +This example shows the creation of XML in a namespace, and a proper query. + +In C#, the correct approach is to declare and initialize an object, and to use it when specifying objects. In this case, the argument to the method is an object. + +The correct approach when using Visual Basic is to declare and initialize a global default namespace. This places all XML properties in the default namespace. + +Here is the code: + +```csharp +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +XNamespace aw = "http://www.adventure-works.com"; +IEnumerable c1 = + from el in root.Elements(aw + "Child") + select el; +Console.WriteLine("Result set follows:"); +foreach (XElement el in c1) + Console.WriteLine((int)el); +Console.WriteLine("End of result set"); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el + Console.WriteLine("Result set follows:") + For Each el As XElement In c1 + Console.WriteLine(el.Value) + Next + Console.WriteLine("End of result set") + End Sub +End Module +``` + +This example produces the following output: + +```output +Result set follows: +1 +2 +3 +End of result set +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/serialize-datacontractserializer.md b/docs/standard/linq/serialize-datacontractserializer.md new file mode 100644 index 0000000000000..f7982e46c9246 --- /dev/null +++ b/docs/standard/linq/serialize-datacontractserializer.md @@ -0,0 +1,150 @@ +--- +title: How to serialize using DataContractSerializer - LINQ to XML +description: Learn how to serialize and deserialize using DataContractSerializer. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3320ecbf-cdbe-480e-979c-2c14bbef9988 +--- + +# How to serialize using DataContractSerializer (LINQ to XML) + +This article shows an example that serializes and deserializes using in C# and Visual Basic. + +## Example: Create objects that contain `XElement` objects, then serialize and deserialize them + +The following example creates a number of objects that contain objects. It then serializes them to text files, and then deserializes them from the text files. + +```csharp +using System; +using System.Xml; +using System.Xml.Linq; +using System.IO; +using System.Runtime.Serialization; + +public class XLinqTest +{ + public static void Main() + { + Test(CreateXElement()); + Test(new XElementContainer()); + Test(new XElementNullContainer()); + } + + public static void Test(T obj) + { + DataContractSerializer s = new DataContractSerializer(typeof(T)); + using (FileStream fs = File.Open("test" + typeof(T).Name + ".xml", FileMode.Create)) + { + Console.WriteLine("Testing for type: {0}", typeof(T)); + s.WriteObject(fs, obj); + } + using (FileStream fs = File.Open("test" + typeof(T).Name + ".xml", FileMode.Open)) + { + object s2 = s.ReadObject(fs); + if (s2 == null) + Console.WriteLine(" Deserialized object is null (Nothing in VB)"); + else + Console.WriteLine(" Deserialized type: {0}", s2.GetType()); + } + } + + public static XElement CreateXElement() + { + return new XElement(XName.Get("NameInNamespace", "http://www.adventure-works.org")); + } +} + +[DataContract] +public class XElementContainer +{ + [DataMember] + public XElement member; + + public XElementContainer() + { + member = XLinqTest.CreateXElement(); + } +} + +[DataContract] +public class XElementNullContainer +{ + [DataMember] + public XElement member; + + public XElementNullContainer() + { + member = null; + } +} +``` + +```vb +Imports System +Imports System.Xml +Imports System.Xml.Linq +Imports System.IO +Imports System.Runtime.Serialization + +Public Class XLinqTest + Shared Sub Main() + Test(Of XElement)(CreateXElement()) + Test(Of XElementContainer)(New XElementContainer()) + Test(Of XElementNullContainer)(New XElementNullContainer()) + End Sub + + Public Shared Sub Test(Of T)(ByRef obj) + Dim s As DataContractSerializer = New DataContractSerializer(GetType(T)) + Using fs As FileStream = File.Open("test" & GetType(T).Name & ".xml", FileMode.Create) + Console.WriteLine("Testing for type: {0}", GetType(T)) + s.WriteObject(fs, obj) + End Using + + Using fs As FileStream = File.Open("test" & GetType(T).Name & ".xml", FileMode.Open) + Dim s2 As Object = s.ReadObject(fs) + If s2 Is Nothing Then + Console.WriteLine(" Deserialized object is null (Nothing in VB)") + Else + Console.WriteLine(" Deserialized type: {0}", s2.GetType()) + End If + End Using + End Sub + + Public Shared Function CreateXElement() As XElement + Return New XElement(XName.Get("NameInNamespace", "http://www.adventure-works.org")) + End Function +End Class + + _ +Public Class XElementContainer + _ + Public member As XElement + + Public Sub XElementContainer() + member = XLinqTest.CreateXElement() + End Sub +End Class + + _ +Public Class XElementNullContainer + _ + Public member As XElement + + Public Sub XElementNullContainer() + member = Nothing + End Sub +End Class +``` + + This example produces the following output: + +```output +Testing for type: System.Xml.Linq.XElement + Deserialized type: System.Xml.Linq.XElement +Testing for type: XElementContainer + Deserialized type: XElementContainer +Testing for type: XElementNullContainer + Deserialized type: XElementNullContainer +``` diff --git a/docs/csharp/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md b/docs/standard/linq/serialize-files-textwriters-xmlwriters.md similarity index 65% rename from docs/csharp/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md rename to docs/standard/linq/serialize-files-textwriters-xmlwriters.md index bc4b8d50e1efa..cf1d78e1de654 100644 --- a/docs/csharp/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md +++ b/docs/standard/linq/serialize-files-textwriters-xmlwriters.md @@ -1,11 +1,11 @@ --- -title: "Serializing to Files, TextWriters, and XmlWriters" -description: Learn about options to serialize XML trees to a File, a TextWriter, or an XmlWriter in C# by using the ToString or Save methods. +title: Serialize to files, TextWriters, and XmlWriters - LINQ to XML +description: You can serialize XML trees to a File, a TextWriter, or an XmlWriter, and you can serialize any XML component, including XDocument and XElement, to a string by using the ToString method. ms.date: 07/20/2015 ms.assetid: bd3ea6f7-895b-4ff4-a625-fe2bb55b1886 --- -# Serializing to Files, TextWriters, and XmlWriters +# Serialize to files, TextWriters, and XmlWriters (LINQ to XML) You can serialize XML trees to a , a , or an . @@ -13,20 +13,14 @@ You can serialize any XML component, including If you want to suppress formatting when serializing to a string, you can use the method. -The default behavior when serializing to a file is to format (indent) the resulting XML document. When you indent, the insignificant white space in the XML tree is not preserved. To serialize with formatting, use one of the overloads of the following methods that do not take as an argument: +The default behavior when serializing to a file is to format (indent) the resulting XML document. When you indent, the insignificant white space in the XML tree isn't preserved. To serialize with formatting, use one of the overloads of the following methods that don't take as an argument: - - - If you want the option not to indent and to preserve the insignificant white space in the XML tree, use one of the overloads of the following methods that takes as an argument: - - - -For examples, see the appropriate reference topic. - -## See also - -- [Serializing XML Trees (C#)](serializing-to-files-textwriters-and-xmlwriters.md) +For examples, see the appropriate reference article. diff --git a/docs/standard/linq/serialize-xml-declaration.md b/docs/standard/linq/serialize-xml-declaration.md new file mode 100644 index 0000000000000..aa6df68ee8f26 --- /dev/null +++ b/docs/standard/linq/serialize-xml-declaration.md @@ -0,0 +1,86 @@ +--- +title: Serialize with an XML declaration - LINQ to XML +description: You can control whether an XML declaration is generated when you serialize XML in C# or Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: c237fa4a-a042-40fd-886f-17b54c66bb75 +--- + +# Serialize with an XML declaration (LINQ to XML) + +This article describes how to control whether an XML declaration is generated when you serialize XML in C# or Visual Basic. + +Serializing to a or a using the method or the method generates an XML declaration. When you serialize to an , the writer settings (specified in an object) determine whether an XML declaration is generated. + +If you're serializing to a string using the `ToString` method, the resulting XML won't include an XML declaration. + +## Example: Serialize with an XML declaration + +The following example creates an , saves the document to a file, and then prints the file to the console: + +```csharp +XElement root = new XElement("Root", + new XElement("Child", "child content") +); +root.Save("Root.xml"); +string str = File.ReadAllText("Root.xml"); +Console.WriteLine(str); +``` + +```vb +Dim root As XElement = + child content + +root.Save("Root.xml") +Dim str As String = File.ReadAllText("Root.xml") +Console.WriteLine(str) +``` + +This example produces the following output: + +```xml + + + child content + +``` + +## Example: Serialize without an XML declaration + +The following example shows how to save an to an . + +```csharp +StringBuilder sb = new StringBuilder(); +XmlWriterSettings xws = new XmlWriterSettings(); +xws.OmitXmlDeclaration = true; + +using (XmlWriter xw = XmlWriter.Create(sb, xws)) { + XElement root = new XElement("Root", + new XElement("Child", "child content") + ); + root.Save(xw); +} +Console.WriteLine(sb.ToString()); +``` + +```vb +Dim sb As StringBuilder = New StringBuilder() +Dim xws As XmlWriterSettings = New XmlWriterSettings() +xws.OmitXmlDeclaration = True + +Using xw As XmlWriter = XmlWriter.Create(sb, xws) + Dim root = + child content + + root.Save(xw) +End Using +Console.WriteLine(sb.ToString()) +``` + +This example produces the following output: + +```xml +child content +``` diff --git a/docs/standard/linq/serialize-xmlreader-invoke-xslt.md b/docs/standard/linq/serialize-xmlreader-invoke-xslt.md new file mode 100644 index 0000000000000..7cdc041ee5059 --- /dev/null +++ b/docs/standard/linq/serialize-xmlreader-invoke-xslt.md @@ -0,0 +1,97 @@ +--- +title: Serialize to an XmlReader (invoke XSLT) - LINQ to XML +description: You can use CreateReader to create an XmlReader that provides nodes of an XML tree to an XSLT transformation. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4cc3ee03-ef4c-429b-a408-fedd10b728cd +--- + +# Serialize to an XmlReader (invoke XSLT) (LINQ to XML) + +When you use the interoperability capabilities of LINQ to XML, you can use to create an . The module that reads from this reads the nodes from the XML tree and processes them accordingly. + +## Example: Invoke an XSLT transformation + +One possible use for this method is when invoking an XSLT transformation. You can create an XML tree, create an from the XML tree, create a new document, and then create an to write into the new document. Then, you can invoke the XSLT transformation, passing in and . After the transformation successfully completes, the new XML tree is populated with the results of the transformation. + +```csharp +string xslMarkup = @" + + + + + + + + + + + +"; + +XDocument xmlTree = new XDocument( + new XElement("Parent", + new XElement("Child1", "Child1 data"), + new XElement("Child2", "Child2 data") + ) +); + +XDocument newTree = new XDocument(); +using (XmlWriter writer = newTree.CreateWriter()) { + // Load the style sheet. + XslCompiledTransform xslt = new XslCompiledTransform(); + xslt.Load(XmlReader.Create(new StringReader(xslMarkup))); + + // Execute the transformation and output the results to a writer. + xslt.Transform(xmlTree.CreateReader(), writer); +} + +Console.WriteLine(newTree); +``` + +```vb +Dim xslMarkup As XDocument = _ + + + + + + + + + + + + + + +Dim xmlTree As XDocument = _ + + + Child1 data + Child2 data + + +Dim newTree As XDocument = New XDocument() +Using writer As XmlWriter = newTree.CreateWriter() + ' Load the style sheet. + Dim xslt As XslCompiledTransform = New XslCompiledTransform() + xslt.Load(xslMarkup.CreateReader()) + + ' Execute the transformation and output the results to a writer. + xslt.Transform(xmlTree.CreateReader(), writer) +End Using + +Console.WriteLine(newTree) +``` + +This example produces the following output: + +```xml + + Child1 data + Child2 data + +``` diff --git a/docs/standard/linq/serialize-xmlserializer.md b/docs/standard/linq/serialize-xmlserializer.md new file mode 100644 index 0000000000000..6fe20c7f301dc --- /dev/null +++ b/docs/standard/linq/serialize-xmlserializer.md @@ -0,0 +1,145 @@ +--- +title: How to serialize using XmlSerializer - LINQ to XML +description: Learn how to serialize and deserialize using XmlSerializer. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 2e0a0bbc-c548-4fe2-8741-be5a9ccd0cbb +--- + +# How to serialize using XmlSerializer (LINQ to XML) + +This article shows an example that serializes and deserializes using in C# and Visual Basic. + +## Example: Create objects that contain `XElement` objects, then serialize and deserialize them + +The following example creates a number of objects that contain objects. It then serializes them to a memory stream, and then deserializes them from the memory stream. + +```csharp +using System; +using System.IO; +using System.Linq; +using System.Xml; +using System.Xml.Serialization; +using System.Xml.Linq; + +public class XElementContainer +{ + public XElement member; + + public XElementContainer() + { + member = XLinqTest.CreateXElement(); + } + + public override string ToString() + { + return member.ToString(); + } +} + +public class XElementNullContainer +{ + public XElement member; + + public XElementNullContainer() + { + } +} + +class XLinqTest +{ + static void Main(string[] args) + { + Test(new XElementNullContainer()); + Test(CreateXElement()); + Test(new XElementContainer()); + } + + public static XElement CreateXElement() + { + XNamespace ns = "http://www.adventure-works.com"; + return new XElement(ns + "aw"); + } + + static void Test(T obj) + { + using (MemoryStream stream = new MemoryStream()) + { + XmlSerializer s = new XmlSerializer(typeof(T)); + Console.WriteLine("Testing for type: {0}", typeof(T)); + s.Serialize(XmlWriter.Create(stream), obj); + stream.Flush(); + stream.Seek(0, SeekOrigin.Begin); + object o = s.Deserialize(XmlReader.Create(stream)); + Console.WriteLine(" Deserialized type: {0}", o.GetType()); + } + } +} +``` + +```vb +Imports System +Imports System.Xml +Imports System.Xml.Linq +Imports System.IO +Imports System.Runtime.Serialization +Imports System.Xml.Serialization + +Public Class XElementContainer + Public member As XElement + + Public Sub XElementContainer() + member = XLinqTest.CreateXElement() + End Sub + + Overrides Function ToString() As String + Return member.ToString() + End Function +End Class + +Public Class XElementNullContainer + Public member As XElement + + Public Sub XElementNullContainer() + member = Nothing + End Sub +End Class + +Public Class XLinqTest + Shared Sub Main() + Test(Of XElementNullContainer)(New XElementNullContainer()) + Test(Of XElement)(CreateXElement()) + Test(Of XElementContainer)(New XElementContainer()) + End Sub + + Public Shared Function CreateXElement() As XElement + Dim ns As XNamespace = "http://www.adventure-works.com" + Return New XElement(ns + "aw") + End Function + + Public Shared Sub Test(Of T)(ByRef obj) + Using stream As New MemoryStream() + Dim s As XmlSerializer = New XmlSerializer(GetType(T)) + Console.WriteLine("Testing for type: {0}", GetType(T)) + s.Serialize(XmlWriter.Create(stream), obj) + stream.Flush() + stream.Seek(0, SeekOrigin.Begin) + Dim o As Object = s.Deserialize(XmlReader.Create(stream)) + Console.WriteLine(" Deserialized type: {0}", o.GetType()) + End Using + End Sub +End Class +``` + +This example produces the following output: + +```output +Testing for type: XElementNullContainer + Deserialized type: XElementNullContainer +Testing for type: System.Xml.Linq.XElement + Deserialized type: System.Xml.Linq.XElement +Testing for type: XElementContainer + Deserialized type: XElementContainer +``` diff --git a/docs/csharp/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md b/docs/standard/linq/sort-elements-multiple-keys.md similarity index 64% rename from docs/csharp/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md rename to docs/standard/linq/sort-elements-multiple-keys.md index c491e149455c4..262e957678a15 100644 --- a/docs/csharp/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md +++ b/docs/standard/linq/sort-elements-multiple-keys.md @@ -1,18 +1,20 @@ --- -title: "How to sort elements on multiple keys (C#)" -description: Learn how to sort elements on multiple keys. See examples for sorting elements that use sample XML documents. +title: How to sort elements on multiple keys - LINQ to XML +description: Learn how to sort XML elements on multiple keys. ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" ms.assetid: 3b2760b6-d607-4ac7-b784-5c6524e2a0e0 --- -# How to sort elements on multiple keys (C#) -This topic shows how to sort on multiple keys. +# How to sort elements on multiple keys (LINQ to XML) -## Example +This article shows how to sort on multiple keys in C# and Visual Basic. -In this example, the results are ordered first by the shipping postal code, then by the order date. +## Example: Sort XML elements on multiple keys -This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](./sample-xml-file-customers-and-orders-linq-to-xml-2.md). +This example sorts on two keys: shipping postal code (primary) and order date. It uses XML document [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md). ```csharp XElement co = XElement.Load("CustomersOrders.xml"); @@ -31,7 +33,24 @@ foreach (var r in sortedElements) r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate); ``` -This code produces the following output: +```vb +Dim co As XElement = XElement.Load("CustomersOrders.xml") +Dim result = _ + From c In co.. _ + Order By c...Value, Convert.ToDateTime(c..Value) _ + Select New With { _ + .CustomerID = c..Value, _ + .EmployeeID = c..Value, _ + .ShipPostalCode = c...Value, _ + .OrderDate = Convert.ToDateTime(c..Value) _ + } +For Each r In result + Console.WriteLine("CustomerID:{0} EmployeeID:{1} ShipPostalCode:{2} OrderDate:{3:d}", _ + r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate) +Next +``` + +This example produces the following output: ```output CustomerID:LETSS EmployeeID:1 ShipPostalCode:94117 OrderDate:6/25/1997 @@ -58,11 +77,11 @@ CustomerID:LAZYK EmployeeID:1 ShipPostalCode:99362 OrderDate:3/21/1997 CustomerID:LAZYK EmployeeID:8 ShipPostalCode:99362 OrderDate:5/22/1997 ``` -## Example +## Example: Sort XML that's in a namespace -The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (C#)](namespaces-overview-linq-to-xml.md). +This example does the same sort as the first, but for XML that's in a namespace. It uses XML document [Sample XML file: Customers and orders in a namespace](sample-xml-file-customers-orders-namespace.md). -This example uses the following XML document: [Sample XML File: Customers and Orders in a Namespace](./sample-xml-file-customers-and-orders-in-a-namespace.md). +For more information, see [Namespaces overview](namespaces-overview.md). ```csharp XElement co = XElement.Load("CustomersOrdersInNamespace.xml"); @@ -83,7 +102,30 @@ foreach (var r in sortedElements) r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate); ``` -This code produces the following output: +```vb +Imports + +Module Module1 + Sub Main() + Dim co As XElement = XElement.Load("CustomersOrdersInNamespace.xml") + Dim result = _ + From c In co.. _ + Order By c...Value, Convert.ToDateTime(c..Value) _ + Select New With { _ + .CustomerID = c..Value, _ + .EmployeeID = c..Value, _ + .ShipPostalCode = c...Value, _ + .OrderDate = Convert.ToDateTime(c..Value) _ + } + For Each r In result + Console.WriteLine("CustomerID:{0} EmployeeID:{1} ShipPostalCode:{2} OrderDate:{3:d}", _ + r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate) + Next + End Sub +End Module +``` + +This example produces the following output: ```output CustomerID:LETSS EmployeeID:1 ShipPostalCode:94117 OrderDate:6/25/1997 @@ -109,3 +151,7 @@ CustomerID:HUNGC EmployeeID:8 ShipPostalCode:97827 OrderDate:9/8/1997 CustomerID:LAZYK EmployeeID:1 ShipPostalCode:99362 OrderDate:3/21/1997 CustomerID:LAZYK EmployeeID:8 ShipPostalCode:99362 OrderDate:5/22/1997 ``` + +## See also + +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) diff --git a/docs/standard/linq/sort-elements.md b/docs/standard/linq/sort-elements.md new file mode 100644 index 0000000000000..1600514fd471e --- /dev/null +++ b/docs/standard/linq/sort-elements.md @@ -0,0 +1,106 @@ +--- +title: How to sort elements - LINQ to XML +description: Learn how to write a query that sorts its results. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: aee6fbbc-81fd-4b3e-b40f-6ed7b3bd3fee +--- + +# How to sort elements (LINQ to XML) + +You can sort your results when you query XML. This article provides two examples: the first sorts results for XML that *isn't* in a namespace, and the second does the same sort, but for XML that *is* in a namespace. + +## Example: Write a query that sorts its results + +This example shows how to write a query that sorts its results. It uses XML document [Sample XML file: Numerical data](sample-xml-file-numerical-data.md). + +```csharp +XElement root = XElement.Load("Data.xml"); +IEnumerable prices = + from el in root.Elements("Data") + let price = (decimal)el.Element("Price") + orderby price + select price; +foreach (decimal el in prices) + Console.WriteLine(el); +``` + +```vb +Dim root As XElement = XElement.Load("Data.xml") +Dim prices As IEnumerable(Of Decimal) = _ + From el In root. _ + Let price = Convert.ToDecimal(el..Value) _ + Order By (price) _ + Select price +For Each el As Decimal In prices + Console.WriteLine(el) +Next +``` + +This example produces the following output: + +```output +0.99 +4.95 +6.99 +24.50 +29.00 +66.00 +89.99 +``` + +## Example: Write a query in a namespace that sorts its results + +The following example shows the same query for XML that's in a namespace. It uses XML document [Sample XML file: Numerical data in a namespace](sample-xml-file-numerical-data-namespace.md). + +For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement root = XElement.Load("DataInNamespace.xml"); +XNamespace aw = "http://www.adatum.com"; +IEnumerable prices = + from el in root.Elements(aw + "Data") + let price = (decimal)el.Element(aw + "Price") + orderby price + select price; +foreach (decimal el in prices) + Console.WriteLine(el); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = XElement.Load("DataInNamespace.xml") + Dim prices As IEnumerable(Of Decimal) = _ + From el In root. _ + Let price = Convert.ToDecimal(el..Value) _ + Order By (price) _ + Select price + For Each el As Decimal In prices + Console.WriteLine(el) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +0.99 +4.95 +6.99 +24.50 +29.00 +66.00 +89.99 +``` + +## See also + +- [Sorting Data (C#)](../../csharp/programming-guide/concepts/linq/sorting-data.md) +- [Sorting Data (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/sorting-data.md) +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) diff --git a/docs/standard/linq/statically-compiled-queries.md b/docs/standard/linq/statically-compiled-queries.md new file mode 100644 index 0000000000000..2bdb3f7740efc --- /dev/null +++ b/docs/standard/linq/statically-compiled-queries.md @@ -0,0 +1,128 @@ +--- +title: Statically compiled queries - LINQ to XML +description: Learn how LINQ to XML queries gain a performance advantage over XMLDocument by being statically compiled. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3bf558fe-0705-479d-86d4-00188f5fcf9c +--- +# Statically compiled queries (LINQ to XML) + +One of the most important performance advantages of LINQ to XML, as compared to , is that queries in LINQ to XML are statically compiled, whereas XPath queries must be interpreted at run time. This feature is built into LINQ to XML, so you don't have to perform extra steps to take advantage of it, but it's helpful to understand the distinction when choosing between the two technologies. This article explains the difference. + +## Statically compiled queries vs. XPath + +The following example shows how to get the descendant elements with a specified name, and with an attribute with a specified value. The equivalent XPath expression is `//Address[@Type='Shipping']`. + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +IEnumerable list1 = + from el in po.Descendants("Address") + where (string)el.Attribute("Type") == "Shipping" + select el; + +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim po = XDocument.Load("PurchaseOrders.xml") + +Dim list1 = From el In po.Descendants("Address") + Where el.@Type = "Shipping" + +For Each el In list1 + Console.WriteLine(el) +Next +``` + +The query expression in this example is rewritten by the compiler to method-based query syntax. The following example, which is written in method-based query syntax, produces the same results as the previous one: + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +IEnumerable list1 = + po + .Descendants("Address") + .Where(el => (string)el.Attribute("Type") == "Shipping"); + +foreach (XElement el in list1) + Console.WriteLine(el); +``` + + ```vb +Dim po = XDocument.Load("PurchaseOrders.xml") + +Dim list1 As IEnumerable(Of XElement) = po.Descendants("Address").Where(Function(el) el.@Type = "Shipping") + +For Each el In list1 + Console.WriteLine(el) +Next +``` + +The method is an extension method. For more information, see [Extension Methods (C# Programming Guide)](../../csharp/programming-guide/classes-and-structs/extension-methods.md). Because is an extension method, the query above is compiled as though it were written as follows: + +```csharp +XDocument po = XDocument.Load("PurchaseOrders.xml"); + +IEnumerable list1 = + System.Linq.Enumerable.Where( + po.Descendants("Address"), + el => (string)el.Attribute("Type") == "Shipping"); + +foreach (XElement el in list1) + Console.WriteLine(el); +``` + +```vb +Dim po = XDocument.Load("PurchaseOrders.xml") + +Dim list1 = Enumerable.Where(po.Descendants("Address"), Function(el) el.@Type = "Shipping") + +For Each el In list1 + Console.WriteLine(el) +Next +``` + +This example produces exactly the same results as the previous two examples. This illustrates the fact that queries are effectively compiled into statically linked method calls. This, combined with the deferred execution semantics of iterators, improves performance. For more information about the deferred execution semantics of iterators, see [Deferred execution and lazy evaluation](deferred-execution-lazy-evaluation.md). + +> [!NOTE] +> These examples are representative of the code that the compiler might write. The actual implementation might differ slightly from these examples, but the performance will be the same as, or similar to, these examples. + +## Executing XPath expressions with XmlDocument + +The following example uses to accomplish the same results as the previous examples: + +```csharp +XmlReader reader = XmlReader.Create("PurchaseOrders.xml"); +XmlDocument doc = new XmlDocument(); +doc.Load(reader); +XmlNodeList nl = doc.SelectNodes(".//Address[@Type='Shipping']"); +foreach (XmlNode n in nl) + Console.WriteLine(n.OuterXml); +reader.Close(); +``` + +```vb +Dim reader = Xml.XmlReader.Create("PurchaseOrders.xml") +Dim doc As New Xml.XmlDocument() +doc.Load(reader) +Dim nl As Xml.XmlNodeList = doc.SelectNodes(".//Address[@Type='Shipping']") +For Each n As Xml.XmlNode In nl + Console.WriteLine(n.OuterXml) +Next +reader.Close() +``` + +This query returns the same output as the examples that use LINQ to XML; the only difference is that LINQ to XML indents the printed XML, whereas doesn't. + +However, the approach generally doesn't perform as well as LINQ to XML, because the method must do the following every time it's called: + +- Parse the string that contains the XPath expression, breaking the string into tokens. +- Validate the tokens to make sure that the XPath expression is valid. +- Translate the expression into an internal expression tree. +- Iterate through the nodes, appropriately selecting the nodes for the result set based on the evaluation of the expression. + +This is significantly more than the work done by the corresponding LINQ to XML query. The specific performance difference varies for different types of queries, but in general LINQ to XML queries do less work, and therefore perform better, than evaluating XPath expressions using . diff --git a/docs/standard/linq/stream-xml-fragments-access-header-information.md b/docs/standard/linq/stream-xml-fragments-access-header-information.md new file mode 100644 index 0000000000000..237dc7ecde5e6 --- /dev/null +++ b/docs/standard/linq/stream-xml-fragments-access-header-information.md @@ -0,0 +1,299 @@ +--- +title: How to stream XML fragments with access to header information - LINQ to XML +description: Learn how to implement and use a custom axis method that streams XML fragments from the file specified by a URI. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 7f242770-b0c7-418d-894b-643215e1f8aa +--- + +# How to stream XML fragments with access to header information (LINQ to XML) + +Sometimes you have to read arbitrarily large XML files, and write your application so that the memory footprint of the application is predictable. If you attempt to populate an XML tree with a large XML file, your memory usage will be proportional to the size of the file—that is, excessive. Therefore, you should use a streaming technique instead. + +One option is to write your application using . However, you might want to use LINQ to query the XML tree. If so, you can write your own custom axis method. For more information, see [How to write a LINQ to XML axis method](write-linq-xml-axis-method.md). + +To write your own axis method, you write a small method that uses the to read nodes until it reaches one of the nodes in which you're interested. The method then calls , which reads from the and instantiates an XML fragment. It then yields each fragment through `yield return` to the method that's enumerating your custom axis method. You can then write LINQ queries on your custom axis method. + +Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. If you use a query operator that materializes its source before yielding the first item, you won't retain a small memory footprint. + +## Example: Implement and use a custom axis method that streams XML fragments from the file specified by a URI + +Sometimes the problem gets just a little more interesting. In the following XML document, the consumer of your custom axis method also has to know the name of the customer that each item belongs to. + +```xml + + + + A. Datum Corporation + + 0001 + + + 0002 + + + 0003 + + + 0004 + + + + Fabrikam, Inc. + + 0005 + + + 0006 + + + 0007 + + + 0008 + + + + Southridge Video + + 0009 + + + 0010 + + + +``` + +The approach that this example takes is to also watch for this header information, save the header information, and then build a small XML tree that contains both the header information and the detail that you're enumerating. The axis method then yields this new, small XML tree. The query then has access to the header information as well as the detail information. + +This approach has a small memory footprint. As each detail XML fragment is yielded, no references are kept to the previous fragment, and it's available for garbage collection. This technique creates many short lived objects on the heap. + +The following example shows how to implement and use a custom axis method that streams XML fragments from the file specified by the URI. This custom axis is written such that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the above `Source.xml` document. It's a simplistic implementation. A more robust implementation would be prepared to parse an invalid document. + +```csharp +static IEnumerable StreamCustomerItem(string uri) +{ + using (XmlReader reader = XmlReader.Create(uri)) + { + XElement name = null; + XElement item = null; + + reader.MoveToContent(); + + // Parse the file, save header information when encountered, and yield the + // Item XElement objects as they're created. + + // loop through Customer elements + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Customer") + { + // move to Name element + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.Element && + reader.Name == "Name") + { + name = XElement.ReadFrom(reader) as XElement; + break; + } + } + + // Loop through Item elements + while (reader.Read()) + { + if (reader.NodeType == XmlNodeType.EndElement) + break; + if (reader.NodeType == XmlNodeType.Element + && reader.Name == "Item") + { + item = XElement.ReadFrom(reader) as XElement; + if (item != null) { + XElement tempRoot = new XElement("Root", + new XElement(name) + ); + tempRoot.Add(item); + yield return item; + } + } + } + } + } + } +} + +static void Main(string[] args) +{ + XElement xmlTree = new XElement("Root", + from el in StreamCustomerItem("Source.xml") + where (int)el.Element("Key") >= 3 && (int)el.Element("Key") <= 7 + select new XElement("Item", + new XElement("Customer", (string)el.Parent.Element("Name")), + new XElement(el.Element("Key")) + ) + ); + Console.WriteLine(xmlTree); +} +``` + +```vb +Module Module1 + + Sub Main() + Dim xmlTree = + <%= + From el In New StreamCustomerItem("Source.xml") + Let itemKey = CInt(el..Value) + Where itemKey >= 3 AndAlso itemKey <= 7 + Select + <%= el.Parent..Value %> + <%= el. %> + + %> + + + Console.WriteLine(xmlTree) + End Sub + +End Module + +Public Class StreamCustomerItem + Implements IEnumerable(Of XElement) + + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + End Sub + + Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator + Return New StreamCustomerItemEnumerator(_uri) + End Function + + Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator + Return Me.GetEnumerator() + End Function +End Class + +Public Class StreamCustomerItemEnumerator + Implements IEnumerator(Of XElement) + + Private _current As XElement + Private _customerName As String + Private _reader As Xml.XmlReader + Private _uri As String + + Public Sub New(ByVal uri As String) + _uri = uri + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + + Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current + Get + Return _current + End Get + End Property + + Public ReadOnly Property Current1 As Object Implements IEnumerator.Current + Get + Return Me.Current + End Get + End Property + + Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext + Dim item As XElement + Dim name As XElement + + ' Parse the file, save header information when encountered, and return the + ' current Item XElement. + + ' loop through Customer elements + While _reader.Read() + If _reader.NodeType = Xml.XmlNodeType.Element Then + Select Case _reader.Name + Case "Customer" + ' move to Name element + While _reader.Read() + + If _reader.NodeType = Xml.XmlNodeType.Element AndAlso + _reader.Name = "Name" Then + + name = TryCast(XElement.ReadFrom(_reader), XElement) + _customerName = If(name IsNot Nothing, name.Value, "") + Exit While + End If + + End While + Case "Item" + item = TryCast(XElement.ReadFrom(_reader), XElement) + Dim tempRoot = + <%= _customerName %> + <%= item %> + + _current = item + Return True + End Select + End If + End While + + Return False + End Function + + Public Sub Reset() Implements IEnumerator.Reset + _reader = Xml.XmlReader.Create(_uri) + _reader.MoveToContent() + End Sub + +#Region "IDisposable Support" + Private disposedValue As Boolean ' To detect redundant calls + + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + _reader.Close() + End If + End If + Me.disposedValue = True + End Sub + + Public Sub Dispose() Implements IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + +End Class +``` + + This code produces the following output: + +```xml + + + A. Datum Corporation + 0003 + + + A. Datum Corporation + 0004 + + + Fabrikam, Inc. + 0005 + + + Fabrikam, Inc. + 0006 + + + Fabrikam, Inc. + 0007 + + +``` diff --git a/docs/standard/linq/stream-xml-fragments-xmlreader.md b/docs/standard/linq/stream-xml-fragments-xmlreader.md new file mode 100644 index 0000000000000..f3231cd3b7ed1 --- /dev/null +++ b/docs/standard/linq/stream-xml-fragments-xmlreader.md @@ -0,0 +1,200 @@ +--- +title: How to stream XML fragments from an XmlReader - LINQ to XML +description: You can stream XML fragments from an XmlReader using a custom axis method in C# and Visual Basic. This is an approach that can work when loading the whole XML tree into memory is infeasible. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4a8f0e45-768a-42e2-bc5f-68bdf0e0a726 +--- + +# How to stream XML fragments from an XmlReader (LINQ to XML) + +When you have to process large XML files, it might not be feasible to load the whole XML tree into memory. This article shows how to stream fragments using an in C# and Visual Basic. + +One of the most effective ways to use an to read objects is to write your own custom axis method. An axis method typically returns a collection such as of , as shown in the example in this article. In the custom axis method, after you create the XML fragment by calling the method, return the collection using `yield return`. This provides deferred execution semantics to your custom axis method. + +When you create an XML tree from an object, the must be positioned on an element. The method doesn't return until it has read the close tag of the element. + +If you want to create a partial tree, you can instantiate an , position the reader on the node that you want to convert to an tree, and then create the object. + +The article [How to stream XML fragments with access to header information](stream-xml-fragments-access-header-information.md) contains information on streaming a more complex document. + +The article [How to perform streaming transform of large XML documents](perform-streaming-transform-large-xml-documents.md) contains an example of using LINQ to XML to transform extremely large XML documents while maintaining a small memory footprint. + +## Example: Create a custom axis method + +This example creates a custom axis method. You can query it by using a LINQ query. The custom axis method `StreamRootChildDoc` can read a document that has a repeating `Child` element. + +```csharp +static IEnumerable StreamRootChildDoc(StringReader stringReader) +{ + using (XmlReader reader = XmlReader.Create(stringReader)) + { + reader.MoveToContent(); + // Parse the file and display each of the nodes. + while (reader.Read()) + { + switch (reader.NodeType) + { + case XmlNodeType.Element: + if (reader.Name == "Child") { + XElement el = XElement.ReadFrom(reader) as XElement; + if (el != null) + yield return el; + } + break; + } + } + } +} + +static void Main(string[] args) +{ + string markup = @" + + aaa + + + bbb + + + ccc + + "; + + IEnumerable grandChildData = + from el in StreamRootChildDoc(new StringReader(markup)) + where (int)el.Attribute("Key") > 1 + select (string)el.Element("GrandChild"); + + foreach (string str in grandChildData) { + Console.WriteLine(str); + } +} +``` + +```vb +Module Module1 + Sub Main() + Dim markup = "" & + " " & + " aaa" & + " " & + " " & + " bbb" & + " " & + " " & + " ccc" & + " " & + "" + + Dim grandChildData = + From el In New StreamRootChildDoc(New IO.StringReader(markup)) + Where CInt(el.@Key) > 1 + Select el..Value + + For Each s In grandChildData + Console.WriteLine(s) + Next + End Sub +End Module + +Public Class StreamRootChildDoc + Implements IEnumerable(Of XElement) + + Private _stringReader As IO.StringReader + + Public Sub New(ByVal stringReader As IO.StringReader) + _stringReader = stringReader + End Sub + + Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator + Return New StreamChildEnumerator(_stringReader) + End Function + + Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator + Return Me.GetEnumerator() + End Function +End Class + +Public Class StreamChildEnumerator + Implements IEnumerator(Of XElement) + + Private _current As XElement + Private _reader As Xml.XmlReader + Private _stringReader As IO.StringReader + + Public Sub New(ByVal stringReader As IO.StringReader) + _stringReader = stringReader + _reader = Xml.XmlReader.Create(_stringReader) + _reader.MoveToContent() + End Sub + + Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current + Get + Return _current + End Get + End Property + + Public ReadOnly Property Current1 As Object Implements IEnumerator.Current + Get + Return Me.Current + End Get + End Property + + Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext + While _reader.Read() + Select Case _reader.NodeType + Case Xml.XmlNodeType.Element + Dim el = TryCast(XElement.ReadFrom(_reader), XElement) + If el IsNot Nothing Then + _current = el + Return True + End If + End Select + End While + + Return False + End Function + + Public Sub Reset() Implements IEnumerator.Reset + _reader = Xml.XmlReader.Create(_stringReader) + _reader.MoveToContent() + End Sub + +#Region "IDisposable Support" + + Private disposedValue As Boolean ' To detect redundant calls + + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not Me.disposedValue Then + If disposing Then + _reader.Close() + End If + End If + Me.disposedValue = True + End Sub + + Public Sub Dispose() Implements IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region + +End Class +``` + +This example produces the following output: + +```output +bbb +ccc +``` + +The technique used in this example maintains a small memory footprint even for millions of `Child` elements. + +## See also + +- [Parse XML](parse-string.md) diff --git a/docs/standard/linq/style-part-wordprocessingml-document.md b/docs/standard/linq/style-part-wordprocessingml-document.md new file mode 100644 index 0000000000000..0441b3264f156 --- /dev/null +++ b/docs/standard/linq/style-part-wordprocessingml-document.md @@ -0,0 +1,142 @@ +--- +title: Style part of a WordprocessingML document - LINQ to XML +description: See an example of XML that makes up the style part of an Office Open XML WordprocessingML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 5458bccf-3898-4661-904b-7d280c9239a9 +--- + +# Style part of a WordprocessingML document (LINQ to XML) + +This article shows an example of the XML that makes up the style part of an Office Open XML WordprocessingML document. + +## Example: The XML that makes up the style part of a document + +The following example is the XML that makes up the style part of an Office Open XML WordprocessingML document. + +The default paragraph style has an element with the following opening tag: + +```xml + +``` + +You need to know this information when you write the query to find the default style identifier, so that the query can identify the style of paragraphs that have the default style. + +Note that these documents are very simple when compared to typical documents that Microsoft Word generates. In many cases, Word saves a great deal of additional information, additional formatting, and metadata. Furthermore, Word doesn't format the lines to be easily readable as in this example; instead, the XML is saved without indentation. However, all WordprocessingML documents share the same basic XML shape. Because of this, the queries presented in this section will work with more complicated documents. + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` diff --git a/docs/standard/linq/toc.yml b/docs/standard/linq/toc.yml new file mode 100644 index 0000000000000..5eabf0cd0e3eb --- /dev/null +++ b/docs/standard/linq/toc.yml @@ -0,0 +1,350 @@ +- name: LINQ + items: + - name: LINQ overview + href: index.md + - name: LINQ to XML + items: + - name: Get started + items: + - name: LINQ to XML overview + href: linq-xml-overview.md + - name: LINQ to XML vs. DOM + href: linq-xml-vs-dom.md + - name: LINQ to XML vs. other XML technologies + href: linq-xml-vs-xml-technologies.md + - name: Programming guide + items: + - name: LINQ to XML programming overview + items: + - name: Functional vs. procedural programming + href: functional-vs-procedural-programming.md + - name: LINQ to XML classes overview + href: linq-xml-classes-overview.md + - name: XElement class overview + href: xelement-class-overview.md + - name: XAttribute class overview + href: xattribute-class-overview.md + - name: XDocument class overview + href: xdocument-class-overview.md + - name: How to build LINQ to XML examples + href: build-linq-xml-examples.md + - name: XML trees + items: + - name: Functional construction + href: functional-construction.md + - name: Create XML trees in C# + href: create-xml-trees.md + - name: XML literals in Visual Basic + href: xml-literals.md + - name: Parse XML + items: + - name: How to parse a string + href: parse-string.md + - name: How to load XML from a file + href: load-xml-file.md + - name: Preserve white space while loading or parsing XML + href: preserve-white-space-loading-parsing-xml.md + - name: How to catch parsing errors + href: catch-parsing-errors.md + - name: How to create a tree from an XmlReader + href: create-tree-xmlreader.md + - name: How to stream XML fragments from an XmlReader + href: stream-xml-fragments-xmlreader.md + - name: How to populate an XML tree with an XmlWriter + href: populate-xml-tree-xmlwriter.md + - name: How to validate using XSD + href: validate-xsd.md + - name: Valid content of XElement and XDocument objects + href: valid-content-xelement-xdocument-objects.md + - name: Work with XML namespaces + items: + - name: Namespaces overview + href: namespaces-overview.md + - name: How to create a document with namespaces in C# + href: create-document-namespaces-csharp.md + - name: How to create a document with namespaces in Visual Basic + href: create-document-namespaces-visual-basic.md + - name: How to control namespace prefixes + href: control-namespace-prefixes.md + - name: Scope of default namespaces + href: scope-default-namespaces.md + - name: Work with global namespaces in Visual Basic + href: work-global-namespaces.md + - name: How to write queries on XML in namespaces + href: write-queries-xml-namespaces.md + - name: Serialize XML trees + items: + - name: Preserve white space while serializing + href: preserve-white-space-serializing.md + - name: Serialize with an XML declaration + href: serialize-xml-declaration.md + - name: Serialize to files, TextWriters, and XmlWriters + href: serialize-files-textwriters-xmlwriters.md + - name: Serialize to an XmlReader (invoke XSLT) + href: serialize-xmlreader-invoke-xslt.md + - name: LINQ to XML axes + items: + - name: LINQ to XML axes overview + href: linq-xml-axes-overview.md + - name: How to retrieve a collection of elements + href: retrieve-collection-elements.md + - name: How to retrieve the value of an element + href: retrieve-value-element.md + - name: How to filter on element names + href: filter-element-names.md + - name: How to chain axis method calls + href: chain-axis-method-calls.md + - name: How to retrieve a single child element + href: retrieve-single-child-element.md + - name: How to retrieve a collection of attributes + href: retrieve-collection-attributes.md + - name: How to retrieve a single attribute + href: retrieve-single-attribute.md + - name: How to retrieve the value of an attribute + href: retrieve-value-attribute.md + - name: How to retrieve the shallow value of an element + href: retrieve-shallow-value-element.md + - name: Language-integrated axes in Visual Basic + href: language-integrated-axes.md + - name: Query XML trees + items: + - name: Query XML trees overview + href: query-xml-trees-overview.md + - name: Basic queries + items: + - name: How to find an element with a specific attribute + href: find-element-specific-attribute.md + - name: How to find an element with a specific child element + href: find-element-specific-child-element.md + - name: Query an XDocument vs. query an XElement + href: query-xdocument-vs-query-xelement.md + - name: How to find descendants with a specific element name + href: find-descendants-specific-element-name.md + - name: How to find a single descendant using the Descendants method + href: find-single-descendant-descendants-method.md + - name: How to write queries with complex filtering + href: write-queries-complex-filtering.md + - name: How to filter on an optional element + href: filter-optional-element.md + - name: How to find all nodes in a namespace + href: find-all-nodes-namespace.md + - name: How to sort elements + href: sort-elements.md + - name: How to sort elements on multiple Keys + href: sort-elements-multiple-keys.md + - name: How to calculate intermediate values + href: calculate-intermediate-values.md + - name: How to write a query that finds elements based on context + href: write-query-finds-elements-based-context.md + - name: How to debug empty query results sets + href: debug-empty-query-results-sets.md + - name: Projections and transformations + items: + - name: How to work with dictionaries using LINQ to XML + href: work-dictionaries-linq-xml.md + - name: How to transform the shape of an XML tree + href: transform-shape-xml-tree.md + - name: How to control the type of a projection + href: control-type-projection.md + - name: How to project a new type + href: project-new-type.md + - name: How to project an object graph + href: project-object-graph.md + - name: How to project an anonymous type + href: project-anonymous-type.md + - name: How to generate text files from XML + href: generate-text-files-xml.md + - name: How to generate XML from CSV files + href: generate-xml-csv-files.md + - name: Advanced query techniques + items: + - name: How to join two collections + href: join-two-collections.md + - name: How to create hierarchy using grouping + href: create-hierarchy-grouping.md + - name: How to query LINQ to XML using XPath + href: query-linq-xml-xpath.md + - name: How to write a LINQ to XML axis method + href: write-linq-xml-axis-method.md + - name: How to perform streaming transformations of text to XML in C# + href: perform-streaming-transformations-text-xml.md + - name: How to list all nodes in a tree + href: list-all-nodes-tree.md + - name: How to retrieve paragraphs from an Office Open XML document + href: retrieve-paragraphs-office-open-xml-document.md + - name: How to modify an Office Open XML document + href: modify-office-open-xml-document.md + - name: How to populate an XML tree from the file system + href: populate-xml-tree-file-system.md + - name: LINQ to XML for XPath users + items: + - name: Comparison of XPath and LINQ to XML + href: comparison-xpath-linq-xml.md + - name: How to find a child element + href: find-child-element.md + - name: How to find a list of child elements + href: find-list-child-elements.md + - name: How to find the root element + href: find-root-element.md + - name: How to find descendant elements + href: find-descendant-elements.md + - name: How to filter on an attribute + href: filter-attribute.md + - name: How to find related elements + href: find-related-elements.md + - name: How to find elements in a namespace + href: find-elements-namespace.md + - name: How to find preceding siblings + href: find-preceding-siblings.md + - name: How to find descendants of a child element + href: find-descendants-child-element.md + - name: How to find a union of two location paths + href: find-union-two-location-paths.md + - name: How to find sibling nodes + href: find-sibling-nodes.md + - name: How to find an attribute of the parent + href: find-attribute-parent.md + - name: How to find attributes of siblings with a specific name + href: find-attributes-siblings-specific-name.md + - name: How to find elements with a specific attribute + href: find-elements-specific-attribute.md + - name: How to find child elements based on position + href: find-child-elements-based-position.md + - name: How to find the immediate preceding sibling + href: find-immediate-preceding-sibling.md + - name: Pure functional transformations of XML + items: + - name: Introduction to pure functional transformations + href: introduction-pure-functional-transformations.md + - name: Concepts and terminology (functional transformation) + href: concepts-terminology-functional-transformation.md + - name: Functional programming vs. imperative programming + href: functional-vs-imperative-programming.md + - name: Refactor into pure functions + href: refactor-pure-functions.md + - name: Applicability of functional transformation + href: applicability-functional-transformation.md + - name: Functional transformation of XML + href: functional-transformation-xml.md + - name: Deferred execution and lazy evaluation + href: deferred-execution-lazy-evaluation.md + - name: Deferred execution example + href: deferred-execution-example.md + - name: "Tutorial: Chain queries together (C#)" + items: + - name: Chain queries example (C#) + href: chain-queries-example.md + - name: Intermediate materialization (C#) + href: intermediate-materialization.md + - name: Chain standard query operators together (C#) + href: chain-standard-query-operators-together.md + - name: "Tutorial: Manipulate content in a WordprocessingML document" + items: + - name: The XML shape of WordprocessingML documents + href: xml-shape-wordprocessingml-documents.md + - name: Create the source Office Open XML document + href: create-source-office-open-xml-document.md + - name: Find the default paragraph style + href: find-default-paragraph-style.md + - name: Retrieve the paragraphs and their styles + href: retrieve-paragraphs-styles.md + - name: Retrieve the text of the paragraphs + href: retrieve-text-paragraphs.md + - name: Refactor using an extension method + href: refactor-extension-method.md + - name: Refactor using a pure function + href: refactor-pure-function.md + - name: Project XML in a different shape + href: project-xml-different-shape.md + - name: Find text in Word documents + href: find-text-word-documents.md + - name: Details of Office Open XML WordprocessingML documents + items: + - name: WordprocessingML document with styles + href: wordprocessingml-document-styles.md + - name: Style part of a WordprocessingML document + href: style-part-wordprocessingml-document.md + - name: Example that outputs Office Open XML document parts + href: example-outputs-office-open-xml-document-parts.md + - name: Modify XML trees + items: + - name: In-memory XML tree modification vs. functional construction + href: in-memory-xml-tree-modification-vs-functional-construction.md + - name: Add elements, attributes, and nodes to an XML tree + href: add-elements-attributes-nodes-xml-tree.md + - name: Modify elements, attributes, and nodes in an XML tree + href: modify-elements-attributes-nodes-xml-tree.md + - name: Remove elements, attributes, and nodes from an XML tree + href: remove-elements-attributes-nodes-xml-tree.md + - name: Maintain name-value pairs + href: maintain-name-value-pairs.md + - name: How to change the namespace for an entire XML tree + href: change-namespace-entire-xml-tree.md + - name: Performance + items: + - name: Performance of chained queries + href: performance-chained-queries.md + - name: Atomized XName and XNamespace objects + href: atomized-xname-xnamespace-objects.md + - name: Pre-atomization of XName objects + href: pre-atomization-xname-objects.md + - name: Statically compiled queries + href: statically-compiled-queries.md + - name: Advanced LINQ to XML programming + items: + - name: LINQ to XML annotations + href: linq-xml-annotations.md + - name: LINQ to XML events + href: linq-xml-events.md + - name: Program with nodes + href: program-nodes.md + - name: Mixed declarative/imperative code bugs + href: mixed-declarative-imperative-code-bugs.md + - name: How to stream XML fragments with access to header information + href: stream-xml-fragments-access-header-information.md + - name: How to perform streaming transform of large XML documents + href: perform-streaming-transform-large-xml-documents.md + - name: How to read and write an encoded document + href: read-write-encoded-document.md + - name: Use XSLT to transform an XML tree + href: use-xslt-transform-xml-tree.md + - name: How to use annotations to transform LINQ to XML trees in an XSLT style + href: use-annotations-transform-linq-xml-trees-xslt-style.md + - name: Serialize object graphs that contain XElement objects + items: + - name: How to serialize using XmlSerializer + href: serialize-xmlserializer.md + - name: How to serialize using DataContractSerializer + href: serialize-datacontractserializer.md + - name: LINQ to XML security + href: linq-xml-security.md + - name: Sample XML documents + items: + - name: "Sample XML file: Typical purchase order" + href: sample-xml-file-typical-purchase-order.md + - name: "Sample XML file: Typical purchase order in a namespace" + href: sample-xml-file-typical-purchase-order-namespace.md + - name: "Sample XML file: Multiple purchase orders" + href: sample-xml-file-multiple-purchase-orders.md + - name: "Sample XML file: Multiple purchase orders in a namespace" + href: sample-xml-file-multiple-purchase-orders-namespace.md + - name: "Sample XML file: Test configuration" + href: sample-xml-file-test-configuration.md + - name: "Sample XML file: Test configuration in a namespace" + href: sample-xml-file-test-configuration-namespace.md + - name: "Sample XML file: Customers and orders" + href: sample-xml-file-customers-orders.md + - name: "Sample XSD file: Customers and orders" + href: sample-xsd-file-customers-orders.md + - name: "Sample XML file: Customers and orders in a namespace" + href: sample-xml-file-customers-orders-namespace.md + - name: "Sample XML file: Numerical data" + href: sample-xml-file-numerical-data.md + - name: "Sample XML file: Numerical data in a namespace" + href: sample-xml-file-numerical-data-namespace.md + - name: "Sample XML file: Books" + href: sample-xml-file-books.md + - name: "Sample XML file: Consolidated purchase orders" + href: sample-xml-file-consolidated-purchase-orders.md + - name: Reference + href: reference.md diff --git a/docs/standard/linq/transform-shape-xml-tree.md b/docs/standard/linq/transform-shape-xml-tree.md new file mode 100644 index 0000000000000..ec2b1ad2e9ce9 --- /dev/null +++ b/docs/standard/linq/transform-shape-xml-tree.md @@ -0,0 +1,199 @@ +--- +title: How to transform the shape of an XML tree - LINQ to XML +description: You can use functional construction to change the shape of an XML document; that is, to retain the data but change such things as element names, attribute names, and hierarchy. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 93c5d426-dea2-4709-a991-60204de42e8f +--- + +# How to transform the shape of an XML tree (LINQ to XML) + +The *shape* of an XML document refers to its element names, attribute names, and the characteristics of its hierarchy. + +Sometimes you will have to change the shape of an XML document. For example, you might have to send an existing XML document to another system that requires different element and attribute names. You could go through the document, deleting and renaming elements as required, but using functional construction results in more readable and maintainable code. For more information about functional construction, see [Functional construction](functional-construction.md). + +The first example in this article changes the organization of an XML document. It moves complex elements from one location in the tree to another. + +The second example creates an XML document whose shape differs from that of the source document. It omits some elements, renames others, and changes the casing of the element names. + +## Example: Use embedded query expressions to change the shape of an XML tree + +The following example changes the shape of an XML file using embedded query expressions. + +The source XML document for this example, [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md), contains a `Customers` element under the `Root` element that contains all customers. It also contains an `Orders` element under the `Root` element that contains all orders. The example creates a new XML tree in which the orders for each customer are contained in an `Orders` element within the `Customer` element. The original document also contains a `CustomerID` element in the `Order` element; this element is omitted from the new tree. + +```csharp +XElement co = XElement.Load("CustomersOrders.xml"); +XElement newCustOrd = + new XElement("Root", + from cust in co.Element("Customers").Elements("Customer") + select new XElement("Customer", + cust.Attributes(), + cust.Elements(), + new XElement("Orders", + from ord in co.Element("Orders").Elements("Order") + where (string)ord.Element("CustomerID") == (string)cust.Attribute("CustomerID") + select new XElement("Order", + ord.Attributes(), + ord.Element("EmployeeID"), + ord.Element("OrderDate"), + ord.Element("RequiredDate"), + ord.Element("ShipInfo") + ) + ) + ) + ); +Console.WriteLine(newCustOrd); +``` + + ```vb +Dim co As XElement = XElement.Load("CustomersOrders.xml") +Dim newCustOrd = _ + + <%= From cust In co.. _ + Select _ + + <%= cust.Attributes() %> + <%= cust.Elements() %> + + <%= From ord In co.. _ + Where ord..Value = cust.@CustomerID _ + Select _ + + <%= ord.Attributes() %> + <%= ord. %> + <%= ord. %> + <%= ord. %> + <%= ord. %> + _ + %> + + _ + %> + +Console.WriteLine(newCustOrd) +``` + +This example produces the following output: + +```xml + + + Great Lakes Food Market + Howard Snyder + Marketing Manager + (503) 555-7555 + +
2732 Baker Blvd.
+ Eugene + OR + 97403 + USA +
+ +
+ + Hungry Coyote Import Store + Yoshi Latimer + Sales Representative + (503) 555-6874 + (503) 555-2376 + +
City Center Plaza 516 Main St.
+ Elgin + OR + 97827 + USA +
+ +
+ ... +
+``` + +## Example: Create a document whose shape differs from that of the source document + +This example renames some elements and converts some attributes to elements. It calls `ConvertAddress`, which returns a list of objects. The argument to the method is a query that determines the `Address` complex element where the `Type` attribute has a value of `"Shipping"`. The example uses XML document [Sample XML file: Typical purchase order](sample-xml-file-typical-purchase-order.md). + +```csharp +static IEnumerable ConvertAddress(XElement add) +{ + List fragment = new List() { + new XElement("NAME", (string)add.Element("Name")), + new XElement("STREET", (string)add.Element("Street")), + new XElement("CITY", (string)add.Element("City")), + new XElement("ST", (string)add.Element("State")), + new XElement("POSTALCODE", (string)add.Element("Zip")), + new XElement("COUNTRY", (string)add.Element("Country")) + }; + return fragment; +} + +static void Main(string[] args) +{ + XElement po = XElement.Load("PurchaseOrder.xml"); + XElement newPo = new XElement("PO", + new XElement("ID", (string)po.Attribute("PurchaseOrderNumber")), + new XElement("DATE", (DateTime)po.Attribute("OrderDate")), + ConvertAddress( + (from el in po.Elements("Address") + where (string)el.Attribute("Type") == "Shipping" + select el) + .First() + ) + ); + Console.WriteLine(newPo); +} +``` + +```vb +Function ConvertAddress(ByVal add As XElement) As IEnumerable(Of XElement) + Dim fragment = New List(Of XElement) + fragment.Add(<%= add..Value %>) + fragment.Add(<%= add..Value %>) + fragment.Add(<%= add..Value %>) + fragment.Add(<%= add..Value %>) + fragment.Add(<%= add..Value %>) + fragment.Add(<%= add..Value %>) + Return fragment +End Function + +Sub Main() + Dim po As XElement = XElement.Load("PurchaseOrder.xml") + Dim newPo As XElement = _ + + <%= po.@PurchaseOrderNumber %> + <%= CDate(po.@OrderDate) %> + <%= _ + ConvertAddress( _ + (From el In po.
_ + Where el.@Type = "Shipping" _ + Select el) _ + .First() _ + ) _ + %> + + Console.WriteLine(newPo) +End Sub +``` + +This example produces the following output: + +```xml + + 99503 + 1999-10-20T00:00:00 + Ellen Adams + 123 Maple Street + Mill Valley + CA + 10999 + USA + +``` + +## See also + +- [Projections and Transformations (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md) diff --git a/docs/standard/linq/use-annotations-transform-linq-xml-trees-xslt-style.md b/docs/standard/linq/use-annotations-transform-linq-xml-trees-xslt-style.md new file mode 100644 index 0000000000000..ffe9e01504ce4 --- /dev/null +++ b/docs/standard/linq/use-annotations-transform-linq-xml-trees-xslt-style.md @@ -0,0 +1,645 @@ +--- +title: How to use annotations to transform LINQ to XML trees in an XSLT style - LINQ to XML +description: Learn how to use annotations to transform XML documents that are document-centric with mixed content. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 12a95902-a6b7-4a1e-ad52-04a518db226f +--- +# How to use annotations to transform LINQ to XML trees in an XSLT style (LINQ to XML) + +Annotations can be used to facilitate transforms of an XML tree. + +Some XML documents are "document-centric with mixed content." With such documents, you don't necessarily know the shape of child nodes of an element. For instance, a node that contains text may look like this: + +```xml +A phrase with bold and italic text. +``` + +For any given text node, there may be any number of child `` and `` elements. This approach extends to a number of other situations, such as pages that can contain a variety of child elements, which could be regular paragraphs, bulleted paragraphs, and bitmaps. Cells in a table may contain text, drop down lists, or bitmaps. One of the primary characteristics of document-centric XML is that you don't know which child element any particular element will have. + +If you want to transform elements in a tree where you don't necessarily know much about the children of the elements that you want to transform, then this approach that uses annotations is an effective one. + +The summary of the approach is: + +- First, annotate elements in the tree with a replacement element. +- Second, iterate through the entire tree, creating a new tree where you replace each element with its annotation. The examples in this article implement the iteration and creation of the new tree in a function named `XForm`. + +In detail, the approach consists of: + +- Execute one or more LINQ to XML queries that return the set of elements that you want to transform from one shape to another. For each element in the query, add a new object as an annotation to the element. This new element will replace the annotated element in the new, transformed tree. This is simple code to write, as demonstrated by the example. +- The new element that's added as an annotation can contain new child nodes; it can form a subtree with any desired shape. +- There is a special rule: If a child node of the new element is in a different namespace, a namespace that's made up for this purpose (in this example, the namespace is `http://www.microsoft.com/LinqToXmlTransform/2007`), then that child element isn't copied to the new tree. Instead, if the namespace is the above-mentioned special namespace, and the local name of the element is `ApplyTransforms`, then the child nodes of the element in the source tree are iterated, and copied to the new tree (with the exception that annotated child elements are themselves transformed according to these rules). +- This is somewhat analogous to the specification of transforms in XSL. The query that selects a set of nodes is analogous to the XPath expression for a template. The code to create the new that's saved as an annotation is analogous to the sequence constructor in XSL, and the `ApplyTransforms` element is analogous in function to the `xsl:apply-templates` element in XSL. +- One advantage to taking this approach is that, as you formulate queries, you're always writing queries on the unmodified source tree. You don't need to worry about how modifications to the tree affect the queries that you're writing. + +## Example: Rename all paragraph nodes + +This example renames all `Paragraph` nodes to `para`. + +```csharp +XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; +XName at = xf + "ApplyTransforms"; + +XElement root = XElement.Parse(@" + + This is a sentence with bold and italic text. + More text. +"); + +// replace Paragraph with para +foreach (var el in root.Descendants("Paragraph")) + el.AddAnnotation( + new XElement("para", + // same idea as xsl:apply-templates + new XElement(xf + "ApplyTransforms") + ) + ); + +// The XForm method, shown later in this article, accomplishes the transform +XElement newRoot = XForm(root); + +Console.WriteLine(newRoot); +``` + +```vb +Imports + +Module Module1 + Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" + + Sub Main() + Dim root As XElement = _ + + This is a sentence with bold and italic text. + More text. + + + ' Replace Paragraph with p. + For Each el In root... + ' same idea as xsl:apply-templates + el.AddAnnotation( _ + + <<%= at %>> + ) + Next + + ' The XForm function, shown later in this article, accomplishes the transform + Dim newRoot As XElement = XForm(root) + Console.WriteLine(newRoot) + End Sub +End Module +``` + +This example produces the following output: + +```xml + + This is a sentence with bold and italic text. + More text. + +``` + +## Example: Calculate averages and sums and add them as new elements to the tree + +The following example calculates the average and sum of the `Data` elements and adds them as new elements to the tree. + +```csharp +XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; +XName at = xf + "ApplyTransforms"; + +XElement data = new XElement("Root", + new XElement("Data", 20), + new XElement("Data", 10), + new XElement("Data", 3) +); + +// while adding annotations, you can query the source tree all you want, +// as the tree isn't mutated while annotating. +var avg = data.Elements("Data").Select(z => (Decimal)z).Average(); +data.AddAnnotation( + new XElement("Root", + new XElement(xf + "ApplyTransforms"), + new XElement("Average", $"{avg:F4}"), + new XElement("Sum", + data + .Elements("Data") + .Select(z => (int)z) + .Sum() + ) + ) +); + +Console.WriteLine("Before Transform"); +Console.WriteLine("----------------"); +Console.WriteLine(data); +Console.WriteLine(); +Console.WriteLine(); + +// The XForm method, shown later in this article, accomplishes the transform +XElement newData = XForm(data); + +Console.WriteLine("After Transform"); +Console.WriteLine("----------------"); +Console.WriteLine(newData); +``` + +```vb +Imports + +Module Module1 + Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" + + Sub Main() + Dim data As XElement = _ + + 20 + 10 + 3 + + + ' While adding annotations, you can query the source tree all you want, + ' as the tree isn't mutated while annotating. + data.AddAnnotation( _ + + <<%= at %>/> + + <%= _ + String.Format("{0:F4}", _ + data.Elements("Data") _ + .Select(Function(z) CDec(z)).Average()) _ + %> + + + <%= _ + data.Elements("Data").Select(Function(z) CInt(z)).Sum() _ + %> + + _ + ) + + Console.WriteLine("Before Transform") + Console.WriteLine("----------------") + Console.WriteLine(data) + Console.WriteLine(vbNewLine) + + ' The XForm function, shown later in this article, accomplishes the transform + Dim newData As XElement = XForm(data) + + Console.WriteLine("After Transform") + Console.WriteLine("----------------") + Console.WriteLine(newData) + End Sub +End Module +``` + +This example produces the following output: + +```output +Before Transform +---------------- + + 20 + 10 + 3 + + +After Transform +---------------- + + 20 + 10 + 3 + 11.0000 + 33 + +``` + +## Example: Create a new transformed tree from the original annotated tree + +A small function, `XForm`, creates a new transformed tree from the original, annotated tree. The following is pseudocode for this function: + +> The function takes an XElement as an argument and returns an XElement. +> +> If an element has an XElement annotation, the returned XElement has these characteristics: +> +> - The name of the new XElement is the annotation element's name. +> - All attributes are copied from the annotation to the new node. +> - All child nodes are copied from the annotation, with the exception that the special node xf:ApplyTransforms is recognized, and the source element's child nodes are iterated. If the source child node isn't an XElement, it's copied to the new tree. If the source child is an XElement, then it's transformed by calling this function recursively. +> +> Otherwise, the returned XElement has these characteristics: +> +> - The name of the new XElement is the source element's name. +> - All attributes are copied from the source element to the destination's element. +> - All child nodes are copied from the source element. +> - If the source child node isn't an XElement, it's copied to the new tree. If the source child is an XElement, then it's transformed by calling this function recursively. + +The following is code for this function: + +```csharp +// Build a transformed XML tree per the annotations +static XElement XForm(XElement source) +{ + XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; + XName at = xf + "ApplyTransforms"; + + if (source.Annotation() != null) + { + XElement anno = source.Annotation(); + return new XElement(anno.Name, + anno.Attributes(), + anno + .Nodes() + .Select( + (XNode n) => + { + XElement annoEl = n as XElement; + if (annoEl != null) + { + if (annoEl.Name == at) + return (object)( + source.Nodes() + .Select( + (XNode n2) => + { + XElement e2 = n2 as XElement; + if (e2 == null) + return n2; + else + return XForm(e2); + } + ) + ); + else + return n; + } + else + return n; + } + ) + ); + } + else + { + return new XElement(source.Name, + source.Attributes(), + source + .Nodes() + .Select(n => + { + XElement el = n as XElement; + if (el == null) + return n; + else + return XForm(el); + } + ) + ); + } +} +``` + +```vb +' Build a transformed XML tree per the annotations. +Function XForm(ByVal source As XElement) As XElement + If source.Annotation(Of XElement)() IsNot Nothing Then + Dim anno As XElement = source.Annotation(Of XElement)() + Return _ + <<%= anno.Name.ToString() %>> + <%= anno.Attributes() %> + <%= anno.Nodes().Select(Function(n As XNode) _ + GetSubNodes(n, source)) %> + + Else + Return _ + <<%= source.Name %>> + <%= source.Attributes() %> + <%= source.Nodes().Select(Function(n) GetExpandedNodes(n)) %> + + End If +End Function + +Private Function GetSubNodes(ByVal n As XNode, ByVal s As XElement) As Object + Dim annoEl As XElement = TryCast(n, XElement) + If annoEl IsNot Nothing Then + If annoEl.Name = at Then + Return s.Nodes().Select(Function(n2 As XNode) GetExpandedNodes(n2)) + End If + End If + Return n +End Function + +Private Function GetExpandedNodes(ByVal n2 As XNode) As XNode + Dim e2 As XElement = TryCast(n2, XElement) + If e2 Is Nothing Then + Return n2 + Else + Return XForm(e2) + End If +End Function +``` + +## Example: Show `XForm` in typical uses of this type of transform + +The following example includes the `XForm` function and a few of the typical uses of this type of transform: + +```csharp +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml; +using System.Xml.Linq; + +class Program +{ + static XNamespace xf = "http://www.microsoft.com/LinqToXmlTransform/2007"; + static XName at = xf + "ApplyTransforms"; + + // Build a transformed XML tree per the annotations + static XElement XForm(XElement source) + { + if (source.Annotation() != null) + { + XElement anno = source.Annotation(); + return new XElement(anno.Name, + anno.Attributes(), + anno + .Nodes() + .Select( + (XNode n) => + { + XElement annoEl = n as XElement; + if (annoEl != null) + { + if (annoEl.Name == at) + return (object)( + source.Nodes() + .Select( + (XNode n2) => + { + XElement e2 = n2 as XElement; + if (e2 == null) + return n2; + else + return XForm(e2); + } + ) + ); + else + return n; + } + else + return n; + } + ) + ); + } + else + { + return new XElement(source.Name, + source.Attributes(), + source + .Nodes() + .Select(n => + { + XElement el = n as XElement; + if (el == null) + return n; + else + return XForm(el); + } + ) + ); + } + } + + static void Main(string[] args) + { + XElement root = new XElement("Root", + new XComment("A comment"), + new XAttribute("Att1", 123), + new XElement("Child", 1), + new XElement("Child", 2), + new XElement("Other", + new XElement("GC", 3), + new XElement("GC", 4) + ), + XElement.Parse( + "This is an element that " + + "has some mixed content"), + new XElement("AnUnchangedElement", 42) + ); + + // each of the following serves the same semantic purpose as + // XSLT templates and sequence constructors + + // replace Child with NewChild + foreach (var el in root.Elements("Child")) + el.AddAnnotation(new XElement("NewChild", (string)el)); + + // replace first GC with GrandChild, add an attribute + foreach (var el in root.Descendants("GC").Take(1)) + el.AddAnnotation( + new XElement("GrandChild", + new XAttribute("ANewAttribute", 999), + (string)el + ) + ); + + // replace Other with NewOther, add new child elements around original content + foreach (var el in root.Elements("Other")) + el.AddAnnotation( + new XElement("NewOther", + new XElement("MyNewChild", 1), + // same idea as xsl:apply-templates + new XElement(xf + "ApplyTransforms"), + new XElement("ChildThatComesAfter") + ) + ); + + // change name of element that has mixed content + root.Descendants("SomeMixedContent").First().AddAnnotation( + new XElement("MixedContent", + new XElement(xf + "ApplyTransforms") + ) + ); + + // replace with + foreach (var el in root.Descendants("b")) + el.AddAnnotation( + new XElement("Bold", + new XElement(xf + "ApplyTransforms") + ) + ); + + // replace with + foreach (var el in root.Descendants("i")) + el.AddAnnotation( + new XElement("Italic", + new XElement(xf + "ApplyTransforms") + ) + ); + + Console.WriteLine("Before Transform"); + Console.WriteLine("----------------"); + Console.WriteLine(root); + Console.WriteLine(); + Console.WriteLine(); + XElement newRoot = XForm(root); + + Console.WriteLine("After Transform"); + Console.WriteLine("----------------"); + Console.WriteLine(newRoot); + } +} +``` + +```vb +Imports System.Collections.Generic +Imports System.Linq +Imports System.Text +Imports System.Xml +Imports System.Xml.Linq + +Imports + +Module Module1 + Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" + + ' Build a transformed XML tree per the annotations. + Function XForm(ByVal source As XElement) As XElement + If source.Annotation(Of XElement)() IsNot Nothing Then + Dim anno As XElement = source.Annotation(Of XElement)() + Return _ + <<%= anno.Name.ToString() %>> + <%= anno.Attributes() %> + <%= anno.Nodes().Select(Function(n As XNode) _ + GetSubNodes(n, source)) %> + + Else + Return _ + <<%= source.Name %>> + <%= source.Attributes() %> + <%= source.Nodes().Select(Function(n) GetExpandedNodes(n)) %> + + End If + End Function + + Private Function GetSubNodes(ByVal n As XNode, ByVal s As XElement) As Object + Dim annoEl As XElement = TryCast(n, XElement) + If annoEl IsNot Nothing Then + If annoEl.Name = at Then + Return s.Nodes().Select(Function(n2 As XNode) GetExpandedNodes(n2)) + End If + End If + Return n + End Function + + Private Function GetExpandedNodes(ByVal n2 As XNode) As XNode + Dim e2 As XElement = TryCast(n2, XElement) + If e2 Is Nothing Then + Return n2 + Else + Return XForm(e2) + End If + End Function + + Sub Main() + Dim root As XElement = _ + + + 1 + 2 + + 3 + 4 + + This is an element that has some mixed content + 42 + + + ' Each of the following serves the same semantic purpose as + ' XSLT templates and sequence constructors. + + ' Replace Child with NewChild. + For Each el In root. + el.AddAnnotation(<%= CStr(el) %>) + Next + + ' Replace first GC with GrandChild, add an attribute. + For Each el In root....Take(1) + el.AddAnnotation(<%= CStr(el) %>) + Next + + ' Replace Other with NewOther, add new child elements around original content. + For Each el In root. + el.AddAnnotation( _ + + 1 + <<%= at %>> + + ) + Next + + ' Change name of element that has mixed content. + root...(0).AddAnnotation( _ + <<%= at %>>) + + ' Replace with . + For Each el In root... + el.AddAnnotation(<<%= at %>>) + Next + + ' Replace with . + For Each el In root... + el.AddAnnotation(<<%= at %>>) + Next + + Console.WriteLine("Before Transform") + Console.WriteLine("----------------") + Console.WriteLine(root) + Console.WriteLine(vbNewLine) + Dim newRoot As XElement = XForm(root) + + Console.WriteLine("After Transform") + Console.WriteLine("----------------") + Console.WriteLine(newRoot) + End Sub +End Module +``` + +This example produces the following output: + +```output +Before Transform +---------------- + + + 1 + 2 + + 3 + 4 + + This is an element that has some mixed content + 42 + + +After Transform +---------------- + + + 1 + 2 + + 1 + 3 + 4 + + + This is an element that has some mixed content + 42 + +``` diff --git a/docs/standard/linq/use-xslt-transform-xml-tree.md b/docs/standard/linq/use-xslt-transform-xml-tree.md new file mode 100644 index 0000000000000..f3eafbfdba4f1 --- /dev/null +++ b/docs/standard/linq/use-xslt-transform-xml-tree.md @@ -0,0 +1,120 @@ +--- +title: Use XSLT to transform an XML tree - LINQ to XML +description: Learn to use XSLT to transform an XML tree, using XmlReader to read and XmlWriter to write. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 373a2699-d4c5-471b-9bda-c1f0ab73b477 +--- +# Use XSLT to transform an XML tree (LINQ to XML) + +You can use XSLT to transform an XML tree, using to read and to write. + +## Example: Use XSLT to transform an XML tree, using `XMLReader` to read and `XMLWriter` to write + +This example creates an XML tree and uses XSLT to transform it. It makes use of an to read the original tree, and an to write the transformed version. + +It starts by creating: + +- An XML tree. +- An of the XML tree. +- A new document to hold the XSLT output. +- An to write the transformed tree to the new document. + +It then invokes an XSLT transformation that uses the to read the original XML tree, and the to write the transformed tree to the new document. + +```csharp +string xslt = @" + + + + + + + + + + + + "; + +var oldDocument = new XDocument( + new XElement("Parent", + new XElement("Child1", "Child1 data"), + new XElement("Child2", "Child2 data") + ) +); + +var newDocument = new XDocument(); + +using (var stringReader = new StringReader(xslt)) +{ + using (XmlReader xsltReader = XmlReader.Create(stringReader)) + { + var transformer = new XslCompiledTransform(); + transformer.Load(xsltReader); + using (XmlReader oldDocumentReader = oldDocument.CreateReader()) + { + using (XmlWriter newDocumentWriter = newDocument.CreateWriter()) + { + transformer.Transform(oldDocumentReader, newDocumentWriter); + } + } + } +} + +string result = newDocument.ToString(); +Console.WriteLine(result); +``` + +```vb +Dim xslMarkup As XDocument = _ + + + + + + + + + + + + + + +Dim xmlTree As XElement = _ + + Child1 data + Child2 data + + +Dim newTree As XDocument = New XDocument() + +Using writer As XmlWriter = newTree.CreateWriter() + ' Load the style sheet. + Dim xslt As XslCompiledTransform = _ + New XslCompiledTransform() + xslt.Load(xslMarkup.CreateReader()) + + ' Execute the transform and output the results to a writer. + xslt.Transform(xmlTree.CreateReader(), writer) +End Using + +Console.WriteLine(newTree) +``` + +This example produces the following output: + +```xml + + Child1 data + Child2 data + +``` + +## See also + +- +- diff --git a/docs/standard/linq/valid-content-xelement-xdocument-objects.md b/docs/standard/linq/valid-content-xelement-xdocument-objects.md new file mode 100644 index 0000000000000..cdea03f9b699d --- /dev/null +++ b/docs/standard/linq/valid-content-xelement-xdocument-objects.md @@ -0,0 +1,77 @@ +--- +title: Valid content of XElement and XDocument objects - LINQ to XML +description: The XElement and XDocument constructors accept many argument types, including collections returned from queries. There are other constructors and functions for adding XML content. +ms.date: 07/20/2015 +ms.assetid: 0d253586-2b97-459f-b1a7-f30f38f3ed9f +--- + +# Valid content of XElement and XDocument objects (LINQ to XML) + +This article describes the valid arguments that can be passed to constructors, and methods that you use to add content to elements and documents. + +## Valid types for the XElement constructor + +Queries often evaluate to of or of . You can pass collections of or objects to the constructor. That's why it's convenient to pass the results of a query as content into methods and constructors that you use to populate XML trees. + +When adding simple content, various types can be passed to this method, including:: + +- +- +- +- +- +- +- +- +- Any type that implements `Object.ToString`. +- Any type that implements . + +When adding complex content, various types can be passed to this method, including: + +- +- +- +- Any type that implements + +If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. If the collection contains text (or objects that are converted to text), the text in the collection is concatenated and added as a single text node. + +If content is `null`, nothing is added. When passing a collection, items in the collection can be `null`. A `null` item in the collection has no effect on the tree. + +An added attribute must have a unique name within its containing element. + +When adding or objects, if the new content has no parent, then the objects are simply attached to the XML tree. If the new content already is parented and is part of another XML tree, then the new content is cloned, and the newly cloned content is attached to the XML tree. + +## Valid types for the XDocument constructor + +Attributes and simple content can't be added to a document. + +There aren't many scenarios that require you to create an . Instead, you can usually create your XML trees with an root node. Unless you have a specific requirement to create a document (for example, because you have to create processing instructions and comments at the top level, or you have to support document types), it's often more convenient to use as your root node. + +Valid types for the constructor include the following: + +- Zero or one objects. The document types must come before the element. +- Zero or one element. +- Zero or more comments. +- Zero or more processing instructions. +- Zero or more text nodes that contain only white space. + +## Constructors and functions for adding content + +The following methods allow you to add child content to an or an : + +|Method|Description| +|------------|-----------------| +||Constructs an .| +||Constructs a .| +||Adds to the end of the child content of the or .| +||Adds content after the .| +||Adds content before the .| +||Adds content at the beginning of the child content of the .| +||Replaces all content (child nodes and attributes) of an .| +||Replaces the attributes of an .| +||Replaces the children nodes with new content.| +||Replaces a node with new content.| + +## See also + +- [XML trees](functional-construction.md) diff --git a/docs/standard/linq/validate-xsd.md b/docs/standard/linq/validate-xsd.md new file mode 100644 index 0000000000000..a1141b026ce21 --- /dev/null +++ b/docs/standard/linq/validate-xsd.md @@ -0,0 +1,202 @@ +--- +title: How to validate using XSD - LINQ to XML +description: You can use extension methods from the System.Xml.Schema namespace to validate an XML tree against an XML Schema Definition Language (XSD) file. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 6a7f83a9-2d74-4c2b-8417-0a8595879516 +--- + +# How to validate using XSD (LINQ to XML) + +The namespace contains extension methods that make it easy to validate an XML tree against an XML Schema Definition Language (XSD) file. For more information, see the method documentation. + +## Example: Validate XDocument objects against an XmlSchemaSet + +The following example creates an , then validates two objects against the schema set. One of the documents is valid, the other isn't. + +```csharp +string xsdMarkup = + @" + + + + + + + + + "; +XmlSchemaSet schemas = new XmlSchemaSet(); +schemas.Add("", XmlReader.Create(new StringReader(xsdMarkup))); + +XDocument doc1 = new XDocument( + new XElement("Root", + new XElement("Child1", "content1"), + new XElement("Child2", "content1") + ) +); + +XDocument doc2 = new XDocument( + new XElement("Root", + new XElement("Child1", "content1"), + new XElement("Child3", "content1") + ) +); + +Console.WriteLine("Validating doc1"); +bool errors = false; +doc1.Validate(schemas, (o, e) => + { + Console.WriteLine("{0}", e.Message); + errors = true; + }); +Console.WriteLine("doc1 {0}", errors ? "did not validate" : "validated"); + +Console.WriteLine(); +Console.WriteLine("Validating doc2"); +errors = false; +doc2.Validate(schemas, (o, e) => + { + Console.WriteLine("{0}", e.Message); + errors = true; + }); +Console.WriteLine("doc2 {0}", errors ? "did not validate" : "validated"); +``` + +```vb +Dim errors As Boolean = False + +Private Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs) + Console.WriteLine("{0}", e.Message) + errors = True +End Sub + +Sub Main() + Dim xsdMarkup As XElement = _ + + + + + + + + + + + Dim schemas As XmlSchemaSet = New XmlSchemaSet() + schemas.Add("", xsdMarkup.CreateReader) + + Dim doc1 As XDocument = _ + + + content1 + content1 + + + Dim doc2 As XDocument = _ + + + content1 + content1 + + + Console.WriteLine("Validating doc1") + errors = False + doc1.Validate(schemas, AddressOf XSDErrors) + Console.WriteLine("doc1 {0}", IIf(errors = True, "did not validate", "validated")) + + Console.WriteLine() + Console.WriteLine("Validating doc2") + errors = False + doc2.Validate(schemas, AddressOf XSDErrors) + Console.WriteLine("doc2 {0}", IIf(errors = True, "did not validate", "validated")) +End Sub +``` + +This example produces the following output: + +```output +Validating doc1 +doc1 validated + +Validating doc2 +The element 'Root' has invalid child element 'Child3'. List of possible elements expected: 'Child2'. +doc2 did not validate +``` + +## Example: Validate an XML document from a file against a schema from a file + +The following example validates that the XML document from [Sample XML file: Customers and orders](sample-xml-file-customers-orders.md) is valid per the schema from [Sample XSD file: Customers and orders](sample-xsd-file-customers-orders.md). It then modifies the source XML document. It changes the `CustomerID` attribute on the first customer. After the change, orders will then refer to a customer that doesn't exist, so the XML document will no longer validate. + +```csharp +XmlSchemaSet schemas = new XmlSchemaSet(); +schemas.Add("", "CustomersOrders.xsd"); + +Console.WriteLine("Attempting to validate"); +XDocument custOrdDoc = XDocument.Load("CustomersOrders.xml"); +bool errors = false; +custOrdDoc.Validate(schemas, (o, e) => + { + Console.WriteLine("{0}", e.Message); + errors = true; + }); +Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); + +Console.WriteLine(); +// Modify the source document so that it won't validate. +custOrdDoc.Root.Element("Orders").Element("Order").Element("CustomerID").Value = "AAAAA"; +Console.WriteLine("Attempting to validate after modification"); +errors = false; +custOrdDoc.Validate(schemas, (o, e) => + { + Console.WriteLine("{0}", e.Message); + errors = true; + }); +Console.WriteLine("custOrdDoc {0}", errors ? "did not validate" : "validated"); +``` + +```vb +Dim errors As Boolean = False + +Private Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs) + Console.WriteLine("{0}", e.Message) + errors = True +End Sub + +Sub Main() + Dim schemas As XmlSchemaSet = New XmlSchemaSet() + schemas.Add("", "CustomersOrders.xsd") + + Console.WriteLine("Attempting to validate") + Dim custOrdDoc As XDocument = XDocument.Load("CustomersOrders.xml") + errors = False + custOrdDoc.Validate(schemas, AddressOf XSDErrors) + Console.WriteLine("custOrdDoc {0}", IIf(errors, "did not validate", "validated")) + + Console.WriteLine() + ' Modify the source document so that it won't validate. + custOrdDoc....(0).Value = "AAAAA" + Console.WriteLine("Attempting to validate after modification") + errors = False + custOrdDoc.Validate(schemas, AddressOf XSDErrors) + Console.WriteLine("custOrdDoc {0}", IIf(errors, "did not validate", "validated")) +End Sub +``` + +This example produces the following output: + +```output +Attempting to validate +custOrdDoc validated + +Attempting to validate after modification +The key sequence 'AAAAA' in Keyref fails to refer to some key. +custOrdDoc did not validate +``` + +## See also + +- +- [XML trees](functional-construction.md) diff --git a/docs/standard/linq/wordprocessingml-document-styles.md b/docs/standard/linq/wordprocessingml-document-styles.md new file mode 100644 index 0000000000000..e9d8e8b122115 --- /dev/null +++ b/docs/standard/linq/wordprocessingml-document-styles.md @@ -0,0 +1,137 @@ +--- +title: WordprocessingML document with styles - LINQ to XML +description: Learn about WordprocessingML documents whose paragraphs are formatted with styles. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 40e35de6-ac93-4bba-88ab-a018cbe93873 +--- + +# WordprocessingML document with styles (LINQ to XML) + +This article presents a WordprocessingML document that is more complicated than the one in [The XML shape of WordprocessingML documents](xml-shape-wordprocessingml-documents.md); specifically, it presents a document whose paragraphs are formatted with styles. + +To understand styles, it's helpful to know something about document structure. A WordprocessingML document is stored in a *package* that comprises *parts*. Specifically, the term *package* corresponds to a ZIP archive and the term *part* corresponds to a file stored within the ZIP. If a document contains paragraphs that are formatted with styles, there will be a document part that contains paragraphs that have styles applied to them, and a style part that defines the styles referenced in the document part. + +The easiest way to see the XML that makes up an Office Open XML document is to run the example in [Example that outputs Office Open XML document parts](example-outputs-office-open-xml-document-parts.md). + +When you access a package, you should do so through the relationships among parts, not through an arbitrary path. This issue is beyond the scope of the current tutorial, but the example programs in this and other tutorial articles demonstrate the correct approach. + +## Example: A document that uses styles + +The following document has paragraphs that are formatted with styles. The first paragraph has the style `Heading1` and other paragraphs have the `Code` style or the default style. For paragraphs with non-default styles the paragraph elements have a child element named `w:pPr`, which in turn has a child element `w:pStyle`. That element has an attribute, `w:val`, which contains the style name. For paragraphs with the default style, the paragraph element doesn't have a `w:p.Pr` child element. + +```xml + + + + + + + + + Parsing WordprocessingML with LINQ to XML + + + + + + The following example prints to the console. + + + + + + + + + using System; + + + + + + + + + + + + + class Program { + + + + + + + + public static void + + + + Main + + + + (string[] args) { + + + + + + + + Console.WriteLine("Hello World"); + + + + + + + + } + + + + + + + + } + + + + + + This example produces the following output: + + + + + + + + + Hello World + + + + + + + + + + +``` diff --git a/docs/standard/linq/work-dictionaries-linq-xml.md b/docs/standard/linq/work-dictionaries-linq-xml.md new file mode 100644 index 0000000000000..699c6fc9f1707 --- /dev/null +++ b/docs/standard/linq/work-dictionaries-linq-xml.md @@ -0,0 +1,109 @@ +--- +title: How to work with dictionaries using LINQ to XML - LINQ to XML +description: You can convert many kinds of data structures to XML, and you can convert XML to structures. Here is an example that converts a Generic.Dictionary to XML and back. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 57bcefe3-8433-4d3b-935a-511c9bcbdfa8 +--- + +# How to work with dictionaries using LINQ to XML + +It's often convenient to convert data structures of various kinds to XML, and then from XML to other data structures. This article shows a conversion of a to XML and back. + +## Example: Create a Dictionary and convert its contents to XML + +This first example creates a , and then converts it to XML. + +This C# version of the example uses a form of functional construction in which a query projects new objects, and the resulting collection is passed as an argument to the constructor of the Root object. + +The Visual Basic version uses XML literals and a query in an embedded expression. The query projects new objects which then become the new content for the `Root` object. + +```csharp +Dictionary dict = new Dictionary(); +dict.Add("Child1", "Value1"); +dict.Add("Child2", "Value2"); +dict.Add("Child3", "Value3"); +dict.Add("Child4", "Value4"); +XElement root = new XElement("Root", + from keyValue in dict + select new XElement(keyValue.Key, keyValue.Value) +); +Console.WriteLine(root); +``` + +```vb +Dim dict As Dictionary(Of String, String) = New Dictionary(Of String, String)() +dict.Add("Child1", "Value1") +dict.Add("Child2", "Value2") +dict.Add("Child3", "Value3") +dict.Add("Child4", "Value4") +Dim root As XElement = _ + + <%= From keyValue In dict _ + Select New XElement(keyValue.Key, keyValue.Value) %> + +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + Value1 + Value2 + Value3 + Value4 + +``` + +## Example: Create a dictionary and load it from XML data + +The next example creates a dictionary loads loads it from XML data. + +```csharp +XElement root = new XElement("Root", + new XElement("Child1", "Value1"), + new XElement("Child2", "Value2"), + new XElement("Child3", "Value3"), + new XElement("Child4", "Value4") +); + +Dictionary dict = new Dictionary(); +foreach (XElement el in root.Elements()) + dict.Add(el.Name.LocalName, el.Value); +foreach (string str in dict.Keys) + Console.WriteLine("{0}:{1}", str, dict[str]); +``` + +```vb +Dim root As XElement = _ + + Value1 + Value2 + Value3 + Value4 + + +Dim dict As Dictionary(Of String, String) = New Dictionary(Of String, String) +For Each el As XElement In root.Elements + dict.Add(el.Name.LocalName, el.Value) +Next +For Each str As String In dict.Keys + Console.WriteLine("{0}:{1}", str, dict(str)) +Next +``` + +This example produces the following output: + +```output +Child1:Value1 +Child2:Value2 +Child3:Value3 +Child4:Value4 +``` + +## See also + +- [Projections and Transformations (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md) diff --git a/docs/standard/linq/work-global-namespaces.md b/docs/standard/linq/work-global-namespaces.md new file mode 100644 index 0000000000000..4c00961a23f33 --- /dev/null +++ b/docs/standard/linq/work-global-namespaces.md @@ -0,0 +1,211 @@ +--- +title: Work with global namespaces in Visual Basic - LINQ to XML +description: You declare a namespace in Visual Basic with the Imports statement, whether the namespace is a default namespace or has a prefix. This article discusses Import statements and other aspects of working with namespaces. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 0a8064d5-e02f-4315-ad48-6deaa443a2f0 +--- + +# Work with global namespaces in Visual Basic (LINQ to XML) + +One of the key features of XML literals in Visual Basic is the capability to declare XML namespaces by using the `Imports` statement. Using this feature, you can declare an XML namespace that uses a prefix, or you can declare a default XML namespace. + +This capability is useful in two situations: + +- Namespaces declared in XML literals don't carry over into embedded expressions. Declaring global namespaces reduces the amount of work needed to use embedded expressions with namespaces. +- You must declare global namespaces in order to use namespaces with XML properties. + +You can declare global namespaces at the project level. You can also declare global namespaces at the module level, which overrides the project-level global namespaces. Finally, you can override global namespaces in an XML literal. + +When using XML literals or XML properties that are in globally declared namespaces, you can see the expanded name of XML literals or properties by hovering over them in Visual Studio. You will see the expanded name in a tooltip. + +You can get an object that corresponds to a global namespace using the `GetXmlNamespace` method. + +## Example: Use `Imports` to declare a global namespace + +The following example declares a default global namespace with the `Imports` statement, and then initializes an object in that namespace with an XML literal: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = + Console.WriteLine(root) + End Sub +End Module +``` + +This example produces the following output: + +```xml + +``` + +## Example: Declare a global namespace that has a prefix + +The next example declares a global namespace with a prefix, and initializes an element with an XML literal: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = + Console.WriteLine(root) + End Sub +End Module +``` + +This example produces the following output: + +```xml + +``` + +## Example: Declare a default namespace and use an embedded expression for the `Child` element + +Namespaces that are declared in XML literals don't carry over into embedded expressions. The following example declares a default namespace, and then uses an embedded expression for the `Child` element. + +```vb +Dim root As XElement = _ + + <%= %> + +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + + +``` + +The resulting XML includes a declaration of a default namespace so that the `Child` element is in no namespace. + +You could declare a different namespace in the embedded expression, as follows: + +```vb +Dim root As XElement = _ + + <%= %> + +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml + + + +``` + +However, with the global default namespace you can use XML literals without declaring namespaces. The resulting XML will be in the globally-declared default namespace, as in this example: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = + <%= %> + + Console.WriteLine(root) + End Sub +End Module +``` + +This example produces the following output: + +```xml + + + +``` + +## Example: Use namespaces with XML properties + +If you're working with an XML tree that's in a namespace, and you use XML properties, then you must use a global namespace so that the XML properties will also be in the correct namespace. The following example declares an XML tree in a namespace, and then prints the count of `Child` elements. + +```vb +Dim root As XElement = _ + + content + +Console.WriteLine(root..Count()) +``` + +This example indicates that there are no `Child` elements. It produces this output: + +```output +0 +``` + +If, however, you declare a default global namespace, then both the XML literal and the XML property are in the default global namespace: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + content + + Console.WriteLine(root..Count()) + End Sub +End Module +``` + +This example indicates that there is one `Child` element. It produces this output: + +```output +1 +``` + +If you declare a global namespace that has a prefix, you can use the prefix for both XML literals and XML properties: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + content + + Console.WriteLine(root..Count()) + End Sub +End Module +``` + +## Example: Use `GetXmlNamespace` to get an `XNamespace` + +You can obtain an object by using the `GetXmlNamespace` method: + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = + Dim xn As XNamespace = GetXmlNamespace(aw) + Console.WriteLine(xn) + End Sub +End Module +``` + +This example produces the following output: + +```output +http://www.adventure-works.com +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/write-linq-xml-axis-method.md b/docs/standard/linq/write-linq-xml-axis-method.md new file mode 100644 index 0000000000000..1d2b8d2cdb138 --- /dev/null +++ b/docs/standard/linq/write-linq-xml-axis-method.md @@ -0,0 +1,477 @@ +--- +title: How to write a LINQ to XML axis method - LINQ to XML +description: Learn how to write your own axis methods to retrieve collections from an XML tree in C# or Visual Basic. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 50aef06b-1d22-4718-a18a-21237e26d7c1 +--- +# How to write a LINQ to XML axis method (LINQ to XML) + +An XML [axis method](linq-xml-axes-overview.md) retrieves a collection of XML elements from an XML document or ancestor element. You can write your own axis methods to retrieve collections from an XML tree. One of the best ways to do this is to write an extension method that returns a collection of elements or attributes. You can write your extension method to return specific subsets of elements or attributes, based on the requirements of your application. This article provides an example for C# and Visual Basic. + +## Example + +The following example uses two extension methods. The first extension method, `GetXPath`, operates on , and returns an XPath expression that when evaluated will return the node or attribute. The second extension method, `Find`, operates on . It returns a collection of objects and objects that contain some specified text. + +This example uses XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). + +```csharp +public static class MyExtensions +{ + private static string GetQName(XElement xe) + { + string prefix = xe.GetPrefixOfNamespace(xe.Name.Namespace); + if (xe.Name.Namespace == XNamespace.None || prefix == null) + return xe.Name.LocalName.ToString(); + else + return prefix + ":" + xe.Name.LocalName.ToString(); + } + + private static string GetQName(XAttribute xa) + { + string prefix = + xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace); + if (xa.Name.Namespace == XNamespace.None || prefix == null) + return xa.Name.ToString(); + else + return prefix + ":" + xa.Name.LocalName; + } + + private static string NameWithPredicate(XElement el) + { + if (el.Parent != null && el.Parent.Elements(el.Name).Count() != 1) + return GetQName(el) + "[" + + (el.ElementsBeforeSelf(el.Name).Count() + 1) + "]"; + else + return GetQName(el); + } + + public static string StrCat(this IEnumerable source, + string separator) + { + return source.Aggregate(new StringBuilder(), + (sb, i) => sb + .Append(i.ToString()) + .Append(separator), + s => s.ToString()); + } + + public static string GetXPath(this XObject xobj) + { + if (xobj.Parent == null) + { + XDocument doc = xobj as XDocument; + if (doc != null) + return "."; + XElement el = xobj as XElement; + if (el != null) + return "/" + NameWithPredicate(el); + // The XPath data model doesn't include white space text nodes + // that are children of a document, so this method returns null. + XText xt = xobj as XText; + if (xt != null) + return null; + XComment com = xobj as XComment; + if (com != null) + return + "/" + + ( + com + .Document + .Nodes() + .OfType() + .Count() != 1 ? + "comment()[" + + (com + .NodesBeforeSelf() + .OfType() + .Count() + 1) + + "]" : + "comment()" + ); + XProcessingInstruction pi = xobj as XProcessingInstruction; + if (pi != null) + return + "/" + + ( + pi.Document.Nodes() + .OfType() + .Count() != 1 ? + "processing-instruction()[" + + (pi + .NodesBeforeSelf() + .OfType() + .Count() + 1) + + "]" : + "processing-instruction()" + ); + return null; + } + else + { + XElement el = xobj as XElement; + if (el != null) + { + return + "/" + + el + .Ancestors() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + NameWithPredicate(el); + } + XAttribute at = xobj as XAttribute; + if (at != null) + return + "/" + + at + .Parent + .AncestorsAndSelf() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + "@" + GetQName(at); + XComment com = xobj as XComment; + if (com != null) + return + "/" + + com + .Parent + .AncestorsAndSelf() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + ( + com + .Parent + .Nodes() + .OfType() + .Count() != 1 ? + "comment()[" + + (com + .NodesBeforeSelf() + .OfType() + .Count() + 1) + "]" : + "comment()" + ); + XCData cd = xobj as XCData; + if (cd != null) + return + "/" + + cd + .Parent + .AncestorsAndSelf() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + ( + cd + .Parent + .Nodes() + .OfType() + .Count() != 1 ? + "text()[" + + (cd + .NodesBeforeSelf() + .OfType() + .Count() + 1) + "]" : + "text()" + ); + XText tx = xobj as XText; + if (tx != null) + return + "/" + + tx + .Parent + .AncestorsAndSelf() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + ( + tx + .Parent + .Nodes() + .OfType() + .Count() != 1 ? + "text()[" + + (tx + .NodesBeforeSelf() + .OfType() + .Count() + 1) + "]" : + "text()" + ); + XProcessingInstruction pi = xobj as XProcessingInstruction; + if (pi != null) + return + "/" + + pi + .Parent + .AncestorsAndSelf() + .InDocumentOrder() + .Select(e => NameWithPredicate(e)) + .StrCat("/") + + ( + pi + .Parent + .Nodes() + .OfType() + .Count() != 1 ? + "processing-instruction()[" + + (pi + .NodesBeforeSelf() + .OfType() + .Count() + 1) + "]" : + "processing-instruction()" + ); + return null; + } + } + + public static IEnumerable Find(this XElement source, string value) + { + if (source.Attributes().Any()) + { + foreach (XAttribute att in source.Attributes()) + { + string contents = (string)att; + if (contents.Contains(value)) + yield return att; + } + } + if (source.Elements().Any()) + { + foreach (XElement child in source.Elements()) + foreach (XObject s in child.Find(value)) + yield return s; + } + else + { + string contents = (string)source; + if (contents.Contains(value)) + yield return source; + } + } +} + +class Program +{ + static void Main(string[] args) + { + XElement purchaseOrders = XElement.Load("PurchaseOrders.xml"); + + IEnumerable subset = + from xobj in purchaseOrders.Find("1999") + select xobj; + + foreach (XObject obj in subset) + { + Console.WriteLine(obj.GetXPath()); + if (obj.GetType() == typeof(XElement)) + Console.WriteLine(((XElement)obj).Value); + else if (obj.GetType() == typeof(XAttribute)) + Console.WriteLine(((XAttribute)obj).Value); + } + } +} +``` + +```vb +Imports System.Runtime.CompilerServices +Imports System.Text + +Module Module1 + Sub Main() + Dim purchaseOrders = XElement.Load("..\..\PurchaseOrders.xml") + + Dim subset = From xobj In purchaseOrders.Find("1999") + + For Each obj In subset + Console.WriteLine(obj.GetXPath()) + If obj.GetType() = GetType(XElement) Then + Console.WriteLine(CType(obj, XElement).Value) + ElseIf obj.GetType() = GetType(XAttribute) Then + Console.WriteLine(CType(obj, XAttribute).Value) + End If + Next + End Sub +End Module + +Public Module MyExtensions + + Private Function GetQName(ByVal xe As XElement) As String + Dim prefix = xe.GetPrefixOfNamespace(xe.Name.Namespace) + If xe.Name.Namespace = XNamespace.None OrElse prefix Is Nothing Then + Return xe.Name.LocalName + Else + Return prefix & ":" & xe.Name.LocalName + End If + End Function + + Private Function GetQName(ByVal xa As XAttribute) As String + Dim prefix = xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace) + If xa.Name.Namespace = XNamespace.None OrElse prefix Is Nothing Then + Return xa.Name.LocalName + Else + Return prefix & ":" & xa.Name.LocalName + End If + End Function + + Private Function NameWithPredicate(ByVal el As XElement) As String + If el.Parent IsNot Nothing AndAlso + el.Parent.Elements(el.Name).Count() <> 1 Then + Return GetQName(el) & "[" & + (el.ElementsBeforeSelf(el.Name).Count() + 1) & "]" + Else + Return GetQName(el) + End If + End Function + + + Public Function StrCat(Of T)(ByVal source As IEnumerable(Of T), + ByVal separator As String) As String + Return source.Aggregate(New StringBuilder, + Function(sb, i) sb. + Append(i.ToString()). + Append(separator), + Function(s) s.ToString()) + End Function + + + Public Function GetXPath(ByVal xobj As XObject) As String + + If xobj.Parent Is Nothing Then + Dim doc = TryCast(xobj, XDocument) + If doc IsNot Nothing Then Return "." + + Dim el = TryCast(xobj, XElement) + If el IsNot Nothing Then Return "/" + NameWithPredicate(el) + + ' The XPath data model doesn't include white space text nodes + ' that are children of a document, so this method returns null. + + Dim xt = TryCast(xobj, XText) + If xt IsNot Nothing Then Return Nothing + + Dim com = TryCast(xobj, XComment) + If com IsNot Nothing Then + Return "/" & + If(com.Document.Nodes().OfType(Of XComment)().Count() <> 1, + "comment()[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]", + "comment()") + End If + + Dim pi = TryCast(xobj, XProcessingInstruction) + If pi IsNot Nothing Then + Return "/" & + If(pi.Document.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1, + "processing-instruction()[" & + (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)().Count() + 1) & "]", + "processing-instruction()") + End If + Return Nothing + Else + Dim el = TryCast(xobj, XElement) + If el IsNot Nothing Then + Return "/" & + el.Ancestors(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & NameWithPredicate(el) + End If + Dim at = TryCast(xobj, XAttribute) + If at IsNot Nothing Then + Return "/" & + at.Parent. + AncestorsAndSelf(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & "@" & GetQName(at) + End If + Dim com = TryCast(xobj, XComment) + If com IsNot Nothing Then + Return "/" & + com.Parent. + AncestorsAndSelf(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & + If(com.Parent.Nodes().OfType(Of XComment)().Count() <> 1, + "comment()[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]", + "comment()") + End If + + Dim cd = TryCast(xobj, XCData) + If cd IsNot Nothing Then + Return "/" & + cd.Parent. + AncestorsAndSelf(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & + If(cd.Parent.Nodes().OfType(Of XText)().Count() <> 1, + "text()[" & (cd.NodesBeforeSelf().OfType(Of XText)().Count() + 1) & "]", + "text()") + End If + Dim tx = TryCast(xobj, XText) + If tx IsNot Nothing Then + Return "/" & + tx.Parent. + AncestorsAndSelf(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & + If(tx.Parent.Nodes().OfType(Of XText)().Count() <> 1, + "text()[" & (tx.NodesBeforeSelf().OfType(Of XText)().Count() + 1) & "]", + "text()") + End If + Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) + If pi IsNot Nothing Then + Return "/" & + pi.Parent. + AncestorsAndSelf(). + InDocumentOrder(). + Select(Function(e) NameWithPredicate(e)).StrCat("/") & + If(pi.Parent.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1, + "processing-instruction()[" & + (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)().Count() + 1) & "]", + "processing-instruction()") + End If + Return Nothing + End If + End Function + + + Public Function Find(ByVal source As XElement, ByVal value As String) As IEnumerable(Of XObject) + Dim results = From att In source.Attributes() + Where att.Value.Contains(value) + Let a As XObject = att + Select a + + If source.Elements().Any Then + For Each result In From child In source.Elements() Select Find(child, value) + results = If(results Is Nothing, result, results.Union(result)) + Next + Else + If source.Value.Contains(value) Then + results = If(results Is Nothing, + New List(Of XObject) From {source}, + results.Union(New List(Of XObject) From {source})) + End If + End If + + Return results + End Function + +End Module +``` + +This example produces the following output: + +```output +/PurchaseOrders/PurchaseOrder[1]/@OrderDate +1999-10-20 +/PurchaseOrders/PurchaseOrder[1]/Items/Item[2]/ShipDate +1999-05-21 +/PurchaseOrders/PurchaseOrder[2]/@OrderDate +1999-10-22 +/PurchaseOrders/PurchaseOrder[3]/@OrderDate +1999-10-22 +``` diff --git a/docs/standard/linq/write-queries-complex-filtering.md b/docs/standard/linq/write-queries-complex-filtering.md new file mode 100644 index 0000000000000..de31a989fd2bf --- /dev/null +++ b/docs/standard/linq/write-queries-complex-filtering.md @@ -0,0 +1,127 @@ +--- +title: How to write queries with complex filtering - LINQ to XML +description: Sometimes you want to write LINQ to XML queries with complex filters. For example, you might have to find all elements that have a child element with a particular name and value. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 4065d901-cf89-4e47-8bf9-abb65acfb003 +--- + +# How to write queries with complex filtering (LINQ to XML) + +Sometimes you want to write LINQ to XML queries with complex filters. For example, you might have to find all elements that have a child element with a particular name and value. This article gives an example of writing a query with complex filtering. + +## Example: Find with a nested query in the `Where` clause + +This example shows how to find all `PurchaseOrder` elements that have: + +- A child `Address` element whose `Type` attribute equals "Shipping". +- A child `State` element that equals "NY". + +It uses a nested query in the `Where` clause, and the `Any` operator returns `true` if the collection has any elements in it. The example uses XML document [Sample XML file: Multiple purchase orders](sample-xml-file-multiple-purchase-orders.md). + +For more information about the `Any` operator, see [Quantifier Operations (C#)](../../../docs/csharp/programming-guide/concepts/linq/quantifier-operations.md) and [Quantifier Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/quantifier-operations.md). + +```csharp +XElement root = XElement.Load("PurchaseOrders.xml"); +IEnumerable purchaseOrders = + from el in root.Elements("PurchaseOrder") + where + (from add in el.Elements("Address") + where + (string)add.Attribute("Type") == "Shipping" && + (string)add.Element("State") == "NY" + select add) + .Any() + select el; +foreach (XElement el in purchaseOrders) + Console.WriteLine((string)el.Attribute("PurchaseOrderNumber")); +``` + +```vb +Dim root As XElement = XElement.Load("PurchaseOrders.xml") +Dim purchaseOrders As IEnumerable(Of XElement) = _ + From el In root. _ + Where _ + (From add In el.
_ + Where _ + add.@Type = "Shipping" And _ + add..Value = "NY" _ + Select add) _ + .Any() _ + Select el +For Each el As XElement In purchaseOrders + Console.WriteLine(el.@PurchaseOrderNumber) +Next +``` + +This example produces the following output: + +```output +99505 +``` + +## Example: Find in XML that's in a namespace + +The following example shows the same query as above, but for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +This example uses XML document [Sample XML file: Multiple purchase orders in a namespace](sample-xml-file-multiple-purchase-orders-namespace.md). + +```csharp +XElement root = XElement.Load("PurchaseOrdersInNamespace.xml"); +XNamespace aw = "http://www.adventure-works.com"; +IEnumerable purchaseOrders = + from el in root.Elements(aw + "PurchaseOrder") + where + (from add in el.Elements(aw + "Address") + where + (string)add.Attribute(aw + "Type") == "Shipping" && + (string)add.Element(aw + "State") == "NY" + select add) + .Any() + select el; +foreach (XElement el in purchaseOrders) + Console.WriteLine((string)el.Attribute(aw + "PurchaseOrderNumber")); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = XElement.Load("PurchaseOrdersInNamespace.xml") + Dim purchaseOrders As IEnumerable(Of XElement) = _ + From el In root. _ + Where _ + (From add In el. _ + Where _ + add.@aw:Type = "Shipping" And _ + add..Value = "NY" _ + Select add) _ + .Any() _ + Select el + For Each el As XElement In purchaseOrders + Console.WriteLine(el.@aw:PurchaseOrderNumber) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +99505 +``` + +## See also + +- +- +- [Projection Operations (C#)](../../csharp/programming-guide/concepts/linq/projection-operations.md) +- [Quantifier Operations (C#)](../../csharp/programming-guide/concepts/linq/quantifier-operations.md) +- [XML Child Axis Property (Visual Basic)](../../visual-basic/language-reference/xml-axis/xml-child-axis-property.md) +- [XML Attribute Axis Property (Visual Basic)](../../visual-basic/language-reference/xml-axis/xml-attribute-axis-property.md) +- [XML Value Property (Visual Basic)](../../visual-basic/language-reference/xml-axis/xml-value-property.md) +- [Projection Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/projection-operations.md) +- [Quantifier Operations (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/quantifier-operations.md) diff --git a/docs/standard/linq/write-queries-xml-namespaces.md b/docs/standard/linq/write-queries-xml-namespaces.md new file mode 100644 index 0000000000000..842dd15e0f3a5 --- /dev/null +++ b/docs/standard/linq/write-queries-xml-namespaces.md @@ -0,0 +1,133 @@ +--- +title: How to write queries on XML in namespaces - LINQ to XML +description: To write a query on XML that's in a namespace, you use XName objects that have the correct namespace. Learn how to do this in C# and Visual Basic, and how to create queries. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 7c54df81-15e4-4091-8c81-a87637029130 +--- + +# How to write queries on XML in namespaces (LINQ to XML) + +To write a query on XML that's in a namespace, you must use objects that have the correct namespace. + +For C#, the most common approach is to initialize an using a string that contains the URI, then use the addition operator overload to combine the namespace with the local name. + +For Visual Basic, the most common approach is to define a global namespace, and then use XML literals and XML properties that use the global namespace. You can define a global default namespace, in which case elements in the XML literals will be in the namespace by default. Alternatively, you can define a global namespace with a prefix, and then use the prefix as required in the XML literals and in XML properties. As with other forms of XML, attributes are always in no namespace by default. + +The first example in this article shows how to create an XML tree in a default namespace. The second shows how to create an XML tree in a namespace with a prefix. + +## Example: Create a tree in a default namespace and retrieve elements + +The following example creates an XML tree that's in a default namespace, and then retrieves a collection of elements. + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +IEnumerable c1 = + from el in root.Elements(aw + "Child") + select el; +foreach (XElement el in c1) + Console.WriteLine((int)el); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el + For Each el As XElement In c1 + Console.WriteLine(el.Value) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +1 +2 +3 +``` + +## Example: Create a tree in a namespace with a prefix and retrieve elements + +In C#, you write queries in the same way regardless of whether you're writing queries on an XML tree that uses a namespace with a prefix or on an XML tree with a default namespace. + +The following example creates an XML tree that's in a namespace with a prefix, and then retrieves a collection of elements. + +```csharp +XNamespace aw = "http://www.adventure-works.com"; +XElement root = XElement.Parse( +@" + 1 + 2 + 3 + 4 + 5 + 6 +"); +IEnumerable c1 = + from el in root.Elements(aw + "Child") + select el; +foreach (XElement el in c1) + Console.WriteLine((int)el); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim root As XElement = _ + + 1 + 2 + 3 + 4 + 5 + 6 + + Dim c1 As IEnumerable(Of XElement) = _ + From el In root. _ + Select el + For Each el As XElement In c1 + Console.WriteLine(CInt(el)) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +1 +2 +3 +``` + +## See also + +- [Namespaces overview](namespaces-overview.md) diff --git a/docs/standard/linq/write-query-finds-elements-based-context.md b/docs/standard/linq/write-query-finds-elements-based-context.md new file mode 100644 index 0000000000000..d4d4c4bd5bd9c --- /dev/null +++ b/docs/standard/linq/write-query-finds-elements-based-context.md @@ -0,0 +1,179 @@ +--- +title: How to write a query that finds elements based on context - LINQ to XML +description: Write a query that selects elements based on context; for example, filter results based on preceding or following sibling elements. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3ff79ef0-fc8b-42fe-8cc0-10dc32b06b4e +--- + +# How to write a query that finds elements based on context (LINQ to XML) + +Sometimes you might have to write a query that selects elements based on their context. For example, you might want to filter based on preceding or following sibling elements, or on child or ancestor elements. + +You can do this by writing a query and using the results of the query in the `where` clause. If you have to first test against null, and then test the value, it's more convenient to do the query in a `let` clause, and then use the results in the `where` clause. + +## Example: Select `p` elements that are immediately followed by a `ul` element + +The following example selects all `p` elements that are immediately followed by a `ul` element. + +```csharp +XElement doc = XElement.Parse(@" +

+

    abc
+ +

+ +

+

    def
+

+ + +

+ +

+

    abc
+

+ +"); + +IEnumerable items = + from e in doc.Descendants("p") + let z = e.ElementsAfterSelf().FirstOrDefault() + where z != null && z.Name.LocalName == "ul" + select e; + +foreach (XElement e in items) + Console.WriteLine("id = {0}", (string)e.Attribute("id")); +``` + +```vb +Dim doc As XElement = _ + +

+

    abc
+ +

+ +

+

    def
+

+ + +

+ +

+

    abc
+

+ + + +Dim items As IEnumerable(Of XElement) = _ + From e In doc...

_ + Let z = e.ElementsAfterSelf().FirstOrDefault() _ + Where z IsNot Nothing AndAlso z.Name.LocalName = "ul" _ + Select e + +For Each e As XElement In items + Console.WriteLine("id = {0}", e.@) +Next +``` + +This example produces the following output: + +```output +id = 1 +id = 3 +id = 6 +``` + +## Example: In a namespace select `p` elements that are immediately followed by a `ul` element + +The following example shows the same query as above, but for XML that's in a namespace. For more information, see [Namespaces overview](namespaces-overview.md). + +```csharp +XElement doc = XElement.Parse(@" +

+

    abc
+ +

+ +

+

    def
+

+ + +

+ +

+

    abc
+

+ +"); + +XNamespace ad = "http://www.adatum.com"; + +IEnumerable items = + from e in doc.Descendants(ad + "p") + let z = e.ElementsAfterSelf().FirstOrDefault() + where z != null && z.Name == ad.GetName("ul") + select e; + +foreach (XElement e in items) + Console.WriteLine("id = {0}", (string)e.Attribute("id")); +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim doc As XElement = _ + +

+

    abc
+ +

+ +

+

    def
+

+ + +

+ +

+

    abc
+

+ + + + Dim items As IEnumerable(Of XElement) = _ + From e In doc...

_ + Let z = e.ElementsAfterSelf().FirstOrDefault() _ + Where z IsNot Nothing AndAlso z.Name = GetXmlNamespace().GetName("ul") _ + Select e + + For Each e As XElement In items + Console.WriteLine("id = {0}", e.@) + Next + End Sub +End Module +``` + +This example produces the following output: + +```output +id = 1 +id = 3 +id = 6 +``` + +## See also + +- +- +- +- +- [Basic Queries (LINQ to XML) (Visual Basic)](../../visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md) diff --git a/docs/standard/linq/xattribute-class-overview.md b/docs/standard/linq/xattribute-class-overview.md new file mode 100644 index 0000000000000..625bbc363277c --- /dev/null +++ b/docs/standard/linq/xattribute-class-overview.md @@ -0,0 +1,106 @@ +--- +title: XAttribute class overview +description: The XAttribute class represents XML attributes. Working with attributes in LINQ to XML is similar to working with elements. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 5a630f24-f9ad-400e-831e-c14ebfc9e142 +--- + +# XAttribute class overview + +Attributes are name-value pairs that are associated with an element. The class represents XML attributes. + +Working with attributes in LINQ to XML is similar to working with elements. Their constructors are similar. The methods that you use to retrieve collections of them are similar. A LINQ query expression for a collection of attributes looks similar to a LINQ query expression for a collection of elements. + +The order in which attributes were added to an element is preserved. That is, when you iterate through the attributes, you see them in the same order that they were added. + +## The XAttribute constructor + +The following constructor of the class is the one that you'll most commonly use: + +|Constructor|Description| +|-----------------|-----------------| +|`XAttribute(XName name, object content)`|Creates an object. The `name` argument specifies the name of the attribute; `content` specifies the content of the attribute.| + +## Example: Create an element with an attribute + +The following example shows the common task of creating an element that contains an attribute. + +```csharp +XElement phone = new XElement("Phone", + new XAttribute("Type", "Home"), + "555-555-5555"); +Console.WriteLine(phone); +``` + +```vb +Dim phone As XElement = 555-555-5555 +Console.WriteLine(phone) +``` + +This example produces the following output: + +```xml +555-555-5555 +``` + +## Example: Functional construction of attributes + +You can construct objects in-line with the construction of objects, as shown in the following example: + +```csharp +XElement c = new XElement("Customers", + new XElement("Customer", + new XElement("Name", "John Doe"), + new XElement("PhoneNumbers", + new XElement("Phone", + new XAttribute("type", "home"), + "555-555-5555"), + new XElement("Phone", + new XAttribute("type", "work"), + "666-666-6666") + ) + ) +); +Console.WriteLine(c); +``` + +```vb +Dim c As XElement = _ + + + John Doe + + 555-555-5555 + 666-666-6666 + + + +Console.WriteLine(c) +``` + +This example produces the following output: + +```xml + + + John Doe + + 555-555-5555 + 666-666-6666 + + + +``` + +## Attributes aren't nodes + +There are some differences between attributes and elements. objects aren't nodes in the XML tree. They're name-value pairs associated with an XML element. In contrast to the Document Object Model (DOM), this more closely reflects the structure of XML. Although objects aren't actually nodes in the XML tree, working with objects is similar to working with objects. + +This distinction is primarily important only to developers who are writing code that works with XML trees at the node level. Many developers won't be concerned with this distinction. + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/xdocument-class-overview.md b/docs/standard/linq/xdocument-class-overview.md new file mode 100644 index 0000000000000..ff29b0adc6b61 --- /dev/null +++ b/docs/standard/linq/xdocument-class-overview.md @@ -0,0 +1,110 @@ +--- +title: XDocument class overview +description: The LINQ to XML XDocument class contains the information necessary for a valid XML document. In many cases, you don't need the functionality of an XDocument object and can use an XElement object instead. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 63305603-ab54-49fc-84e4-f76eecc59549 +--- + +# XDocument class overview + +The class contains the information necessary for a valid XML document, which includes an XML declaration, processing instructions, and comments. + +You only have to create objects if you require the specific functionality provided by the class. In many circumstances, you can work directly with . Working directly with is a simpler programming model. + + derives from , so it can contain child nodes. However, objects can have only one child node. This reflects the XML standard that there can be only one root element in an XML document. + +## Components of XDocument + +An can contain the following elements: + +- One object. enables you to specify the pertinent parts of an XML declaration: the XML version, the encoding of the document, and whether the XML document is standalone. +- One object. This object is the root node of the XML document. +- Any number of objects. A processing instruction communicates information to an application that processes the XML. +- Any number of objects. The comments will be siblings to the root element. The object can't be the first argument in the list, because it's not valid for an XML document to start with a comment. +- One for the DTD. + +When you serialize an , even if `XDocument.Declaration` is `null`, the output will have an XML declaration if the writer has `Writer.Settings.OmitXmlDeclaration` set to `false` (the default). + +By default, LINQ to XML sets the version to "1.0", and sets the encoding to "utf-8". + +## Use XElement without XDocument + +As previously mentioned, the class is the main class in the LINQ to XML programming interface. In many cases, your application won't require that you create a document. By using the class, you can: + +- Create an XML tree. +- Add other XML trees to it. +- Modify the XML tree. +- Save it. + +## Use XDocument + +To construct an , use functional construction, just like you do to construct objects. + +The following example creates an object and its associated contained objects. + +```csharp +XDocument d = new XDocument( + new XComment("This is a comment."), + new XProcessingInstruction("xml-stylesheet", + "href='mystyle.css' title='Compact' type='text/css'"), + new XElement("Pubs", + new XElement("Book", + new XElement("Title", "Artifacts of Roman Civilization"), + new XElement("Author", "Moreno, Jordao") + ), + new XElement("Book", + new XElement("Title", "Midieval Tools and Implements"), + new XElement("Author", "Gazit, Inbar") + ) + ), + new XComment("This is another comment.") +); +d.Declaration = new XDeclaration("1.0", "utf-8", "true"); +Console.WriteLine(d); + +d.Save("test.xml"); +``` + +```vb +Dim doc As XDocument = + + + + + Artifacts of Roman Civilization + Moreno, Jordao + + + Midieval Tools and Implements + Gazit, Inbar + + + +doc.Save("test.xml") +``` + +The example produces this output in test.xml: + +```xml + + + + + + Artifacts of Roman Civilization + Moreno, Jordao + + + Midieval Tools and Implements + Gazit, Inbar + + + +``` + +## See also + +- [LINQ to XML overview](linq-xml-overview.md) diff --git a/docs/standard/linq/xelement-class-overview.md b/docs/standard/linq/xelement-class-overview.md new file mode 100644 index 0000000000000..4ea10cb1414b0 --- /dev/null +++ b/docs/standard/linq/xelement-class-overview.md @@ -0,0 +1,146 @@ +--- +title: XElement class overview +description: The XElement class represents XML elements. You can use it to create and change elements, add attributes and children, and to serialize. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 2b9f0cd8-a1d1-4037-accf-0f38a410fa11 +--- + +# XElement class overview + +The class is one of the fundamental classes in LINQ to XML. It represents an XML element. The following list shows what you can use this class for: + +- Create elements. +- Change the content of the element. +- Add, change, or delete child elements. +- Add attributes to an element. +- Serialize the contents of an element in text form. + +You can also interoperate with other classes in , such as , , and . + +This article describes the functionality provided by the class. + +## Construct XML trees + +You can construct XML trees in different ways, including the following: + +- You can construct an XML tree in code. For more information, see [XML trees](functional-construction.md). +- You can parse XML from various sources, including a , text files, or a Web address (URL). For more information, see [Parse XML](parse-string.md). +- You can use an to populate the tree. For more information, see . +- If you have a module that can write content to an , you can use the method to create a writer, pass the writer to the module, and then use the content that's written to the to populate the XML tree. + +The following example creates a tree. The C# version uses nested element creations. You can use the same technique in Visual Basic, but this example uses XML literals. + +```csharp +XElement contacts = + new XElement("Contacts", + new XElement("Contact", + new XElement("Name", "Patrick Hines"), + new XElement("Phone", "206-555-0144"), + new XElement("Address", + new XElement("Street1", "123 Main St"), + new XElement("City", "Mercer Island"), + new XElement("State", "WA"), + new XElement("Postal", "68042") + ) + ) + ); +``` + +```vb +Dim contacts As XElement = _ + + + Patrick Hines + 206-555-0144 +

+ 123 Main St + Mercer Island + WA + 68042 +
+ + +``` + +You can also use a LINQ to XML query to populate an XML tree, as shown in the following example: + +```csharp +XElement srcTree = new XElement("Root", + new XElement("Element", 1), + new XElement("Element", 2), + new XElement("Element", 3), + new XElement("Element", 4), + new XElement("Element", 5) +); +XElement xmlTree = new XElement("Root", + new XElement("Child", 1), + new XElement("Child", 2), + from el in srcTree.Elements() + where (int)el > 2 + select el +); +Console.WriteLine(xmlTree); +``` + +```vb +Dim srcTree As XElement = _ + + 1 + 2 + 3 + 4 + 5 + +Dim xmlTree As XElement = _ + + 1 + 2 + <%= From el In srcTree.Elements() _ + Where el.Value > 2 _ + Select el %> + +Console.WriteLine(xmlTree) +``` + +This example produces the following output: + +```xml + + 1 + 2 + 3 + 4 + 5 + +``` + +## Serialize XML trees + +You can serialize the XML tree to a , a , or an . + +For more information, see [Serialize XML trees](preserve-white-space-serializing.md). + +## Retrieve XML data via axis methods + +You can use axis methods to retrieve attributes, child elements, descendant elements, and ancestor elements. LINQ to XML queries operate on axis methods, and provide several flexible and powerful ways to navigate through and process an XML tree. + +For more information, see [LINQ to XML axes overview](linq-xml-axes-overview.md). + +## Query XML trees + +You can write LINQ to XML queries that extract data from an XML tree. + +For more information, see [Query XML trees overview](query-xml-trees-overview.md). + +## Modify XML trees + +You can modify an element in different ways, including changing its content or attributes. You can also remove an element from its parent. + +For more information, see [Modify XML trees](in-memory-xml-tree-modification-vs-functional-construction.md). + +## See also + +- [LINQ to XML programming overview](functional-vs-procedural-programming.md) diff --git a/docs/standard/linq/xml-literals.md b/docs/standard/linq/xml-literals.md new file mode 100644 index 0000000000000..2acee947c63c2 --- /dev/null +++ b/docs/standard/linq/xml-literals.md @@ -0,0 +1,205 @@ +--- +title: XML Literals in Visual Basic - LINQ to XML +description: You can create an XML tree in Visual Basic using XML literals and embedded expressions. Embedded expressions enable you to evaluate an expression and insert the results of the expression into the XML tree. +ms.date: 07/20/2015 +ms.assetid: 94fc0e03-978e-4c08-ab6c-0dc3c1e64f10 +--- + +# XML Literals in Visual Basic (LINQ to XML) + +This article provides information about creating XML trees in Visual Basic using XML literals and embedded expressions. + +## Example: Use XML literals to create an XML tree + +The following example shows how to create an , in this case `contacts`, with XML literals: + +```vb +Dim contacts As XElement = _ + + + Patrick Hines + 206-555-0144 +
+ 123 Main St + Mercer Island + WA + 68042 +
+
+
+``` + +## Example: Use XML literals to create an XElement with simple content + +You can create an that contains simple content, as follows: + +```vb +Dim n as XElement = Adventure Works +Console.WriteLine(n) +``` + +This example produces the following output: + +```xml +Adventure Works +``` + +## Example: Use an XML literal to create an empty element + +You can create an empty , as follows: + +```vb +Dim n As XElement = +Console.WriteLine(n) +``` + +This example produces the following output: + +```xml + +``` + +## Use embedded expressions to create content + +An important feature of XML literals is that they allow embedded expressions. Embedded expressions enable you to evaluate an expression and insert the results of the expression into the XML tree. If the expression evaluates to a type of , an element is inserted into the tree. If the expression evaluates to a type of , an attribute is inserted into the tree. You can insert elements and attributes into the tree only where they're valid. + +it's important to note that only a single expression can go into an embedded expression. You can't embed multiple statements. If an expression extends beyond a single line, you must use the line continuation character. + +If you use an embedded expression to add existing nodes (including elements) and attributes to a new XML tree and if the existing nodes are already parented, the nodes are cloned. The newly cloned nodes are attached to the new XML tree. If the existing nodes aren't parented, the nodes are simply attached to the new XML tree. The last example in this article demonstrates this. + +## Example: Use an embedded expression to insert an element + +The following example uses an embedded expression to insert an element into the tree: + +```vb +xmlTree1 As XElement = _ + + Contents + +Dim xmlTree2 As XElement = _ + + <%= xmlTree1. %> + +Console.WriteLine(xmlTree2) +``` + +This example produces the following output: + +```xml + + Contents + +``` + +## Example: Use an embedded expression for content + +You can use an embedded expression to supply the content of an element: + +```vb +Dim str As String +str = "Some content" +Dim root As XElement = <%= str %> +Console.WriteLine(root) +``` + +This example produces the following output: + +```xml +Some content +``` + +## Example: Use a LINQ query in an embedded expression + +You can use the results of a LINQ query to provide the content of an element: + +```vb +Dim arr As Integer() = {1, 2, 3} + +Dim n As XElement = _ + + <%= From i In arr Select <%= i %> %> + + +Console.WriteLine(n) +``` + +This example produces the following output: + +```xml + + 1 + 2 + 3 + +``` + +## Example: Use an embedded expression to provide node names + +You can also use an embedded expression to calculate attribute names, attribute values, element names, and element values: + +```vb +Dim eleName As String = "ele" +Dim attName As String = "att" +Dim attValue As String = "aValue" +Dim eleValue As String = "eValue" +Dim n As XElement = _ + =<%= attValue %>> + <<%= eleName %>> + <%= eleValue %> + + +Console.WriteLine(n) +``` + +This example produces the following output: + +```xml + + eValue + +``` + +## Example: Use an embedded expression to clone and attach nodes + +As mentioned earlier, if you use an embedded expression to add existing nodes (including elements) and attributes to a new XML tree, and if the nodes being added nodes are already parented, the nodes are cloned and the clones are attached to the new XML tree. If the existing nodes aren't parented, they're simply attached to the new XML tree. + +The following code demonstrates the behavior when you add a parented element to a tree, and when you add an element with no parent to a tree. + +```vb +' Create a tree with a child element. +Dim xmlTree1 As XElement = _ + + 1 + + +' Create an element that's not parented. +Dim child2 As XElement = 2 + +' Create a tree and add Child1 and Child2 to it. +Dim xmlTree2 As XElement = _ + + <%= xmlTree1.(0) %> + <%= child2 %> + + +' Compare Child1 identity. +Console.WriteLine("Child1 was {0}", _ + IIf(xmlTree1.Element("Child1") Is xmlTree2.Element("Child1"), _ + "attached", "cloned")) + +' Compare Child2 identity. +Console.WriteLine("Child2 was {0}", _ + IIf(child2 Is xmlTree2.Element("Child2"), _ + "attached", "cloned")) +``` + +This example produces the following output: + +```output +Child1 was cloned +Child2 was attached +``` + +## See also + +- [Functional construction](functional-construction.md) diff --git a/docs/standard/linq/xml-shape-wordprocessingml-documents.md b/docs/standard/linq/xml-shape-wordprocessingml-documents.md new file mode 100644 index 0000000000000..3bae14cde96e2 --- /dev/null +++ b/docs/standard/linq/xml-shape-wordprocessingml-documents.md @@ -0,0 +1,127 @@ +--- +title: The XML shape of WordprocessingML documents - LINQ to XML +description: Learn about the XML shape of a WordprocessingML document. +ms.date: 07/20/2015 +dev_langs: + - "csharp" + - "vb" +ms.assetid: 3791b5e0-c502-469b-bb75-a7bf6fdd0a94 +--- + +# The XML shape of WordprocessingML documents (LINQ to XML) + +This article introduces the XML shape of a WordprocessingML document. + +## Microsoft Office formats + +The native file format for the 2007 Microsoft Office system is Office Open XML (commonly called Open XML). Open XML is an XML-based format that's an Ecma standard and is currently going through the ISO-IEC standards process. The markup language for word processing files within Open XML is called WordprocessingML. This tutorial uses WordprocessingML source files as input for the examples. + +If you're using Microsoft Office 2003, you can save documents in the Office Open XML format if you've installed the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. + +## The shape of WordprocessingML documents + +The first thing to understand is the XML shape of WordprocessingML documents. A WordprocessingML document contains a body element (named `w:body`) that contains the paragraphs of the document. Each paragraph contains one or more text runs (named `w:r`). Each text run contains one or more text pieces (named `w:t`). + +The following is a very simple WordprocessingML document: + +```xml + + + + + + This is a paragraph. + + + + + This is another paragraph. + + + + +``` + +This document contains two paragraphs. They both contain a single text run, and each text run contains a single text piece. + +The easiest way to see the contents of a WordprocessingML document in XML form is to create one using Microsoft Word, save it, and then run the following program that prints the XML to the console. + +This example uses classes found in the WindowsBase assembly. It uses types in the namespace. + +```csharp +const string documentRelationshipType = + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; +const string wordmlNamespace = + "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; +XNamespace w = wordmlNamespace; + +using (Package wdPackage = Package.Open("SampleDoc.docx", FileMode.Open, FileAccess.Read)) +{ + PackageRelationship relationship = + wdPackage + .GetRelationshipsByType(documentRelationshipType) + .FirstOrDefault(); + if (relationship != null) + { + Uri documentUri = + PackUriHelper.ResolvePartUri( + new Uri("/", UriKind.Relative), + relationship.TargetUri); + PackagePart documentPart = wdPackage.GetPart(documentUri); + + // Get the officeDocument part from the package. + // Load the XML in the part into an XDocument instance. + XDocument xdoc = + XDocument.Load(XmlReader.Create(documentPart.GetStream())); + Console.WriteLine(xdoc.Root); + } +} +``` + +```vb +Imports + +Module Module1 + Sub Main() + Dim documentRelationshipType = _ + "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" + + Using wdPackage As Package = _ + Package.Open("SampleDoc.docx", _ + FileMode.Open, FileAccess.Read) + Dim docPackageRelationship As PackageRelationship = wdPackage _ + .GetRelationshipsByType(documentRelationshipType).FirstOrDefault() + If (docPackageRelationship IsNot Nothing) Then + Dim documentUri As Uri = PackUriHelper.ResolvePartUri( _ + New Uri("/", UriKind.Relative), _ + docPackageRelationship.TargetUri) + Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) + + ' Get the officeDocument part from the package. + ' Load the XML in the part into an XDocument instance. + Dim xDoc As XDocument = _ + XDocument.Load(XmlReader.Create(documentPart.GetStream())) + Console.WriteLine(xDoc.Root) + End If + End Using + End Sub +End Module +``` + +## See also + +- [Introducing the Office (2007) Open XML File Formats](https://docs.microsoft.com/previous-versions/office/developer/office-2007/aa338205(v=office.12)) +- [Overview of WordprocessingML](https://docs.microsoft.com/previous-versions/office/developer/office-2003/aa212812(v=office.11)) +- [Anatomy of a WordProcessingML File](http://officeopenxml.com/anatomyofOOXML.php) +- [Introduction to WordprocessingML](https://ericwhite.com/blog/introduction-to-wordprocessingml-series/) diff --git a/docs/standard/tour.md b/docs/standard/tour.md index 82076cd05833a..996ace2aabbc6 100644 --- a/docs/standard/tour.md +++ b/docs/standard/tour.md @@ -109,7 +109,7 @@ To learn more about async programming in .NET, start with the [Async overview](a LINQ is a powerful set of features for C# and Visual Basic that allow you to write simple, declarative code for operating on data. The data can be in many forms (such as in-memory objects, a SQL database, or an XML document), but the LINQ code you write typically doesn't differ by data source. -To learn more and see some samples, see the [LINQ (Language Integrated Query)](using-linq.md) topic. +To learn more and see some samples, see the [LINQ (Language Integrated Query) overview](./linq/index.md) article. ## Native interoperability diff --git a/docs/visual-basic/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md deleted file mode 100644 index 7b299d9df5a86..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/adding-elements-attributes-and-nodes-to-an-xml-tree.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "Adding Elements, Attributes, and Nodes to an XML Tree" -ms.date: 07/20/2015 -ms.assetid: e243e694-c987-43aa-8b22-1e33dace582c ---- -# Adding Elements, Attributes, and Nodes to an XML Tree (Visual Basic) -You can add content (elements, attributes, comments, processing instructions, text, and CDATA) to an existing XML tree. - -## Methods for Adding Content - The following methods add child content to an or an : - -|Method|Description| -|------------|-----------------| -||Adds content at the end of the child content of the .| -||Adds content at the beginning of the child content of the .| - - The following methods add content as sibling nodes of an . The most common node to which you add sibling content is , although you can add valid sibling content to other types of nodes such as or . - -|Method|Description| -|------------|-----------------| -||Adds content after the .| -||Adds content before the .| - -## Example - -### Description - The following example creates two XML trees, and then modifies one of the trees. - -### Code - -```vb -Dim srcTree As XElement = _ - - 1 - 2 - 3 - 4 - 5 - -Dim xmlTree As XElement = _ - - 1 - 2 - 3 - 4 - 5 - - -xmlTree.Add(new content) -xmlTree.Add( _ - From el In srcTree.Elements() _ - Where CInt(el) > 3 _ - Select el) - -' Even though Child9 does not exist in srcTree, the following statement -' will not throw an exception, and nothing will be added to xmlTree. -xmlTree.Add(srcTree.Element("Child9")) -Console.WriteLine(xmlTree) -``` - -### Comments - This code produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - new content - 4 - 5 - -``` - -## See also - -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/advanced-linq-to-xml-programming.md b/docs/visual-basic/programming-guide/concepts/linq/advanced-linq-to-xml-programming.md deleted file mode 100644 index 26ff0935047d4..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/advanced-linq-to-xml-programming.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -title: "Advanced LINQ to XML Programming" -ms.date: 07/20/2015 -ms.assetid: 36018532-a55c-4538-8a27-98f475ea3415 ---- -# Advanced LINQ to XML Programming (Visual Basic) -This section provides information that will only be applicable to advanced developers in certain [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] scenarios. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[LINQ to XML Annotations](linq-to-xml-annotations.md)|Describes how to add annotations to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] nodes and attributes.| -|[LINQ to XML Events (Visual Basic)](linq-to-xml-events.md)|Describes how to write event handlers for events that occur when you alter an XML tree.| -|[Programming with Nodes (Visual Basic)](programming-with-nodes.md)|Describes how to query and manipulate nodes at a finer level of granularity than elements and attributes.| -|[Mixed Declarative Code/Imperative Code Bugs (LINQ to XML) (Visual Basic)](mixed-declarative-code-imperative-code-bugs-linq-to-xml.md)|Describes the problems that appear when you mix declarative code (queries) with imperative code (code that modifies the XML tree).| -|[How to: Stream XML Fragments with Access to Header Information (Visual Basic)](how-to-stream-xml-fragments-with-access-to-header-information.md)|Describes how to stream XML fragments from an . You can use this technique to control the memory footprint of your application.| -|[How to: Perform Streaming Transform of Large XML Documents (Visual Basic)](how-to-perform-streaming-transform-of-large-xml-documents.md)|Describes how to stream XML from an , transform the XML fragment, and stream the output using .| -|[How to: Read and Write an Encoded Document (Visual Basic)](how-to-read-and-write-an-encoded-document.md)|Describes how to read and write XML documents that are encoded.| -|[Using XSLT to Transform an XML Tree (Visual Basic)](using-xslt-to-transform-an-xml-tree.md)|Describes how to transform an XML tree using XSLT.| -|[How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style (Visual Basic)](how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md)|Describes how annotations can be used to facilitate transforms of an XML tree.| -|[Serializing Object Graphs that Contain XElement Objects (Visual Basic)](serializing-object-graphs-that-contain-xelement-objects.md)|Describes how to serialize object graphs that contain and objects.| -|[WPF Data Binding with LINQ to XML](/visualstudio/designers/wpf-data-binding-with-linq-to-xml-overview)|Describes how to use LINQ to XML as the data source for data binding in Windows Presentation Foundation applications.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/advanced-query-techniques-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/advanced-query-techniques-linq-to-xml.md deleted file mode 100644 index d02e159b5054d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/advanced-query-techniques-linq-to-xml.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Advanced Query Techniques (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 79be877c-fadc-4dfb-9f03-426082b13656 ---- -# Advanced Query Techniques (LINQ to XML) (Visual Basic) -This section provides examples of more advanced [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query techniques. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[How to: Join Two Collections (LINQ to XML) (Visual Basic)](how-to-join-two-collections-linq-to-xml.md)|Shows how to use the `Join` clause to take advantage of relationships in XML data.| -|[How to: Create Hierarchy Using Grouping (Visual Basic)](how-to-create-hierarchy-using-grouping.md)|Shows how to group data, and then generate XML based on the grouping.| -|[How to: Query LINQ to XML Using XPath (Visual Basic)](how-to-query-linq-to-xml-using-xpath.md)|Shows how to retrieve collections based on XPath queries.| -|[How to: Write a LINQ to XML Axis Method (Visual Basic)](how-to-write-a-linq-to-xml-axis-method.md)|Shows how to write a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axis method.| -|[How to: List All Nodes in a Tree (Visual Basic)](how-to-list-all-nodes-in-a-tree.md)|Presents a utility method that lists all nodes in an XML tree. This is useful for debugging code that modifies an XML tree.| -|[How to: Retrieve Paragraphs from an Office Open XML Document (Visual Basic)](how-to-retrieve-paragraphs-from-an-office-open-xml-document.md)|Presents code that opens an Office Open XML Document, retrieves the paragraphs in a collection of XElement objects, the text of the paragraphs, and the style of the paragraphs.| -|[How to: Modify an Office Open XML Document (Visual Basic)](how-to-modify-an-office-open-xml-document.md)|Presents code that opens, modifies, and saves an Office Open XML Document.| -|[How to: Populate an XML Tree from the File System (Visual Basic)](how-to-populate-an-xml-tree-from-the-file-system.md)|Presents code that creates an XML tree from the file system.| - -## See also - -- [Querying XML Trees (Visual Basic)](querying-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/applicability-of-functional-transformation.md b/docs/visual-basic/programming-guide/concepts/linq/applicability-of-functional-transformation.md deleted file mode 100644 index 928ba9a4f192d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/applicability-of-functional-transformation.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "Applicability of Functional Transformation" -ms.date: 07/20/2015 -ms.assetid: 3b74e134-e19b-44bc-8d06-e26c48305040 ---- -# Applicability of Functional Transformation (Visual Basic) -Pure functional transformations are applicable in a wide variety of situations. - - The functional transformation approach is ideally suited for querying and manipulating structured data; therefore it fits well with LINQ technologies. However, functional transformation has a much wider applicability than use with LINQ. Any process where the main focus is on transforming data from one form to another should probably be considered as a candidate for functional transformation. - - This approach is applicable to many problems that might not appear at first glance to be a candidate. Used in conjunction with or separately from LINQ, functional transformation should be considered for the following areas: - -- XML-based documents. Well-formed data of any XML dialect can be easily manipulated through functional transformation. For more information, see [Functional Transformation of XML (Visual Basic)](functional-transformation-of-xml.md). - -- Other structured file formats. From Windows.ini files to plain text documents, most files have some structure that lends itself to analysis and transformation. - -- Data streaming protocols. Encoding data into and decoding data from communication protocols can often be represented by a simple functional transform. - -- RDBMS and OODBMS data. Relational and object-oriented databases, just like XML, are widely-used structured data sources. - -- Mathematic, statistic, and science solutions. These fields tend to manipulate large data sets to assist the user in visualizing, estimating, or actually solving non-trivial problems. - - As described in [Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md), using pure functions is an example of functional programming. In additional to their immediate benefits, using pure functions provides valuable experience in thinking about problems from a functional transformation perspective. This approach can also have major impact on program and class design. This is especially true when a problem lends itself to a data transformation solution as described above. - - Although they are beyond the scope of this tutorial, designs that are influenced by the functional transformation perspective tend to center on processes more than on objects as actors, and the resulting solution tends to be implemented as series of large-scale transformations, rather than individual object state changes. - - Again, remember that Visual Basic supports both imperative and functional approaches, so the best design for your application might incorporate elements of both. - -## See also - -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) -- [Functional Transformation of XML (Visual Basic)](functional-transformation-of-xml.md) -- [Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md deleted file mode 100644 index 8ed68326606a8..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/basic-queries-linq-to-xml.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Basic Queries (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: aec6ef60-f6f4-4548-b3db-cf6c94bb0008 ---- -# Basic Queries (LINQ to XML) (Visual Basic) -This section provides examples of basic [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[How to: Find an Element with a Specific Attribute (Visual Basic)](how-to-find-an-element-with-a-specific-attribute.md)|Shows how to find a particular element that has an attribute that has a specific value.| -|[How to: Find an Element with a Specific Child Element (Visual Basic)](how-to-find-an-element-with-a-specific-child-element.md)|Shows how to find a particular element that has a child element that has a specific value.| -|[Querying an XDocument vs. Querying an XElement (Visual Basic)](querying-an-xdocument-vs-querying-an-xelement.md)|Explains the differences between writing queries on an XML tree that is rooted in and writing queries on an XML tree that is rooted in .| -|[How to: Find Descendants with a Specific Element Name (Visual Basic)](how-to-find-descendants-with-a-specific-element-name.md)|Shows how to find all the descendants of an element that have a specific name. This example uses the axis.| -|[How to: Find a Single Descendant Using the Descendants Method (Visual Basic)](how-to-find-a-single-descendant-using-the-descendants-method.md)|Shows how to use the axis method to find a single uniquely named element.| -|[How to: Write Queries with Complex Filtering (Visual Basic)](how-to-write-queries-with-complex-filtering.md)|Shows how to write a query with a more complex filter.| -|[How to: Filter on an Optional Element (Visual Basic)](how-to-filter-on-an-optional-element.md)|Shows how to find nodes in an irregularly shaped tree.| -|[How to: Find All Nodes in a Namespace (Visual Basic)](how-to-find-all-nodes-in-a-namespace.md)|Shows how to find all nodes that are in a specific namespace.| -|[How to: Sort Elements (Visual Basic)](how-to-sort-elements.md)|Shows how to write a query that sorts its results.| -|[How to: Sort Elements on Multiple Keys (Visual Basic)](how-to-sort-elements-on-multiple-keys.md)|Shows how to sort on multiple keys.| -|[How to: Calculate Intermediate Values (Visual Basic)](how-to-calculate-intermediate-values.md)|Shows how to use the `Let` clause to calculate intermediate values in a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.| -|[How to: Write a Query that Finds Elements Based on Context (Visual Basic)](how-to-write-a-query-that-finds-elements-based-on-context.md)|Shows how to select elements based on other elements in the tree.| -|[How to: Debug Empty Query Results Sets (Visual Basic)](how-to-debug-empty-query-results-sets.md)|Shows the appropriate fix when debugging queries on XML that is in a default namespace.| - -## See also - -- [Querying XML Trees (Visual Basic)](querying-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md b/docs/visual-basic/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md deleted file mode 100644 index 8bc207ad22792..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/concepts-and-terminology-functional-transformation.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "Concepts and Terminology (Functional Transformation)" -ms.date: 07/20/2015 -ms.assetid: 24fd244d-ebae-4721-8858-89bb544aea0b ---- -# Concepts and Terminology (Functional Transformation) (Visual Basic) -This topic introduces the concepts and terminology of pure functional transformations. The functional transformation approach to transforming data yields code that is often quicker to program, more expressive, and easier to debug and maintain than more traditional, imperative programming. - -Note that the topics in this section are not intended to fully explain functional programming. Instead, these topics identify some of the functional programming capabilities that make it easier to transform XML from one shape to another. - -## What Is Pure Functional Transformation? - -In *pure functional transformation*, a set of functions, called *pure functions*, define how to transform a set of structured data from its original form into another form. The word "pure" indicates that the functions are *composable*, which requires that they are: - -- *Self-contained*, so that they can be freely ordered and rearranged without entanglement or interdependencies with the rest of the program. Pure transformations have no knowledge of or effect upon their environment. That is, the functions used in the transformation have no *side effects*. - -- *Stateless*, so that executing the same function or specific set of functions on the same input will always result in the same output. Pure transformations have no memory of their prior use. - -> [!IMPORTANT] -> In the rest of this tutorial, the term "pure function" is used in a general sense to indicate a programming approach, and not a specific language feature. -> -> Note that pure functions must be implemented as functions in Visual Basic. -> -> Also, you should not confuse pure functions with pure virtual methods in C++. The latter indicates that the containing class is abstract and that no method body is supplied. - -### Functional Programming - -*Functional programming* is a programming approach that directly supports pure functional transformation. - -Historically, general-purpose functional programming languages, such as ML, Scheme, Haskell, and F#, have been primarily of interest to the academic community. Although it has always been possible to write pure functional transformations in Visual Basic, the difficulty of doing so has not made it an attractive option to most programmers. With later versions of Visual Basic, however, new language constructs such as lambda expressions and type inference make it functional programming much easier and more productive. - -For more information about functional programming, see [Functional Programming vs. Imperative Programming (Visual Basic)](functional-programming-vs-imperative-programming.md). - -#### Domain-Specific FP Languages - -Although general functional programming languages have not been widely adopted, specific domain-specific functional programming languages have had better success. For example, Cascading Style Sheets (CSS) are used to determine the look and feel of many Web pages, and Extensible Stylesheet Language Transformations (XSLT) style sheets are used extensively in XML data manipulation. For more information about XSLT, see [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md). - -## Terminology - -The following table defines some terms related to functional transformations. - -higher-order (first-class) function \ -A function that can be treated as a programmatic object. For example, a higher-order function can be passed to or returned from other functions. In Visual Basic, delegates and lambda expressions are language features that support higher-order functions. To write a higher-order function, you declare one or more arguments to take delegates, and you often use lambda expressions when calling it. Many of the standard query operators are higher-order functions. - -For more information, see [Standard Query Operators Overview (Visual Basic)](standard-query-operators-overview.md). - -lambda expression \ -Essentially, an inline anonymous function that can be used wherever a delegate type is expected. This is a simplified definition of lambda expressions, but it is adequate for the purposes of this tutorial. - -For more information about, see [Lambda Expressions](../../language-features/procedures/lambda-expressions.md). - -collection \ -A structured set of data, usually of a uniform type. To be compatible with LINQ, a collection must implement the interface or the interface (or one of their generic counterparts, or ). - -tuple (anonymous types) \ -A mathematical concept, a tuple is a finite sequence of objects, each of a specific type. A tuple is also known as an ordered list. Anonymous types are a language implementation of this concept, which enable an unnamed class type to be declared and an object of that type to be instantiated at the same time. - -For more information, see [Anonymous Types](../../language-features/objects-and-classes/anonymous-types.md). - -type inference (implicit typing) \ -The ability of a compiler to determine the type of a variable in the absence of an explicit type declaration. - -For more information, see [Local Type Inference](../../language-features/variables/local-type-inference.md). - -deferred execution and lazy evaluation \ -The delaying of evaluation of an expression until its resolved value is actually required. Deferred execution is supported in collections. - -For more information, see [Basic Query Operations (Visual Basic)](basic-query-operations.md) and [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -These language features will be used in code samples throughout this section. - -## See also - -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) -- [Functional Programming vs. Imperative Programming (Visual Basic)](functional-programming-vs-imperative-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md b/docs/visual-basic/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md deleted file mode 100644 index 883771193d809..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/creating-the-source-office-open-xml-document.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "Creating the Source Office Open XML Document" -ms.date: 07/20/2015 -ms.assetid: 61ccd6fb-0c47-4075-afdf-5b5021330f21 ---- -# Creating the Source Office Open XML Document (Visual Basic) -This topic shows how to create the Office Open XML WordprocessingML document that the other examples in this tutorial use. If you follow these instructions, your output will match the output provided in each example. - - However, the examples in this tutorial will work with any valid WordprocessingML document. - - To create the document that this tutorial uses, you must either have Microsoft Office 2007 or later installed, or you must have Microsoft Office 2003 with the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. - -## Creating the WordprocessingML Document - -#### To create the WordprocessingML document - -1. Create a new Microsoft Word document. - -2. Paste the following text into the new document: - - ```text - Parsing WordprocessingML with LINQ to XML - - The following example prints to the console. - - Imports System - - Class Program - Public Shared Sub Main(ByVal args() As String) - Console.WriteLine("Hello World") - End Sub - End Class - - This example produces the following output: - - Hello World - ``` - -3. Format the first line with the style "Heading 1". - -4. Select the lines that contain the Visual Basic code. The first line starts with the `Imports` keyword. The last line is "End Class". Format the lines with the courier font. Format them with a new style, and name the new style "Code". - -5. Finally, select the entire line that contains the output, and format it with the `Code` style. - -6. Save the document, and name it SampleDoc.docx. - - > [!NOTE] - > If you are using Microsoft Word 2003, select **Word 2007 Document** in the **Save as Type** drop-down list. - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/creating-xml-trees.md b/docs/visual-basic/programming-guide/concepts/linq/creating-xml-trees.md deleted file mode 100644 index c1d278e19c4fa..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/creating-xml-trees.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -title: "Creating XML Trees" -ms.date: 07/20/2015 -ms.assetid: e86ba12b-17de-4579-81bb-66322b84cfbe ---- -# Creating XML Trees (Visual Basic) -One of the most common XML tasks is constructing an XML tree. This section describes several ways to create them. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Functional Construction (LINQ to XML) (Visual Basic)](functional-construction-linq-to-xml.md)|Provides an overview of functional construction in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. Functional construction enables you to create all or part of your XML tree in a single statement. This topic also shows how to embed queries when constructing an XML tree.| -|[Introduction to XML Literals in Visual Basic](introduction-to-xml-literals.md)|Provides a quick introduction to creating trees in Visual Basic by using XML literals. This topic includes links to the Visual Basic documentation of XML literals.| -|[Cloning vs. Attaching (Visual Basic)](cloning-vs-attaching.md)|Demonstrates the difference between adding nodes from an existing XML tree (nodes are cloned and then added) and adding nodes with no parent (they are simply attached).| -|[Parsing XML (Visual Basic)](parsing-xml.md)|Shows how to parse XML from a variety of sources. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is layered on top of , which is used to parse the XML.| -|[How to: Populate an XML Tree with an XmlWriter (LINQ to XML) (Visual Basic)](how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md)|Shows how to populate an XML tree by using an .| -|[How to: Validate Using XSD (LINQ to XML) (Visual Basic)](how-to-validate-using-xsd-linq-to-xml.md)|Shows how to validate an XML tree using XSD.| -|[Valid Content of XElement and XDocument Objects](valid-content-of-xelement-and-xdocument-objects.md)|Describes the valid arguments that can be passed to the constructors and methods that are used to add content to elements and documents.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md deleted file mode 100644 index 6bca3f4956b2e..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-and-lazy-evaluation-in-linq-to-xml.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Deferred Execution and Lazy Evaluation in LINQ to XML" -ms.date: 07/20/2015 -ms.assetid: 31998eed-b95e-47fb-a865-9de1f337d1fb ---- -# Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic) -Query and axis operations are often implemented to use deferred execution. This topic explains the requirements and advantages of deferred execution, and some implementation considerations. - -## Deferred Execution - Deferred execution means that the evaluation of an expression is delayed until its *realized* value is actually required. Deferred execution can greatly improve performance when you have to manipulate large data collections, especially in programs that contain a series of chained queries or manipulations. In the best case, deferred execution enables only a single iteration through the source collection. - - The LINQ technologies make extensive use of deferred execution in both the members of core classes and in the extension methods in the various LINQ namespaces, such as . - -## Eager vs. Lazy Evaluation - When you write a method that implements deferred execution, you also have to decide whether to implement the method using lazy evaluation or eager evaluation. - -- In *lazy evaluation*, a single element of the source collection is processed during each call to the iterator. This is the typical way in which iterators are implemented. - -- In *eager evaluation*, the first call to the iterator will result in the entire collection being processed. A temporary copy of the source collection might also be required. For example, the method has to sort the entire collection before it returns the first element. - - Lazy evaluation usually yields better performance because it distributes overhead processing evenly throughout the evaluation of the collection and minimizes the use of temporary data. Of course, for some operations, there is no other option than to materialize intermediate results. - -## Next Steps - The next topic in this tutorial illustrates deferred execution: - -- [Deferred Execution Example (Visual Basic)](deferred-execution-example.md) - -## See also - -- [Tutorial: Deferred Execution (Visual Basic)](tutorial-deferred-execution.md) -- [Concepts and Terminology (Functional Transformation) (Visual Basic)](concepts-and-terminology-functional-transformation.md) -- [Aggregation Operations (Visual Basic)](aggregation-operations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-example.md b/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-example.md deleted file mode 100644 index 335f734412270..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/deferred-execution-example.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: "Deferred Execution Example" -ms.date: 07/20/2015 -ms.assetid: 9a22bea1-c755-4aac-800a-fcd9e5107ace ---- -# Deferred Execution Example (Visual Basic) - -This topic shows how deferred execution and lazy evaluation affect the execution of your LINQ to XML queries. - -## Example - -The following example shows the order of execution when using an extension method that uses deferred execution. The example declares an array of three strings. It then iterates through the collection returned by `ConvertCollectionToUpperCase`. - -```vb -Imports System.Runtime.CompilerServices - -Module Module1 - - - Private Iterator Function ConvertCollectionToUpperCase( - ByVal source As IEnumerable(Of String)) _ - As IEnumerable(Of String) - For Each str As String In source - Console.WriteLine("ToUpper: source {0}", str) - Yield str.ToUpper() - Next - End Function - - Sub Main() - Dim stringArray = New String() {"abc", "def", "ghi"} - - Dim q = From str In stringArray.ConvertCollectionToUpperCase() - Select str - - For Each Str As String In q - Console.WriteLine("Main: str {0}", Str) - Next - End Sub - -End Module -``` - -This example produces the following output: - -```console -ToUpper: source abc -Main: str ABC -ToUpper: source def -Main: str DEF -ToUpper: source ghi -Main: str GHI -``` - -Notice that when iterating through the collection returned by `ConvertCollectionToUpperCase`, each item is retrieved from the source string array and converted to uppercase before the next item is retrieved from the source string array. - -You can see that the entire array of strings is not converted to uppercase before each item in the returned collection is processed in the `foreach` loop in `Main`. - -## See also - -- [Tutorial: Deferred Execution (Visual Basic)](tutorial-deferred-execution.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/details-of-office-open-xml-wordprocessingml-documents.md b/docs/visual-basic/programming-guide/concepts/linq/details-of-office-open-xml-wordprocessingml-documents.md deleted file mode 100644 index cae9f54801965..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/details-of-office-open-xml-wordprocessingml-documents.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -title: "Details of Office Open XML WordprocessingML Documents" -ms.date: 07/20/2015 -ms.assetid: 6b1e155c-7174-4244-a6de-0fddf9a0b0d7 ---- -# Details of Office Open XML WordprocessingML Documents (Visual Basic) -This section provides information about the details of Office Open XML WordprocessingML documents. It shows examples of the document and style parts of an Open XML document. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[WordprocessingML Document with Styles](wordprocessingml-document-with-styles.md)|Shows the document part of an Office Open XML WordprocessingML document.| -|[Style Part of a WordprocessingML Document](style-part-of-a-wordprocessingml-document.md)|Shows the style part of an Office Open XML WordprocessingML document.| -|[Example that Outputs Office Open XML Document Parts (Visual Basic)](example-that-outputs-office-open-xml-document-parts.md)|Provides an example that opens an Office Open XML WordprocessingML document, and outputs the parts to the console.| - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md b/docs/visual-basic/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md deleted file mode 100644 index 7ac27a81f94d5..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/example-that-outputs-office-open-xml-document-parts.md +++ /dev/null @@ -1,63 +0,0 @@ ---- -title: "Example that Outputs Office Open XML Document Parts" -ms.date: 07/20/2015 -ms.assetid: a951925b-c985-48ed-b215-2a68b58f1ae5 ---- -# Example that Outputs Office Open XML Document Parts (Visual Basic) -This topic shows how to open an Office Open XML document and access parts within it. - -## Example - The following example opens an Office Open XML document, and prints the document part and the style part to the console. - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```vb -Const fileName As String = "SampleDoc.docx" - -Const documentRelationshipType As String = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" -Const stylesRelationshipType As String = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" -Const wordmlNamespace As String = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" -Dim w As XNamespace = wordmlNamespace - -Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If docPackageRelationship IsNot Nothing Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - Dim xdoc As XDocument = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - Console.WriteLine("TargetUri:{0}", docPackageRelationship.TargetUri) - Console.WriteLine("==================================================================") - Console.WriteLine(xdoc.Root) - Console.WriteLine() - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If styleRelation IsNot Nothing Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - Dim styleDoc As XDocument = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - - Console.WriteLine("TargetUri:{0}", styleRelation.TargetUri) - Console.WriteLine("==================================================================") - Console.WriteLine(styleDoc.Root) - Console.WriteLine() - End If - End If -End Using -``` - -## See also - -- [Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/finding-text-in-word-documents.md b/docs/visual-basic/programming-guide/concepts/linq/finding-text-in-word-documents.md deleted file mode 100644 index 2d19687ae98da..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/finding-text-in-word-documents.md +++ /dev/null @@ -1,311 +0,0 @@ ---- -title: "Finding Text in Word Documents" -ms.date: 07/20/2015 -ms.assetid: eea9819b-a78a-4552-bf13-8837fc0e7a37 ---- -# Finding Text in Word Documents (Visual Basic) - -This topic extends the previous queries to do something useful: find all occurrences of a string in the document. - -## Example - -This example processes a WordprocessingML document, to find all the occurrences of a specific piece of text in the document. To do this, we use a query that finds the string "Hello". This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - -For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - -This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - Public Function ParagraphText(ByVal e As XElement) As String - Dim w As XNamespace = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = ParagraphText(para.ParagraphNode) _ - } - - ' Following is the new query that retrieves all paragraphs - ' that have specific text in them. - Dim helloParagraphs = _ - From para In paraWithText _ - Where para.Text.Contains("Hello") _ - Select New With _ - { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = para.Text _ - } - - For Each p In helloParagraphs - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - End Sub -End Module -``` - -This example produces the following output: - -```console -StyleName:Code > Console.WriteLine("Hello World")< -StyleName:Code >Hello World< -``` - -You can, of course, modify the search so that it searches for lines with a specific style. The following query finds all blank lines that have the Code style: - -```vb -Imports System.IO.Packaging -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - Public Function ParagraphText(ByVal e As XElement) As String - Dim w As XNamespace = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = ParagraphText(para.ParagraphNode) _ - } - - ' Retrieve all paragraphs that have no text and are styled Code. - Dim blankCodeParagraphs = _ - From para In paraWithText _ - Where String.IsNullOrEmpty(para.Text) And para.StyleName.Equals("Code") _ - Select New With _ - { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = para.Text _ - } - - For Each p In blankCodeParagraphs - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - End Sub -End Module -``` - -This example produces the following output: - -```console -StyleName:Code >< -``` - -Of course, this example could be enhanced in a number of ways. For example, we could use regular expressions to search for text, we could iterate through all the Word files in a particular directory, and so on. - -Note that this example performs approximately as well as if it were written as a single query. Because each query is implemented in a lazy, deferred fashion, each query does not yield its results until the query is iterated. For more information about execution and lazy evaluation, see [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -## Next Steps - -The next section provides more information about WordprocessingML documents: - -- [Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) -- [Refactoring Using a Pure Function (Visual Basic)](refactoring-using-a-pure-function.md) -- [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/finding-the-default-paragraph-style.md b/docs/visual-basic/programming-guide/concepts/linq/finding-the-default-paragraph-style.md deleted file mode 100644 index 38aedc993297f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/finding-the-default-paragraph-style.md +++ /dev/null @@ -1,90 +0,0 @@ ---- -title: "Finding the Default Paragraph Style" -ms.date: 07/20/2015 -ms.assetid: 9d094a4a-ec8c-41b0-b7ab-a3deb2a01d45 ---- -# Finding the Default Paragraph Style (Visual Basic) -The first task in the Manipulating Information in a WordprocessingML Document tutorial is to find the default style of paragraphs in the document. - -## Example - -### Description - The following example opens an Office Open XML WordprocessingML document, finds the document and style parts of the package, and then executes a query that finds the default style name. For information about Office Open XML document packages, and the parts they consist of, see [Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md). - - The query finds a node named `w:style` that has an attribute named `w:type` with a value of "paragraph", and also has an attribute named `w:default` with a value of "1". Because there will be only one XML node with these attributes, the query uses the operator to convert a collection to a singleton. It then gets the value of the attribute with the name `w:styleId`. - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -### Code - -```vb -Imports - -Module Module1 - - Sub Main() - - Const fileName As String = "SampleDoc.docx" - - Const documentRelationshipType As String = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Const stylesRelationshipType As String = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If docPackageRelationship IsNot Nothing Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If styleRelation IsNot Nothing Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - ' The following query finds all the paragraphs that have the default style. - Dim defParas As IEnumerable(Of XElement) = _ - From style In styleDoc.Root. _ - Where style.@w:type.Equals("paragraph") And _ - style.@w:default.Equals("1") _ - Select style - ' Then find the style of the first. - Dim defaultStyle As String = defParas.First().@w:styleId - - Console.WriteLine("The default style is: " & defaultStyle) - End Sub -End Module -``` - -### Comments - This example produces the following output: - -```console -The default style is: Normal -``` - -## Next Steps - In the next example, you'll create a similar query that finds all the paragraphs in a document and their styles: - -- [Retrieving the Paragraphs and Their Styles (Visual Basic)](retrieving-the-paragraphs-and-their-styles.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/functional-construction-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/functional-construction-linq-to-xml.md deleted file mode 100644 index 2e4ebdde02f95..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/functional-construction-linq-to-xml.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Functional Construction (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: feac4273-39ab-43ae-bab7-4059c807a785 ---- -# Functional Construction (LINQ to XML) (Visual Basic) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides a powerful way to create XML elements called *functional construction*. Functional construction is the ability to create an XML tree in a single statement. - - There are several key features of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] programming interface that enable functional construction: - -- The constructor takes various types of arguments for content. For example, you can pass another object, which becomes a child element. You can pass an object, which becomes an attribute of the element. Or you can pass any other type of object, which is converted to a string and becomes the text content of the element. - -- The constructor takes a `params` array of type , so that you can pass any number of objects to the constructor. This enables you to create an element that has complex content. - -- If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. This is important because it lets you pass the results of a LINQ query to the constructor. - - The following is an example: - - These features enable you to write code using XML literals to create an XML tree, and also to write code that uses the results of LINQ queries when you create an XML tree: - -```vb -Dim srcTree As XElement = _ - - 1 - 2 - 3 - 4 - 5 - -Dim xmlTree As XElement = _ - - 1 - 2 - <%= From el In srcTree.Elements() _ - Where CInt(el) > 2 _ - Select el %> - -Console.WriteLine(xmlTree) -``` - - This example produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - -``` - -## See also - -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md b/docs/visual-basic/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md deleted file mode 100644 index 37ff85c80700a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/functional-programming-vs-imperative-programming.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "Functional Programming vs. Imperative Programming" -ms.date: 07/20/2015 -ms.assetid: 6a1f3b57-00e6-447d-9906-74c7c4d5d85c ---- -# Functional Programming vs. Imperative Programming (Visual Basic) -This topic compares and contrasts functional programming with more traditional imperative (procedural) programming. - -## Functional Programming vs. Imperative Programming - The *functional programming* paradigm was explicitly created to support a pure functional approach to problem solving. Functional programming is a form of *declarative programming*. In contrast, most mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and Java, were designed to primarily support *imperative* (procedural) programming. - - With an imperative approach, a developer writes code that describes in exacting detail the steps that the computer must take to accomplish the goal. This is sometimes referred to as *algorithmic* programming. In contrast, a functional approach involves composing the problem as a set of functions to be executed. You define carefully the input to each function, and what each function returns. The following table describes some of the general differences between these two approaches. - -|Characteristic|Imperative approach|Functional approach| -|--------------------|-------------------------|-------------------------| -|Programmer focus|How to perform tasks (algorithms) and how to track changes in state.|What information is desired and what transformations are required.| -|State changes|Important.|Non-existent.| -|Order of execution|Important.|Low importance.| -|Primary flow control|Loops, conditionals, and function (method) calls.|Function calls, including recursion.| -|Primary manipulation unit|Instances of structures or classes.|Functions as first-class objects and data collections.| - - Although most languages were designed to support a specific programming paradigm, many general languages are flexible enough to support multiple paradigms. For example, most languages that contain function pointers can be used to credibly support functional programming. Furthermore, Visual Basic includes explicit language extensions to support functional programming, including lambda expressions and type inference. LINQ technology is a form of declarative, functional programming. - -## Functional Programming Using XSLT - Many XSLT developers are familiar with the pure functional approach. The most effective way to develop an XSLT style sheet is to treat each template as an isolated, composable transformation. The order of execution is completely de-emphasized. XSLT does not allow side effects (with the exception that escaping mechanisms for executing procedural code can introduce side effects that result in functional impurity). However, although XSLT is an effective tool, some of its characteristics are not optimal. For example, expressing programming constructs in XML makes code relatively verbose, and therefore difficult to maintain. Also, the heavy reliance on recursion for flow control can result in code that is hard to read. For more information about XSLT, see [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md). - - However, XSLT has proved the value of using a pure functional approach for transforming XML from one shape to another. Pure functional programming with LINQ to XML is similar in many ways to XSLT. However, the programming constructs introduced by LINQ to XML and Visual Basic allow you to write pure functional transformations that are more readable and maintainable than XSLT. - -## Advantages of Pure Functions - The primary reason to implement functional transformations as pure functions is that pure functions are composable: that is, self-contained and stateless. These characteristics bring a number of benefits, including the following: - -- Increased readability and maintainability. This is because each function is designed to accomplish a specific task given its arguments. The function does not rely on any external state. - -- Easier reiterative development. Because the code is easier to refactor, changes to design are often easier to implement. For example, suppose you write a complicated transformation, and then realize that some code is repeated several times in the transformation. If you refactor through a pure method, you can call your pure method at will without worrying about side effects. - -- Easier testing and debugging. Because pure functions can more easily be tested in isolation, you can write test code that calls the pure function with typical values, valid edge cases, and invalid edge cases. - -## Transitioning for OOP Developers - In traditional object-oriented programming (OOP), most developers are accustomed to programming in the imperative/procedural style. To switch to developing in a pure functional style, they have to make a transition in their thinking and their approach to development. - - To solve problems, OOP developers design class hierarchies, focus on proper encapsulation, and think in terms of class contracts. The behavior and state of object types are paramount, and language features, such as classes, interfaces, inheritance, and polymorphism, are provided to address these concerns. - - In contrast, functional programming approaches computational problems as an exercise in the evaluation of pure functional transformations of data collections. Functional programming avoids state and mutable data, and instead emphasizes the application of functions. - - Fortunately, Visual Basic doesn't require the full leap to functional programming, because it supports both imperative and functional programming approaches. A developer can choose which approach is most appropriate for a particular scenario. In fact, programs often combine both approaches. - -## See also - -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) -- [XSLT Transformations](../../../../standard/data/xml/xslt-transformations.md) -- [Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/functional-transformation-of-xml.md b/docs/visual-basic/programming-guide/concepts/linq/functional-transformation-of-xml.md deleted file mode 100644 index 242cf96539f6d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/functional-transformation-of-xml.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Functional Transformation of XML" -ms.date: 07/20/2015 -ms.assetid: fdbe5b91-f457-4b4e-a11b-def4bdd77bab ---- -# Functional Transformation of XML (Visual Basic) -This topic discusses the pure functional transformation approach to modifying XML documents, and contrasts it with a procedural approach. - -## Modifying an XML Document - One of the most common tasks for an XML programmer is transforming XML from one shape to another. The shape of an XML document is the structure of the document, which includes the following: - -- The hierarchy expressed by the document. - -- The element and attribute names. - -- The data types of the elements and attributes. - - In general, the most effective approach to transforming XML from one shape to another is that of pure functional transformation. In this approach, the primary programmer task is to create a transformation which is applied to the entire XML document (or to one or more strictly defined nodes). Functional transformation is arguably the easiest to code (after a programmer is familiar with the approach), yields the most maintainable code, and is often more compact than alternative approaches. - -### XML Functional Transformational Technologies - Microsoft offers two functional transformation technologies for use on XML documents: XSLT and LINQ to XML. XSLT is supported in the managed namespace and in the native COM implementation of MSXML. Although XSLT is a robust technology for manipulating XML documents, it requires expertise in a specialized domain, namely the XSLT language and its supporting APIs. - - LINQ to XML provides the tools necessary to code pure functional transformations in an expressive and powerful way, within C# or Visual Basic code. For example, many of the examples in the LINQ to XML documentation use a pure functional approach. Also, in the [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) tutorial, we use LINQ to XML in a functional approach to manipulate information in a Microsoft Word document. - - For a more complete comparison of LINQ to XML with other Microsoft XML technologies, see [LINQ to XML vs. Other XML Technologies](linq-to-xml-vs-other-xml-technologies.md). - - XSLT is the recommended tool for document-centric transformations when the source document has an irregular structure. However, LINQ to XML can also perform document-centric transforms. For more information, see [How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style (Visual Basic)](how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md). - -## See also - -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) -- [LINQ to XML vs. Other XML Technologies](linq-to-xml-vs-other-xml-technologies.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md deleted file mode 100644 index f07ef14992865..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/functional-vs-procedural-programming-linq-to-xml.md +++ /dev/null @@ -1,39 +0,0 @@ ---- -title: "Functional vs. Procedural Programming (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: ea1015a5-d4c8-4d79-8e1e-ba17a40a4f39 ---- -# Functional vs. Procedural Programming (LINQ to XML) (Visual Basic) -There are various types of XML applications: - -- Some applications take source XML documents, and produce new XML documents that are in a different shape than the source documents. - -- Some applications take source XML documents, and produce result documents in an entirely different form, such as HTML or CSV text files. - -- Some applications take source XML documents, and insert records into a database. - -- Some applications take data from another source, such as a database, and create XML documents from it. - - These are not all of the types of XML applications, but these are a representative set of the types of functionality that an XML programmer has to implement. - - With all of these types of applications, there are two contrasting approaches that a developer can take: - -- Functional construction using a declarative approach. - -- In-memory XML tree modification using procedural code. - - LINQ to XML supports both approaches. - - When using the functional approach, you write transformations that take the source documents and generate completely new result documents with the desired shape. - - When modifying an XML tree in place, you write code that traverses and navigates through nodes in an in-memory XML tree, inserting, deleting, and modifying nodes as necessary. - - You can use LINQ to XML with either approach. You use the same classes, and in some cases the same methods. However, the structure and goals of the two approaches are very different. For example, in different situations, one or the other approach will often have better performance, and use more or less memory. In addition, one or the other approach will be easier to write and yield more maintainable code. - - To see the two approaches contrasted, see [In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (Visual Basic)](in-memory-xml-tree-modification-vs-functional-construction.md). - - For a tutorial on writing functional transformations, see [Pure Functional Transformations of XML (Visual Basic)](pure-functional-transformations-of-xml.md). - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/getting-started-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/getting-started-linq-to-xml.md deleted file mode 100644 index cec92a9f94a40..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/getting-started-linq-to-xml.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Getting Started (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: c3a9062d-9d51-4a8e-bac6-071d16a7d9ea ---- -# Getting Started (LINQ to XML) -The following topics introduce LINQ to XML. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[LINQ to XML Overview (Visual Basic)](linq-to-xml-overview.md)|Provides an overview of the LINQ to XML technology.| -|[LINQ to XML vs. DOM (Visual Basic)](linq-to-xml-vs-dom.md)|Compares LINQ to XML to the Document Object Model (DOM).| -|[LINQ to XML vs. Other XML Technologies](linq-to-xml-vs-other-xml-technologies.md)|Compares LINQ to XML to other XML parsing and manipulation technologies: XmlReader, XSLT, MSXML, and XmlLite.| - -## See also - -- [Reference (LINQ to XML)](reference-linq-to-xml.md) -- [LINQ to XML (Visual Basic)](linq-to-xml.md) -- [Overview of LINQ to XML in Visual Basic](../../language-features/xml/overview-of-linq-to-xml.md) -- [XML](../../language-features/xml/index.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md deleted file mode 100644 index 3ab5c54cb7097..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-build-linq-to-xml-examples.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "How to: build LINQ to XML examples" -ms.date: 07/20/2015 -ms.assetid: 565bca7a-ac8b-497f-8d8d-3323b3d7799e ---- -# How to: build LINQ to XML examples - Visual Basic - -The various snippets and examples in this documentation use classes and types from a variety of namespaces. When compiling Visual Basic code, you need to supply appropriate `Imports` statements. - -## Example - -The following code contains the `Imports` statements that the Visual Basic examples require to build and run. Not all `Imports` statements are required for every example. - -```vb -Imports System.Diagnostics -Imports System.Collections -Imports System.Collections.Generic -Imports System.Collections.Specialized -Imports System.Text -Imports System.Linq -Imports System.Xml -Imports System.Xml.Linq -Imports System.Xml.Schema -Imports System.Xml.XPath -Imports System.Xml.Xsl -Imports System.IO -Imports System.Threading -Imports System.Reflection -Imports System.IO.Packaging -``` - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md deleted file mode 100644 index 0c5f2bc869270..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-calculate-intermediate-values.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "How to: Calculate Intermediate Values" -ms.date: 07/20/2015 -ms.assetid: 933a97b2-dfe7-4f4d-94ad-e6e20df84abd ---- -# How to: Calculate Intermediate Values (Visual Basic) -This example shows how to calculate intermediate values that can be used in sorting, filtering, and selecting. - -## Example - The following example uses the `Let` clause. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](sample-xml-file-numerical-data-linq-to-xml.md). - -```vb -Dim root As XElement = XElement.Load("Data.xml") -Dim extensions As IEnumerable(Of Decimal) = _ - From el In root. _ - Let extension = CDec(el..Value) * CDec(el..Value) _ - Where extension > 25 _ - Order By extension _ - Select extension -For Each ex As Decimal In extensions - Console.WriteLine(ex) -Next -``` - - This code produces the following output: - -```console -55.92 -73.50 -89.99 -198.00 -435.00 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Numerical Data in a Namespace](sample-xml-file-numerical-data-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = XElement.Load("DataInNamespace.xml") - Dim extensions As IEnumerable(Of Decimal) = _ - From el In root. _ - Let extension = CDec(el..Value) * CDec(el..Value) _ - Where extension > 25 _ - Order By extension _ - Select extension - For Each ex As Decimal In extensions - Console.WriteLine(ex) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -55.92 -73.50 -89.99 -198.00 -435.00 -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-catch-parsing-errors.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-catch-parsing-errors.md deleted file mode 100644 index 04f37b2ccae5f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-catch-parsing-errors.md +++ /dev/null @@ -1,40 +0,0 @@ ---- -title: "How to: Catch Parsing Errors" -ms.date: 07/20/2015 -ms.assetid: 22e9068e-ea58-447b-816e-cd1852c11787 ---- -# How to: Catch Parsing Errors (Visual Basic) -This topic shows how to detect badly formed or invalid XML. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is implemented using . If badly formed or invalid XML is passed to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], the underlying class will throw an exception. The various methods that parse XML, such as , do not catch the exception; the exception can then be caught by your application. - - Note that you cannot get parse errors if you use XML literals. The Visual Basic compiler will catch errors of badly formed or invalid XML. - -## Example - The following code tries to parse invalid XML: - -```vb -Try - Dim contacts As XElement = XElement.Parse("" & vbCrLf & _ - " " & vbCrLf & _ - " Jim Wilson" & vbCrLf & _ - " " & vbCrLf & _ - "") - - Console.WriteLine(contacts) -Catch e As System.Xml.XmlException - Console.WriteLine(e.Message) -End Try -``` - - When you run this code, it throws the following exception: - -```console -The 'Contacts' start tag on line 1 does not match the end tag of 'Contcts'. Line 5, position 13. -``` - - For information about the exceptions that you can expect the , , , and methods to throw, see the documentation. - -## See also - -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md deleted file mode 100644 index 1f5f765d2aee7..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-chain-axis-method-calls-linq-to-xml.md +++ /dev/null @@ -1,116 +0,0 @@ ---- -title: "How to: Chain Axis Method Calls (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: e4e22942-39bd-460f-b3c0-9f09e53d3aa9 ---- -# How to: Chain Axis Method Calls (LINQ to XML) (Visual Basic) -A common pattern that you will use in your code is to call an axis method, then call one of the extension method axes. - - There are two axes with the name of `Elements` that return a collection of elements: the method and the method. You can combine these two axes to find all elements of a specified name at a given depth in the tree. - -## Example - This example uses and to find all `Name` elements in all `Address` elements in all `PurchaseOrder` elements. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Dim purchaseOrders As XElement = XElement.Load("PurchaseOrders.xml") -Dim names As IEnumerable(Of XElement) = _ - From el In purchaseOrders..
. _ - Select el -For Each e As XElement In names - Console.WriteLine(e) -Next -``` - - This example produces the following output: - -```xml -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` - - This works because one of the implementations of the `Elements` axis is as an extension method on of . derives from , so you can call the method on the results of a call to the method. - -## Example - Sometimes you want to retrieve all elements at a particular element depth when there might or might not be intervening ancestors. For example, in the following document, you might want to retrieve all the `ConfigParameter` elements that are children of the `Customer` element, but not the `ConfigParameter` that is a child of the `Root` element. - -```xml - - RootConfigParameter - - Frank - - FirstConfigParameter - - - - Bob - - - - Bill - - SecondConfigParameter - - - -``` - - To do this, you can use the axis, as follows: - -```vb -Dim root As XElement = XElement.Load("Irregular.xml") -Dim configParameters As IEnumerable(Of XElement) = _ - root... -For Each cp As XElement In configParameters - Console.WriteLine(cp) -Next -``` - - This example produces the following output: - -```xml -FirstConfigParameter -SecondConfigParameter -``` - -## Example - The following example shows the same technique for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders in a Namespace](sample-xml-file-multiple-purchase-orders-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim purchaseOrders As XElement = XElement.Load("PurchaseOrdersInNamespace.xml") - Dim names As IEnumerable(Of XElement) = _ - From el In purchaseOrders... _ - Select el - For Each e As XElement In names - Console.WriteLine(e) - Next - End Sub -End Module -``` - - This example produces the following output: - -```xml -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md deleted file mode 100644 index e4b0395cc9677..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-change-the-namespace-for-an-entire-xml-tree.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -title: "How to: Change the Namespace for an Entire XML Tree" -ms.date: 07/20/2015 -ms.assetid: 1837324b-5cb5-4fa8-95b9-3071efa0f913 ---- -# How to: Change the Namespace for an Entire XML Tree (Visual Basic) -You sometimes have to programmatically change the namespace for an element or an attribute. LINQ to XML makes this easy. The property can be set. The property cannot be set, but you can easily copy the attributes into a , remove the existing attributes, and then add new attributes that are in the new desired namespace. - - For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -## Example - The following code creates two XML trees in no namespace. It then changes the namespace of each of the trees, and combines them into a single tree. - -```vb -Dim tree1 As XElement = _ - - content - -Dim tree2 As XElement = _ - - content - -Dim aw As XNamespace = "http://www.adventure-works.com" -Dim ad As XNamespace = "http://www.adatum.com" -' change the namespace of every element and attribute in the first tree -For Each el As XElement In tree1.DescendantsAndSelf - el.Name = aw.GetName(el.Name.LocalName) - Dim atList As List(Of XAttribute) = el.Attributes().ToList() - el.Attributes().Remove() - For Each at As XAttribute In atList - el.Add(New XAttribute(aw.GetName(at.Name.LocalName), at.Value)) - Next -Next -' change the namespace of every element and attribute in the second tree -For Each el As XElement In tree2.DescendantsAndSelf() - el.Name = ad.GetName(el.Name.LocalName) - Dim atList As List(Of XAttribute) = el.Attributes().ToList() - el.Attributes().Remove() - For Each at As XAttribute In atList - el.Add(New XAttribute(ad.GetName(at.Name.LocalName), at.Value)) - Next -Next -' add attribute namespaces so that the tree will be serialized with -' the aw and ad namespace prefixes -tree1.Add( _ - New XAttribute(XNamespace.Xmlns + "aw", "http://www.adventure-works.com") _ -) -tree2.Add( _ - New XAttribute(XNamespace.Xmlns + "ad", "http://www.adatum.com") _ -) -' create a new composite tree -Dim root As XElement = _ - - <%= tree1 %> - <%= tree2 %> - -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - - - content - - - content - - -``` - -## See also - -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md deleted file mode 100644 index b173ad8f8f3e5..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-control-namespace-prefixes-linq-to-xml.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "How to: Control Namespace Prefixes (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 2fcf28a5-31b6-409d-84ea-27c22f71fc9f ---- -# How to: Control Namespace Prefixes (Visual Basic) (LINQ to XML) -This topic describes how you can control namespace prefixes. - -## Example - -### Description - This example declares two namespaces. It specifies that the `http://www.adventure-works.com` namespace has the prefix `aw`, and that the `www.fourthcoffee.com` namespace has the prefix of `fc`. - -### Code - -```vb -Imports -Imports - -Module Module1 - - Sub Main() - Dim root As XElement = _ - - - other content - - c2 content - c3 content - - Console.WriteLine(root) - End Sub - -End Module -``` - -### Comments - This example produces the following output: - -```xml - - - other content - - c2 content - c3 content - -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md deleted file mode 100644 index c683e917cabb0..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-control-the-type-of-a-projection.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: "How to: Control the Type of a Projection" -ms.date: 07/20/2015 -ms.assetid: a0171276-0b46-4817-aee5-a8d5191b12fe ---- -# How to: Control the Type of a Projection (Visual Basic) -Projection is the process of taking one set of data, filtering it, changing its shape, and even changing its type. Most query expressions perform projections. Most of the query expressions shown in this section evaluate to of , but you can control the type of the projection to create collections of other types. This topic shows how to do this. - -## Example - The following example defines a new type, `Customer`. The query expression then instantiates new `Customer` objects in the `Select` clause. This causes the type of the query expression to be of `Customer`. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Public Class Customer - Private customerIDValue As String - Public Property CustomerID() As String - Get - Return customerIDValue - End Get - Set(ByVal value As String) - customerIDValue = value - End Set - End Property - - Private companyNameValue As String - Public Property CompanyName() As String - Get - Return companyNameValue - End Get - Set(ByVal value As String) - companyNameValue = value - End Set - End Property - - Private contactNameValue As String - Public Property ContactName() As String - Get - Return contactNameValue - End Get - Set(ByVal value As String) - contactNameValue = value - End Set - End Property - - Public Sub New(ByVal customerID As String, _ - ByVal companyName As String, _ - ByVal contactName As String) - CustomerIDValue = customerID - CompanyNameValue = companyName - ContactNameValue = contactName - End Sub - - Public Overrides Function ToString() As String - Return String.Format("{0}:{1}:{2}", Me.CustomerID, Me.CompanyName, Me.ContactName) - End Function -End Class - -Sub Main() - Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") - Dim custList As IEnumerable(Of Customer) = _ - From el In custOrd.. _ - Select New Customer( _ - el.@, _ - el..Value, _ - el..Value _ - ) - For Each cust In custList - Console.WriteLine(cust) - Next -End Sub -``` - - This code produces the following output: - -```console -GREAL:Great Lakes Food Market:Howard Snyder -HUNGC:Hungry Coyote Import Store:Yoshi Latimer -LAZYK:Lazy K Kountry Store:John Steel -LETSS:Let's Stop N Shop:Jaime Yorres -``` - -## See also - -- -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces.md deleted file mode 100644 index 091eb3321b103..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-document-with-namespaces.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "How to: Create a Document with Namespaces (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: cc5b0d4d-360c-4ada-94fa-2d2916e989be ---- -# How to: Create a Document with Namespaces (LINQ to XML) (Visual Basic) -This topic shows how to create a document with namespaces in Visual Basic. - - When using XML literals in Visual Basic, users can define one global default XML namespace. This namespace is the default namespace for both XML literals and XML properties. The default XML namespace can be defined at either the project level or the file level. If it is defined at the file level, it overrides the default namespace at the project level. - - You can also define other namespaces, and specify the namespace prefixes for those namespaces. - - You define both default namespaces and namespaces with a prefix by using the `Imports` keyword. - - For more information, see [Introduction to XML Literals in Visual Basic](introduction-to-xml-literals.md). - - Note that the default XML namespace only applies to elements and not to attributes. Attributes are by default always in no namespace. However, you can use a namespace prefix to put an attribute in a namespace. - -## Example - This example creates a document that contains a namespace. - -```vb -Imports -Module Module1 - Sub Main() - Dim root As XElement = _ - - - - Console.WriteLine(root) - End Sub -End Module -``` - - This example produces the following output: - -```xml - - - -``` - -## Example - This example creates a document that contains two namespaces, one of which is the default namespace. - -```vb -Imports -Imports - -Module Module1 - - Sub Main() - Dim root As XElement = _ - - - child2 content - - Console.WriteLine(root) - End Sub - -End Module -``` - - This example produces the following output: - -```xml - - - child2 content - -``` - -## Example - The following example creates a document that contains multiple namespaces, both with namespace prefixes. - - When serializing an XML tree, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] emits namespace declarations as required so that each element is in its designated namespace. - -```vb -Imports -Imports - -Module Module1 - - Sub Main() - Dim root As XElement = _ - - - other content - - c2 content - c3 content - - Console.WriteLine(root) - End Sub - -End Module -``` - - This example produces the following output: - -```xml - - - other content - - c2 content - c3 content - -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md deleted file mode 100644 index c9b4b6ea644a7..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-a-tree-from-an-xmlreader.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "How to: Create a Tree from an XmlReader" -ms.date: 07/20/2015 -ms.assetid: 6de683d8-177d-402b-b0de-d0539f1ce5d8 ---- -# How to: Create a Tree from an XmlReader (Visual Basic) - -This topic shows how to create an XML tree directly from an . To create an from an , you must position the on an element node. The will skip comments and processing instructions, but if the is positioned on a text node, an error will be thrown. To avoid such errors, always position the on an element before you create an XML tree from the . - -## Example - -This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md). - -The following code creates an `T:System.Xml.XmlReader` object, and then reads nodes until it finds the first element node. It then loads the object. - -```vb -Dim r As XmlReader = XmlReader.Create("books.xml") -Do While r.NodeType <> XmlNodeType.Element - r.Read() -Loop -Dim e As XElement = XElement.Load(r) -Console.WriteLine(e) -``` - -This example produces the following output: - -```xml - - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - - -``` - -## See also - -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md deleted file mode 100644 index 8bc6ba1923026..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-create-hierarchy-using-grouping.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: "How to: Create Hierarchy Using Grouping" -ms.date: 07/20/2015 -ms.assetid: 4eb3ca6b-1aed-43de-b8b9-41c769c993f8 ---- -# How to: Create Hierarchy Using Grouping (Visual Basic) -This example shows how to group data, and then generate XML based on the grouping. - -## Example - This example first groups data by a category, then generates a new XML file in which the XML hierarchy reflects the grouping. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](sample-xml-file-numerical-data-linq-to-xml.md). - -```vb -Dim doc As XElement = XElement.Load("Data.xml") -Dim newData As XElement = _ - - <%= _ - From data In doc. _ - Group By category = data.(0).Value _ - Into groupedData = Group _ - Select > - <%= _ - From g In groupedData _ - Select _ - - <%= g.(0) %> - <%= g.(0) %> - _ - %> - _ - %> - -Console.WriteLine(newData) -``` - - This example produces the following output: - -```xml - - - - 3 - 24.50 - - - 5 - 4.95 - - - 3 - 66.00 - - - 15 - 29.00 - - - - - 1 - 89.99 - - - 10 - .99 - - - 8 - 6.99 - - - -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md deleted file mode 100644 index e93e801e332da..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-debug-empty-query-results-sets.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "How to: Debug Empty Query Results Sets" -ms.date: 07/20/2015 -ms.assetid: b242c90a-d2b8-4309-8a1e-e4e70736c727 ---- -# How to: Debug Empty Query Results Sets (Visual Basic) - -One of the most common problems when querying XML trees is that if the XML tree has a default namespace, the developer sometimes writes the query as though the XML were not in a namespace. - -The first set of examples in this topic shows a typical way that XML in a default namespace is loaded, and is queried improperly. - -The second set of examples show the necessary corrections so that you can query XML in a namespace. - -For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -## Example - -This example shows creation of XML in a namespace, and a query that returns an empty result set. - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - -Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el -Console.WriteLine("Result set follows:") -For Each el As XElement In c1 - Console.WriteLine(el.Value) -Next -Console.WriteLine("End of result set") -``` - -This example produces the following result: - -```console -Result set follows: -End of result set -``` - -## Example - -This example shows creation of XML in a namespace, and a query that is coded properly. - -The solution is to declare and initialize a global default namespace. This places all XML properties in the default namespace. No other modifications are required to the example to make it work properly. - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el - Console.WriteLine("Result set follows:") - For Each el As XElement In c1 - Console.WriteLine(CInt(el)) - Next - Console.WriteLine("End of result set") - End Sub -End Module -``` - -This example produces the following result: - -```console -Result set follows: -1 -2 -3 -End of result set -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md deleted file mode 100644 index 1d6ecec00b7d6..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-attribute-xpath-linq-to-xml.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "How to: Filter on an Attribute (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: ffefb9d6-45ec-4677-a396-dd9c2b36298f ---- -# How to: Filter on an Attribute (XPath-LINQ to XML) (Visual Basic) -This topic shows how to get the descendant elements with a specified name, and with an attribute with a specified value. - - The XPath expression is: - - `.//Address[@Type='Shipping']` - -## Example - This example finds all descendants elements with the name of `Address`, and with a `Type` attribute with a value of "Shipping". - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = _ - From el In po...
_ - Where el.@Type = "Shipping" _ - Select el - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = _ - po.XPathSelectElements(".//Address[@Type='Shipping']") - -If (list1.Count = list2.Count And _ - list1.Intersect(list2).Count() = list1.Count()) Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md deleted file mode 100644 index a059d1f69caab..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-an-optional-element.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "How to: Filter on an Optional Element" -ms.date: 07/20/2015 -ms.assetid: a74b76ad-6889-4185-a189-d6ef2c63841e ---- -# How to: Filter on an Optional Element (Visual Basic) -Sometimes you want to filter for an element even though you are not sure it exists in your XML document. The search should be executed so that if the particular element does not have the child element, you do not trigger a null reference exception by filtering for it. In the following example, the `Child5` element does not have a `Type` child element, but the query still executes correctly. - -## Example - This example uses the extension method. - -```vb -Dim root As XElement = _ - - - Child One Text - - - - Child Two Text - - - - Child Three Text - - - - Child Four Text - - - - Child Five Text - - -Dim cList As IEnumerable(Of String) = _ - From typeElement In root.Elements(). _ - Where typeElement.@Value = "Yes" _ - Select typeElement.Parent..Value -Dim str As String -For Each str In cList - Console.WriteLine(str) -Next -``` - - This code produces the following output: - -```console -Child One Text -Child Two Text -Child Four Text -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - - Child One Text - - - - Child Two Text - - - - Child Three Text - - - - Child Four Text - - - - Child Five Text - - - Dim cList As IEnumerable(Of String) = _ - From typeElement In root.Elements(). _ - Where typeElement.@Value = "Yes" _ - Select typeElement.Parent..Value - Dim str As String - For Each str In cList - Console.WriteLine(str) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -Child One Text -Child Two Text -Child Four Text -``` - -## See also - -- -- -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) -- [XML Child Axis Property](../../../language-reference/xml-axis/xml-child-axis-property.md) -- [XML Attribute Axis Property](../../../language-reference/xml-axis/xml-attribute-axis-property.md) -- [XML Value Property](../../../language-reference/xml-axis/xml-value-property.md) -- [Standard Query Operators Overview (Visual Basic)](standard-query-operators-overview.md) -- [Projection Operations (Visual Basic)](projection-operations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md deleted file mode 100644 index ba0aef3a31283..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-filter-on-element-names-linq-to-xml.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: "How to: Filter on Element Names (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: b1437b4a-48aa-4546-834a-d6d3ab015fe1 ---- -# How to: Filter on Element Names (LINQ to XML) (Visual Basic) -When you call one of the methods that return of , you can filter on the element name. - -## Example - This example retrieves a collection of descendants that is filtered to contain only descendants with the specified name. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Dim po As XElement = XElement.Load("PurchaseOrder.xml") -Dim items As IEnumerable(Of XElement) = _ - From el In po... _ - Select el -For Each prdName As XElement In items - Console.WriteLine(prdName.Name.ToString & ":" & prdName.Value) -Next -``` - - This code produces the following output: - -```console -ProductName:Lawnmower -ProductName:Baby Monitor -``` - - The other methods that return of collections follow the same pattern. Their signatures are similar to and . The following is the complete list of methods that have similar method signatures: - -- - -- - -- - -- - -- - -- - -- - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim po As XElement = XElement.Load("PurchaseOrderInNamespace.xml") - Dim items As IEnumerable(Of XElement) = _ - From el In po... _ - Select el - For Each prdName As XElement In items - Console.WriteLine(prdName.Name.ToString & ":" & prdName.Value) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -{http://www.adventure-works.com}ProductName:Lawnmower -{http://www.adventure-works.com}ProductName:Baby Monitor -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md deleted file mode 100644 index 12aa1ad63dc9f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-child-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "How to: Find a Child Element (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: adb46c98-a650-42e2-b62d-835920fe8421 ---- -# How to: Find a Child Element (XPath-LINQ to XML) (Visual Basic) -This topic compares the XPath child element axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] method. - - The XPath expression is `DeliveryNotes`. - -## Example - This example finds the child element `DeliveryNotes`. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Dim cpo As XDocument = XDocument.Load("PurchaseOrders.xml") -Dim po As XElement = cpo.Root..FirstOrDefault - -'LINQ to XML query -Dim el1 As XElement = po..FirstOrDefault - -' XPath expression -Dim el2 As XElement = po.XPathSelectElement("DeliveryNotes") -' same as "child::DeliveryNotes" -' same as "./DeliveryNotes" - -If el1 Is el2 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(el1) -``` - - This example produces the following output: - -```console -Results are identical -Please leave packages in shed by driveway. -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md deleted file mode 100644 index 8b6650e01136c..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "How to: Find a List of Child Elements (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 2868abfd-9f7b-412a-9cb5-f643f0fed146 ---- -# How to: Find a List of Child Elements (XPath-LINQ to XML) (Visual Basic) -This topic compares the XPath child elements axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axis. - - The XPath expression is: `./*` - -## Example - This example finds all of the child elements of the `Address` element. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Dim cpo As XDocument = XDocument.Load("PurchaseOrders.xml") -Dim po As XElement = cpo.Root..
.FirstOrDefault - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = po.Elements() - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = po.XPathSelectElements("./*") - -If (list1.Count() = list2.Count()) AndAlso _ - (list1.Intersect(list2).Count() = list1.Count()) Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -Ellen Adams -123 Maple Street -Mill Valley -CA -10999 -USA -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md deleted file mode 100644 index f6ec6f779e6d7..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-single-descendant-using-the-descendants-method.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "How to: Find a Single Descendant Using the Descendants Method" -ms.date: 07/20/2015 -ms.assetid: 0c03468c-efc8-4140-98f3-fb67acd9e8e1 ---- -# How to: Find a Single Descendant Using the Descendants Method (Visual Basic) -You can use the axis method to quickly write code to find a single uniquely named element. This technique is especially useful when you want to find a particular descendant with a specific name. You could write the code to navigate to the desired element, but it is often faster and easier to write the code using the axis. - -## Example - This example uses the standard query operator. - -```vb -Dim root As XElement = _ - - - GC1 Value - - - GC2 Value - - - GC3 Value - - - GC4 Value - - -Dim grandChild3 As String = _ - (From el In root... _ - Select el).First() -Console.WriteLine(grandChild3) -``` - - This code produces the following output: - -```console -GC3 Value -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - - GC1 Value - - - GC2 Value - - - GC3 Value - - - GC4 Value - - - Dim grandChild3 As String = _ - (From el In root... _ - Select el).First() - Console.WriteLine(grandChild3) - End Sub -End Module -``` - - This code produces the following output: - -```console -GC3 Value -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath.md deleted file mode 100644 index 601ef3329e8af..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-a-union-of-two-location-paths-xpath.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "How to: Find a Union of Two Location Paths (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: c82c09b4-cb0a-47ec-8cc3-a124144c2788 ---- -# How to: Find a Union of Two Location Paths (XPath-LINQ to XML) (Visual Basic) -XPath allows you to find the union of the results of two XPath location paths. - - The XPath expression is: - - `//Category|//Price` - - You can achieve the same results by using the standard query operator. - -## Example - This example finds all of the `Category` elements and all of the `Price` elements, and concatenates them into a single collection. Note that the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query calls to order the results. The results of the XPath expression evaluation are also in document order. - - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](sample-xml-file-numerical-data-linq-to-xml.md). - -```vb -Dim data As XDocument = XDocument.Load("Data.xml") - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = _ - data....Concat(data...).InDocumentOrder() - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = _ - data.XPathSelectElements("//Category|//Price") - -If list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -A -24.50 -B -89.99 -A -4.95 -A -66.00 -B -.99 -A -29.00 -B -6.99 -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md deleted file mode 100644 index 6b4406944a634..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-all-nodes-in-a-namespace.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: "How to: Find All Nodes in a Namespace" -ms.date: 07/20/2015 -ms.assetid: b735d7da-5727-48a3-ab57-a16378adc32e ---- -# How to: Find All Nodes in a Namespace (Visual Basic) -You can filter on the namespace of each element or attribute to find all nodes in that particular namespace. - -## Example - The following example creates an XML tree with two namespaces. It then iterates through the tree and prints the names of all the elements and attributes in one of those namespaces. - -```vb -Imports -Imports - -Module Module1 - Sub Main() - Dim xmlTree As XElement = _ - - abc - def - ghi - - jkl - mno - - - Console.WriteLine("Nodes in the http://www.adventure-works.com namespace") - Dim awElements As IEnumerable(Of XElement) = _ - From el In xmlTree.Descendants() _ - Where (el.Name.Namespace = GetXmlNamespace(aw)) _ - Select el - For Each el As XElement In awElements - Console.WriteLine(el.Name.ToString()) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -Nodes in the http://www.adventure-works.com namespace -{http://www.adventure-works.com}Child3 -{http://www.adventure-works.com}GrandChild2 -``` - -## Example - The XML file accessed by the following query contains purchase orders in two different namespaces. The query creates a new tree with just the elements in one of the namespaces. - - This example uses the following XML document: [Sample XML File: Consolidated Purchase Orders](sample-xml-file-consolidated-purchase-orders.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim cpo As XDocument = XDocument.Load("ConsolidatedPurchaseOrders.xml") - Dim newTree As XElement = _ - - <%= From el In cpo.Root.Elements() _ - Where el.Name.Namespace = GetXmlNamespace(aw) _ - Select el %> - - Console.WriteLine(newTree) - End Sub -End Module -``` - - This code produces the following output: - -```xml - - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - - -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md deleted file mode 100644 index 1e2cc25a7b7f4..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -title: "How to: Find an Attribute of the Parent (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 9d2572fd-27d4-426c-b079-16854cb9ec7d ---- -# How to: Find an Attribute of the Parent (XPath-LINQ to XML) (Visual Basic) -This topic shows how to navigate to the parent element and find an attribute of it. - - The XPath expression is: - - `../@id` - -## Example - This example first finds an `Author` element. It then finds the `id` attribute of the parent element. - - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md). - -```vb -Dim books As XDocument = XDocument.Load("Books.xml") -Dim author As XElement = books.Root...FirstOrDefault() - -' LINQ to XML query -Dim att1 As XAttribute = author.Parent.Attribute("id") - -' XPath expression -Dim att2 As XAttribute = DirectCast(author.XPathEvaluate("../@id"), _ - IEnumerable).Cast(Of XAttribute)().First() - -If att1 Is att2 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(att1) -``` - - This example produces the following output: - -```console -Results are identical -id="bk101" -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md deleted file mode 100644 index ab39a4ee0ae40..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-attribute.md +++ /dev/null @@ -1,81 +0,0 @@ ---- -title: "How to: Find an Element with a Specific Attribute" -ms.date: 07/20/2015 -ms.assetid: 59fb7c19-d42f-40eb-8cf8-f1d5b9658eb7 ---- -# How to: Find an Element with a Specific Attribute (Visual Basic) -This topic shows how to find an element that has an attribute that has a specific value. - -## Example - The example shows how to find the `Address` element that has a `Type` attribute with a value of "Billing". - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Dim root As XElement = XElement.Load("PurchaseOrder.xml") -Dim address As IEnumerable(Of XElement) = _ - From el In root.
_ - Where el.@Type = "Billing" _ - Select el -For Each el As XElement In address - Console.WriteLine(el) -Next -``` - - This code produces the following output: - -```xml -
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
-``` - - Note that this example uses the [XML Child axis property](../../../language-reference/xml-axis/xml-child-axis-property.md), the [XML Attribute axis property](../../../language-reference/xml-axis/xml-attribute-axis-property.md), and the [XML Value property](../../../language-reference/xml-axis/xml-value-property.md). - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = XElement.Load("PurchaseOrderInNamespace.xml") - Dim address As IEnumerable(Of XElement) = _ - From el In root. _ - Where el.@aw:Type = "Billing" _ - Select el - For Each el As XElement In address - Console.WriteLine(el) - Next - End Sub -End Module -``` - - This code produces the following output: - -```xml - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - -``` - -## See also - -- -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) -- [Standard Query Operators Overview (Visual Basic)](standard-query-operators-overview.md) -- [Projection Operations (Visual Basic)](projection-operations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md deleted file mode 100644 index 8229e4f66e0ef..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-an-element-with-a-specific-child-element.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: "How to: Find an Element with a Specific Child Element" -ms.date: 07/20/2015 -ms.assetid: b0d0a463-6a85-46c3-8453-ad25b0ecf93c ---- -# How to: Find an Element with a Specific Child Element (Visual Basic) -This topic shows how to find a particular element that has a child element with a specific value. - -## Example - The example finds the `Test` element that has a `CommandLine` child element with the value of "Examp2.EXE". - - This example uses the following XML document: [Sample XML File: Test Configuration (LINQ to XML)](sample-xml-file-test-configuration-linq-to-xml.md). - -```vb -Dim root As XElement = XElement.Load("TestConfig.xml") -Dim tests As IEnumerable(Of XElement) = _ - From el In root. _ - Where el..Value = "Examp2.EXE" _ - Select el -For Each el as XElement In tests - Console.WriteLine(el.@TestId) -Next -``` - - This code produces the following output: - -```console -0002 -0006 -``` - - Note that this example uses the [XML Child axis property](../../../language-reference/xml-axis/xml-child-axis-property.md), the [XML Attribute axis property](../../../language-reference/xml-axis/xml-attribute-axis-property.md), and the [XML Value property](../../../language-reference/xml-axis/xml-value-property.md). - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Test Configuration in a Namespace](sample-xml-file-test-configuration-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = XElement.Load("TestConfigInNamespace.xml") - Dim tests As IEnumerable(Of XElement) = _ - From el In root. _ - Where el..Value = "Examp2.EXE" _ - Select el - For Each el As XElement In tests - Console.WriteLine(el.@TestId) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -0002 -0006 -``` - -## See also - -- -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) -- [Standard Query Operators Overview (Visual Basic)](standard-query-operators-overview.md) -- [Projection Operations (Visual Basic)](projection-operations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name.md deleted file mode 100644 index c0ef1fc942272..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-attributes-of-siblings-with-a-specific-name.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "How to: Find Attributes of Siblings with a Specific Name (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 83b3ddca-830a-4b71-9756-9e4bdf907302 ---- -# How to: Find Attributes of Siblings with a Specific Name (XPath-LINQ to XML) (Visual Basic) -This topic shows how to find all attributes of the siblings of the context node. Only attributes with a specific name are returned in the collection. - - The XPath expression is: - - `../Book/@id` - -## Example - This example first finds a `Book` element, and then finds all sibling elements named `Book`, and then finds all attributes named `id`. The result is a collection of attributes. - - This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md). - -```vb -Dim books as XDocument = XDocument.Load("Books.xml") -Dim book As XElement = books.Root.(0) - -' LINQ to XML query -Dim list1 As IEnumerable(Of XAttribute) = _ - From el In book.Parent. _ - Select el.Attribute("id") - -' XPath expression -Dim list2 As IEnumerable(Of XAttribute) = DirectCast(book. _ - XPathEvaluate("../Book/@id"), IEnumerable).Cast(Of XAttribute)() - -If list1.Count() = list2.Count() And _ - (list1.Intersect(list2)).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If - -For Each el As XAttribute In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -id="bk101" -id="bk102" -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position.md deleted file mode 100644 index 5e5b919af2268..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-child-elements-based-on-position.md +++ /dev/null @@ -1,77 +0,0 @@ ---- -title: "How to: Find Child Elements Based on Position (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 6831e1db-5e97-444f-a7a1-d0a87104b005 ---- -# How to: Find Child Elements Based on Position (XPath-LINQ to XML) (Visual Basic) -Sometimes you want to find elements based on their position. You might want to find the second element, or you might want to find the third through the fifth element. - - The XPath expression is: - - `Test[position() >= 2 and position() <= 4]` - - There are two approaches to writing this [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query in a lazy way. You can use the and operators, or you can use the overload that takes an index. When you use the overload, you use a lambda expression that takes two arguments. The following example shows both methods of selecting based on position. - -## Example - This example finds the second through the fourth `Test` element. The result is a collection of elements. - - This example uses the following XML document: [Sample XML File: Test Configuration (LINQ to XML)](sample-xml-file-test-configuration-linq-to-xml.md). - -```vb -Dim testCfg As XElement = XElement.Load("TestConfig.xml") - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = _ - testCfg.Elements("Test").Skip(1).Take(3) - -'LINQ to XML query -Dim list2 As IEnumerable(Of XElement) = _ - testCfg.Elements("Test"). _ - Where(Function(ByVal el, ByVal idx) idx >= 1 And idx <= 3) - -' XPath expression -Dim list3 As IEnumerable(Of XElement) = _ - testCfg.XPathSelectElements("Test[position() >= 2 and position() <= 4]") - -If list1.Count() = list2.Count() And _ - list1.Count() = list3.Count() And _ - list1.Intersect(list2).Count() = list1.Count() And _ - list1.Intersect(list3).Count() = list1.Count() Then - - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If - -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md deleted file mode 100644 index 7277441a68b6b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendant-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "How to: Find Descendant Elements (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: e7e2dc9e-bda9-420d-a5b1-4fabf1cca46b ---- -# How to: Find Descendant Elements (XPath-LINQ to XML) (Visual Basic) -This topic shows how to get the descendant elements with a particular name. - - The XPath expression is `//Name`. - -## Example - This example finds all descendants named `Name`. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb - Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = po... - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = po.XPathSelectElements("//Name") - -If (list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count()) Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -Ellen Adams -Tai Yee -Cristian Osorio -Cristian Osorio -Jessica Arnold -Jessica Arnold -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md deleted file mode 100644 index fc3dbf9a26250..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "How to: Find Descendants of a Child Element (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: a958af40-f754-4409-85f9-7746978d4cb3 ---- -# How to: Find Descendants of a Child Element (XPath-LINQ to XML) (Visual Basic) -This topic shows how to get the descendant elements of a child element with a particular name. - - The XPath expression is: - - `./Paragraph//Text/text()` - -## Example - This example simulates the problems of extracting text from an XML representation of a word processing document. It first selects all `Paragraph` elements, and then it selects all `Text` descendant elements of each `Paragraph` element. This doesn't select the descendant `Text` elements of the `Comment` element. - -```vb -Dim root As XElement = _ - - - This is the start of - - - This comment is not part of the paragraph text. - - - - a sentence. - - - - This is a second sentence. - - - -' LINQ to XML query -Dim str1 As String = _ - root.....Select(Function(ByVal s) s.Value). _ - Aggregate( _ - New StringBuilder(), _ - Function(ByVal s, ByVal i) s.Append(i), _ - Function(ByVal s) s.ToString()) - -' XPath expression -Dim str2 As String = DirectCast(root.XPathEvaluate("./Paragraph//Text/text()"), IEnumerable) _ - .Cast(Of XText)().Select(Function(ByVal s) s.Value) _ - .Aggregate( _ - New StringBuilder(), _ - Function(ByVal s, ByVal i) s.Append(i), _ - Function(ByVal s) s.ToString()) - -If str1 = str2 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(str2) -``` - - This example produces the following output: - -```console -Results are identical -This is the start of a sentence. This is a second sentence. -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md deleted file mode 100644 index 7e0a8261ed1b1..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-descendants-with-a-specific-element-name.md +++ /dev/null @@ -1,100 +0,0 @@ ---- -title: "How to: Find Descendants with a Specific Element Name" -ms.date: 07/20/2015 -ms.assetid: 78915518-0d25-4051-ab55-929779989510 ---- -# How to: Find Descendants with a Specific Element Name (Visual Basic) -Sometimes you want to find all descendants with a particular name. You could write code to iterate through all of the descendants, but it is easier to use the axis. - -## Example - The following example shows how to find descendants based on the element name. - -```vb -Dim root As XElement = _ - - - - Some text - - - - that is broken up into - - - - - multiple segments. - - - - - -Dim textSegs As IEnumerable(Of String) = _ - From seg In root... _ - Select seg.Value - -Dim str As String = textSegs.Aggregate( _ - New StringBuilder, _ - Function(sb, i) sb.Append(i), _ - Function(sb) sb.ToString) - -Console.WriteLine(str) -``` - - This code produces the following output: - -```console -Some text that is broken up into multiple segments. -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - - - Some text - - - - that is broken up into - - - - - multiple segments. - - - - - - Dim textSegs As IEnumerable(Of String) = _ - From seg In root... _ - Select seg.Value - - Dim str As String = textSegs.Aggregate( _ - New StringBuilder, _ - Function(sb, i) sb.Append(i), _ - Function(sb) sb.ToString) - - Console.WriteLine(str) - End Sub -End Module -``` - - This code produces the following output: - -```console -Some text that is broken up into multiple segments. -``` - -## See also - -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace.md deleted file mode 100644 index a38085a8e20da..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-in-a-namespace.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "How to: Find Elements in a Namespace (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: c7cb3b77-3424-4b54-9efa-4dc715948e41 ---- -# How to: Find Elements in a Namespace (XPath-LINQ to XML) (Visual Basic) -XPath expressions can find nodes in a particular namespace. XPath expressions use namespace prefixes for specifying namespaces. To parse an XPath expression that contains namespace prefixes, you must pass an object to the XPath methods that implements . This example uses . - - The XPath expression is: - - `./aw:*` - -## Example - The following example reads an XML tree that contains two namespaces. It uses an to read the XML document. It then gets an from the , and an from the . It uses the when selecting elements. - -```vb -Dim reader As XmlReader = _ - XmlReader.Create("ConsolidatedPurchaseOrders.xml") -Dim root As XElement = XElement.Load(reader) -Dim nameTable As XmlNameTable = reader.NameTable -Dim namespaceManager As XmlNamespaceManager = New XmlNamespaceManager(nameTable) -namespaceManager.AddNamespace("aw", "http://www.adventure-works.com") - -Dim list1 As IEnumerable(Of XElement) = _ - root.XPathSelectElements("./aw:*", namespaceManager) -Dim list2 As IEnumerable(Of XElement) = _ - From el In root.Elements() _ - Where el.Name.Namespace = "http://www.adventure-works.com" _ - Select el - -If list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list2 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute.md deleted file mode 100644 index af4865558d333..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-elements-with-a-specific-attribute.md +++ /dev/null @@ -1,58 +0,0 @@ ---- -title: "How to: Find Elements with a Specific Attribute (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 4bb38d2c-bc7c-4196-8909-aaf41fb86b28 ---- -# How to: Find Elements with a Specific Attribute (XPath-LINQ to XML) (Visual Basic) -Sometimes you want to find all elements that have a specific attribute. You are not concerned about the contents of the attribute. Instead, you want to select based on the existence of the attribute. - - The XPath expression is: - - `./*[@Select]` - -## Example - The following code selects just the elements that have the `Select` attribute. - -```vb -Dim doc As XElement = _ - - 1 - 2 - 3 - 4 - 5 - - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = _ - From el In doc.Elements() _ - Where el.@Select <> Nothing _ - Select el - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = DirectCast(doc.XPathEvaluate _ - ("./*[@Select]"), IEnumerable).Cast(Of XElement)() - -If list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If - -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -2 -4 -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md deleted file mode 100644 index 9baca270613a2..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-preceding-siblings-xpath-linq-to-xml.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "How to: Find Preceding Siblings (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 59055718-d0a7-4db3-8901-18dd33587703 ---- -# How to: Find Preceding Siblings (XPath-LINQ to XML) (Visual Basic) -This topic compares the XPath `preceding-sibling` axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] child axis. - - The XPath expression is: - - `preceding-sibling::*` - - Note that the results of both and are in document order. - -## Example - The following example finds the `FullAddress` element, and then retrieves the previous elements using the `preceding-sibling` axis. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim co As XElement = XElement.Load("CustomersOrders.xml") -Dim add As XElement = co... _ - .FirstOrDefault - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = add.ElementsBeforeSelf() - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = add.XPathSelectElements("preceding-sibling::*") - -If list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list2 - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```console -Results are identical -Great Lakes Food Market -Howard Snyder -Marketing Manager -(503) 555-7555 -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md deleted file mode 100644 index 6b4ea403eec0a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-related-elements-xpath-linq-to-xml.md +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: "How to: Find Related Elements (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 6b0ef058-d704-48a5-98cd-33f00d088af9 ---- -# How to: Find Related Elements (XPath-LINQ to XML) (Visual Basic) -This topic shows how to get an element selecting on an attribute that is referred to by the value of another element. - - The XPath expression is: - - `.//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]` - -## Example - This example finds the 12th `Order` element, and then finds the customer for that order. - - Note that indexing into a list in .NET is 'zero' based. Indexing into a collection of nodes in an XPath predicate is 'one' based. This example reflects this difference. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim co As XDocument = XDocument.Load("CustomersOrders.xml") - -' LINQ to XML query -Dim customer1 As XElement = ( _ - From el In co... _ - Where el.@CustomerID = co.... _ - ToList()(11).(0).Value _ - Select el).First() - -' An alternate way to write the query that avoids creation -' of a System.Collections.Generic.List: -Dim customer2 As XElement = ( _ - From el In co... _ - Where el.@CustomerID = co.... _ - Skip(11).First().(0).Value _ - Select el).First() - -' XPath expression -Dim customer3 As XElement = co.XPathSelectElement _ - (".//Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]") - -If customer1 Is customer2 And customer1 Is customer3 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(customer1) -``` - - This example produces the following output: - -```console -Results are identical - - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
-``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md deleted file mode 100644 index 53b5b182a1954..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-sibling-nodes-xpath-linq-to-xml.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "How to: Find Sibling Nodes (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 73082738-2113-4438-8545-98d5df0927cb ---- -# How to: Find Sibling Nodes (XPath-LINQ to XML) (Visual Basic) - -You might want to find all siblings of a node that have a specific name. The resulting collection might include the context node if the context node also has the specific name. - -The XPath expression is: - -`../Book` - -## Example - -This example first finds a `Book` element, and then finds all sibling elements named `Book`. The resulting collection includes the context node. - -This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md). - -```vb -Dim books As XDocument = XDocument.Load("Books.xml") -Dim book As XElement = books.Root..Skip(1).First() - -' LINQ to XML query -Dim list1 As IEnumerable(Of XElement) = book.Parent. - -' XPath expression -Dim list2 As IEnumerable(Of XElement) = book.XPathSelectElements("../Book") - -If list1.Count() = list2.Count() And _ - list1.Intersect(list2).Count() = list1.Count() Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -For Each el As XElement In list1 - Console.WriteLine(el) -Next -``` - -This example produces the following output: - -```console -Results are identical - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md deleted file mode 100644 index 8d8f5d9f53b9f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "How to: Find the Immediate Preceding Sibling (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: ec046283-9fe2-4440-b295-860bf700099d ---- -# How to: Find the Immediate Preceding Sibling (XPath-LINQ to XML) (Visual Basic) - -Sometimes you want to find the immediate preceding sibling to a node. Due to the difference in the semantics of positional predicates for the preceding sibling axes in XPath as opposed to [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], this is one of the more interesting comparisons. - -## Example - -In this example, the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query uses the operator to find the last node in the collection returned by . By contrast, the XPath expression uses a predicate with a value of 1 to find the immediately preceding element. - -```vb -Dim root As XElement = _ - - - - - - -Dim child4 As XElement = root.Element("Child4") - -' LINQ to XML query -Dim el1 As XElement = child4.ElementsBeforeSelf().Last() - -' XPath expression -Dim el2 As XElement = _ - DirectCast(child4.XPathEvaluate("preceding-sibling::*[1]"), _ - IEnumerable).Cast(Of XElement)().First() - -If el1 Is el2 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(el1) -``` - -This example produces the following output: - -```console -Results are identical - -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md deleted file mode 100644 index 97808c5ddc307..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-find-the-root-element-xpath-linq-to-xml.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "How to: Find the Root Element (XPath-LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 72c3aed5-9522-4454-a876-2070aad13f2e ---- -# How to: Find the Root Element (XPath-LINQ to XML) (Visual Basic) -This topic shows how to get the root element with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - The XPath expression is: - - `/PurchaseOrders` - -## Example - This example finds the root element. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Dim po As XDocument = XDocument.Load("PurchaseOrders.xml") - -' LINQ to XML query -Dim el1 As XElement = po.Root - -' XPath expression -Dim el2 As XElement = po.XPathSelectElement("/PurchaseOrders") - -If el1 Is el2 Then - Console.WriteLine("Results are identical") -Else - Console.WriteLine("Results differ") -End If -Console.WriteLine(el1.Name) -``` - - This example produces the following output: - -```console -Results are identical -PurchaseOrders -``` - -## See also - -- [LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md deleted file mode 100644 index ae4fc6883a905..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-text-files-from-xml.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "How to: Generate Text Files from XML" -ms.date: 07/20/2015 -ms.assetid: 3b33f191-4abe-4419-b81b-3cb81d9a317f ---- -# How to: Generate Text Files from XML (Visual Basic) -This example shows how to generate a comma-separated values (CSV) file from an XML file. - -## Example - The Visual Basic version uses procedural code to aggregate the collection of strings into a single string. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") -Dim strCollection As IEnumerable(Of String) = _ - From el In custOrd.. _ - Select _ - String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}{10}", _ - el.@CustomerID, _ - el..Value, _ - el..Value, _ - el..Value, _ - el..Value, _ - el..
.Value, _ - el...Value, _ - el...Value, _ - el...Value, _ - el...Value, _ - Environment.NewLine _ - ) -Dim sb As StringBuilder = New StringBuilder() -For Each str As String In strCollection - sb.Append(str) -Next -Console.WriteLine(sb.ToString()) -``` - - This code produces the following output: - -```console -GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA -HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA -LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA -LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md deleted file mode 100644 index 78cd74f04f33a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-generate-xml-from-csv-files.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: "How to: Generate XML from CSV Files" -ms.date: 07/20/2015 -ms.assetid: fe4dbc87-7b0d-40bf-88c3-5d706ee89a4d ---- -# How to: Generate XML from CSV Files (Visual Basic) -This example shows how to use Language-Integrated Query (LINQ) and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to generate an XML file from a comma-separated value (CSV) file. - -## Example - The following code performs a LINQ query on an array of strings. - -```vb - ' Create the text file. -Dim csvString As String = "GREAL,Great Lakes Food Market,Howard Snyder,Marketing Manager,(503) 555-7555,2732 Baker Blvd.,Eugene,OR,97403,USA" & vbCrLf & _ - "HUNGC,Hungry Coyote Import Store,Yoshi Latimer,Sales Representative,(503) 555-6874,City Center Plaza 516 Main St.,Elgin,OR,97827,USA" & vbCrLf & _ - "LAZYK,Lazy K Kountry Store,John Steel,Marketing Manager,(509) 555-7969,12 Orchestra Terrace,Walla Walla,WA,99362,USA" & vbCrLf & _ - "LETSS,Let's Stop N Shop,Jaime Yorres,Owner,(415) 555-5938,87 Polk St. Suite 5,San Francisco,CA,94117,USA" -File.WriteAllText("cust.csv", csvString) - -' Read into an array of strings. -Dim source As String() = File.ReadAllLines("cust.csv") -Dim cust As XElement = _ - - <%= From strs In source _ - Let fields = Split(strs, ",") _ - Select _ - > - <%= fields(1) %> - <%= fields(2) %> - <%= fields(3) %> - <%= fields(4) %> - -
<%= fields(5) %>
- <%= fields(6) %> - <%= fields(7) %> - <%= fields(8) %> - <%= fields(9) %> -
-
_ - %> -
-Console.WriteLine(cust) -``` - - This code produces the following output: - -```xml - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
-``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md deleted file mode 100644 index 865a7d5f490ff..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-join-two-collections-linq-to-xml.md +++ /dev/null @@ -1,134 +0,0 @@ ---- -title: "How to: Join Two Collections (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 5a5758d4-906b-4285-908d-5b930db192e6 ---- -# How to: Join Two Collections (LINQ to XML) (Visual Basic) -An element or attribute in an XML document can sometimes refer to another element or attribute. For example, the [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md) XML document contains a list of customers and a list of orders. Each `Customer` element contains a `CustomerID` attribute. Each `Order` element contains a `CustomerID` element. The `CustomerID` element in each order refers to the `CustomerID` attribute in a customer. - - The topic [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - - With [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can take advantage of this relationship by using the `Join` clause. - - Note that because there is no index available, such joining will have poor runtime performance. - - For more detailed information about `Join`, see [Join Operations (Visual Basic)](join-operations.md). - -## Example - The following example joins the `Customer` elements to the `Order` elements, and generates a new XML document that includes the `CompanyName` element in the orders. - - Before executing the query, the example validates that the document complies with the schema in [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md). This ensures that the join clause will always work. - - This query first retrieves all `Customer` elements, and then joins them to the `Order` elements. It selects only the orders for customers with a `CustomerID` greater than "K". It then projects a new `Order` element that contains the customer information within each order. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - - This example uses the following XSD schema: [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md). - - Note that joining in this fashion will not perform very well. Joins are performed via a linear search. There are no hash tables or indexes to help with performance. - -```vb -Public Class Program - Public Shared errors As Boolean = False - - Public Shared Function LamValidEvent(ByVal o As Object, _ - ByVal e As ValidationEventArgs) As Boolean - Console.WriteLine("{0}", e.Message) - errors = True - End Function - - Shared Sub Main() - Dim schemas As New XmlSchemaSet() - schemas.Add("", "CustomersOrders.xsd") - - Console.Write("Attempting to validate, ") - Dim custOrdDoc As XDocument = XDocument.Load("CustomersOrders.xml") - - custOrdDoc.Validate(schemas, Function(o, e) LamValidEvent(0, e)) - If errors Then - Console.WriteLine("custOrdDoc did not validate") - Else - Console.WriteLine("custOrdDoc validated") - End If - - If Not errors Then - 'Join customers and orders, and create a new XML document with - ' a different shape. - 'The new document contains orders only for customers with a - ' CustomerID > 'K'. - Dim custOrd As XElement = custOrdDoc..FirstOrDefault - Dim newCustOrd As XElement = _ - - <%= From c In custOrd.. _ - Join o In custOrd.. _ - On c.@CustomerID Equals o..Value _ - Where c.@CustomerID.CompareTo("K") > 0 _ - Select _ - - <%= c.@CustomerID %> - <%= c. %> - <%= c. %> - <%= o. %> - <%= o. %> - _ - %> - - Console.WriteLine(newCustOrd) - End If - End Sub -End Class -``` - - This code produces the following output: - -```console -Attempting to validate, custOrdDoc validated - - - LAZYK - Lazy K Kountry Store - John Steel - 1 - 1997-03-21T00:00:00 - - - LAZYK - Lazy K Kountry Store - John Steel - 8 - 1997-05-22T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 1 - 1997-06-25T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 8 - 1997-10-27T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 6 - 1997-11-10T00:00:00 - - - LETSS - Let's Stop N Shop - Jaime Yorres - 4 - 1998-02-12T00:00:00 - - -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md deleted file mode 100644 index 3d8772999bebf..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-list-all-nodes-in-a-tree.md +++ /dev/null @@ -1,262 +0,0 @@ ---- -title: "How to: List All Nodes in a Tree" -ms.date: 07/20/2015 -ms.assetid: e19289c4-26d1-435b-b0db-fb8bc856b753 ---- -# How to: List All Nodes in a Tree (Visual Basic) -Sometimes it is helpful to list all nodes in a tree. This can be useful when learning exactly how a method or property affects the tree. One approach to listing all nodes in a textual form is to generate an XPath expression that exactly and specifically identifies any node in the tree. - - It is not particularly helpful to execute XPath expressions using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. XPath expressions have poorer performance than [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries, and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries are much more powerful. However, as a way to identify nodes in the XML tree, XPath works well. - -## Example - This example shows an function named `GetXPath` that generates a specific XPath expression for any node in the XML tree. It generates appropriate XPath expressions even when nodes are in a namespace. The XPath expressions are generated by using namespace prefixes. - - The example then creates a small XML tree that contains an example of several types of nodes. It then iterates through the descendant nodes and prints the XPath expression for each node. - - You will notice that the XML declaration is not a node in the tree. - - The following is an XML file that contains several types of nodes: - -```xml - - - - - Text - Other Text - textBoldTextotherText - - - - -``` - - The following is the list of nodes in the above XML tree, expressed as XPath expressions: - -```console -/processing-instruction() -/Root -/Root/@AttName -/Root/@xmlns:aw -/Root/comment() -/Root/Child[1] -/Root/Child[1]/text() -/Root/Child[2] -/Root/Child[2]/text() -/Root/ChildWithMixedContent -/Root/ChildWithMixedContent/text()[1] -/Root/ChildWithMixedContent/b -/Root/ChildWithMixedContent/b/text() -/Root/ChildWithMixedContent/text()[2] -/Root/aw:ElementInNamespace -/Root/aw:ElementInNamespace/aw:ChildInNamespace -``` - -```vb -Module Module1 - _ - Private Function StrCat(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Return _ - source.Aggregate(New StringBuilder(), _ - Function(sb, i) sb _ - .Append(i.ToString()) _ - .Append(separator), _ - Function(s) s.ToString()) - End Function - - _ - Public Function GetXPath(ByVal xobj As XObject) As String - Dim retStr As String - If xobj.Parent Is Nothing Then - Dim doc As XDocument = TryCast(xobj, XDocument) - If doc IsNot Nothing Then - Return "." - End If - Dim el As XElement = TryCast(xobj, XElement) - If el IsNot Nothing Then - Return ("/" & NameWithPredicate(el)) - End If - - ' The XPath data model does not include white space text nodes - ' that are children of a document, so this method returns null. - Dim xt As XText = TryCast(xobj, XText) - If xt IsNot Nothing Then - Return Nothing - End If - Dim com As XComment = TryCast(xobj, XComment) - If com IsNot Nothing Then - If com.Document().Nodes().OfType(Of XComment)().Count() <> 1 Then - Return "/comment()[" & (com.NodesBeforeSelf().OfType _ - (Of XComment)().Count() + 1) & "]" - Else - Return "/comment()" - End If - End If - - Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) - If pi IsNot Nothing Then - If pi.Document.Nodes().OfType(Of XProcessingInstruction)(). _ - Count() <> 1 Then - Return "/processing-instruction()[" & _ - (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)() _ - .Count() + 1) & "]" - Else - Return "/processing-instruction()" - End If - End If - Else - Dim el As XElement = TryCast(xobj, XElement) - If el IsNot Nothing Then - Return "/" & el.Ancestors().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)) _ - .StrCat("/") & NameWithPredicate(el) - End If - - Dim at As XAttribute = TryCast(xobj, XAttribute) - If at IsNot Nothing Then - Return "/" & at.Parent().AncestorsAndSelf().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)).StrCat("/") & _ - "@" & GetQName(at) - End If - - Dim com As XComment = TryCast(xobj, XComment) - If com IsNot Nothing Then - retStr = "/" & com.Parent.AncestorsAndSelf().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)).StrCat("/") & "comment()" - If com.Parent().Nodes().OfType(Of XComment)().Count() <> 1 Then - retStr &= "[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]" - End If - Return retStr - End If - - Dim cd As XCData = TryCast(xobj, XCData) - If cd IsNot Nothing Then - retStr = "/" & cd.Parent.AncestorsAndSelf().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)).StrCat("/") & "text()" - If cd.Parent.Nodes().OfType(Of XText)().Count() <> 1 Then - retStr &= "[" & (cd.NodesBeforeSelf().OfType(Of XText)(). _ - Count() + 1) & "]" - End If - Return retStr - End If - - Dim tx As XText = TryCast(xobj, XText) - If tx IsNot Nothing Then - retStr = "/" & tx.Parent.AncestorsAndSelf().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)).StrCat("/") & "text()" - If tx.Parent.Nodes().OfType(Of XText)().Count() <> 1 Then - retStr &= "[" & (tx.NodesBeforeSelf().OfType(Of XText)(). _ - Count() + 1) & "]" - End If - Return retStr - End If - - Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) - If pi IsNot Nothing Then - retStr = "/" & pi.Parent.AncestorsAndSelf().InDocumentOrder(). _ - Select(Function(e) NameWithPredicate(e)). _ - StrCat("/") & "processing-instruction()" - If pi.Parent.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1 Then - retStr &= "[" & (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)(). _ - Count() + 1) & "]" - End If - End If - End If - Return Nothing - End Function - - Private Function GetQName(ByVal xe As XElement) As String - Dim prefix As String = xe.GetPrefixOfNamespace(xe.Name.Namespace) - If xe.Name.Namespace = XNamespace.None Or prefix Is Nothing Then - Return xe.Name.LocalName.ToString() - Else - Return prefix + ":" & xe.Name.LocalName.ToString() - End If - End Function - - Private Function GetQName(ByVal xa As XAttribute) As String - Dim prefix As String = _ - xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace) - If xa.Name.Namespace = XNamespace.None Or prefix Is Nothing Then - Return xa.Name.ToString() - Else - Return prefix + ":" & xa.Name.LocalName - End If - End Function - - Public Function NameWithPredicate(ByVal el As XElement) As String - If el.Parent IsNot Nothing AndAlso el.Parent.Elements(el.Name).Count() <> 1 Then - Return GetQName(el) + "[" & _ - (el.ElementsBeforeSelf(el.Name).Count() + 1) & "]" - Else - Return GetQName(el) - End If - End Function - - Sub Main() - Dim aw As XNamespace = "http://www.adventure-works.com" - Dim doc As XDocument = _ - - - - - Text - Other Text - textBoldTextotherText - - - - - doc.Save("Test.xml") - Console.WriteLine(File.ReadAllText("Test.xml")) - Console.WriteLine("------") - For Each obj As XObject In doc.DescendantNodes() - Console.WriteLine(obj.GetXPath()) - Dim el As XElement = TryCast(obj, XElement) - If el IsNot Nothing Then - For Each at As XAttribute In el.Attributes() - Console.WriteLine(at.GetXPath()) - Next - End If - Next - End Sub -End Module -``` - - This example produces the following output: - -```xml - - - - - Text - Other Text - textBoldTextotherText - - - - ------- -/processing-instruction() -/Root -/Root/@AttName -/Root/@xmlns:aw -/Root/comment() -/Root/Child[1] -/Root/Child[1]/text() -/Root/Child[2] -/Root/Child[2]/text() -/Root/ChildWithMixedContent -/Root/ChildWithMixedContent/text()[1] -/Root/ChildWithMixedContent/b -/Root/ChildWithMixedContent/b/text() -/Root/ChildWithMixedContent/text()[2] -/Root/aw:ElementInNamespace -/Root/aw:ElementInNamespace/aw:ChildInNamespace -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md deleted file mode 100644 index 7fed65d995e19..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-load-xml-from-a-file.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -title: "How to: Load XML from a File" -ms.date: 07/20/2015 -ms.assetid: e2d337ad-8ac8-4671-b694-30e5ca1413b7 ---- -# How to: Load XML from a File (Visual Basic) - -This topic shows how to load XML from a URI by using the method. - -## Example - -The following example shows how to load an XML document from a file. The following example loads books.xml and outputs the XML tree to the console. - -This example uses the following XML document: [Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md). - -```vb -Dim booksFromFile As XElement = XElement.Load("books.xml") -Console.WriteLine(booksFromFile) -``` - -This code produces the following output: - -```xml - - - Garghentini, Davide - XML Developer's Guide - Computer - 44.95 - 2000-10-01 - An in-depth look at creating applications - with XML. - - - Garcia, Debra - Midnight Rain - Fantasy - 5.95 - 2000-12-16 - A former architect battles corporate zombies, - an evil sorceress, and her own childhood to become queen - of the world. - - -``` - -## See also - -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md deleted file mode 100644 index f6d2ce93d0a15..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-modify-an-office-open-xml-document.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -title: "How to: Modify an Office Open XML Document" -ms.date: 07/20/2015 -ms.assetid: 1cefd7f5-8e39-44c4-869c-f8021538a777 ---- -# How to: Modify an Office Open XML Document (Visual Basic) -This topic presents an example that opens an Office Open XML document, modifies it, and saves it. - - For more information on Office Open XML, see [Eric White's Blog](http://www.ericwhite.com). - -## Example - This example finds the first paragraph element in the document. It retrieves the text from the paragraph, and then deletes all text runs in the paragraph. It creates a new text run that consists of the first paragraph text that has been converted to upper case. It then serializes the changed XML into the Open XML package and closes it. - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - Public Function ParagraphText(ByVal e As XElement) As String - Dim w As XNamespace = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ - ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.ReadWrite) - Dim docPackageRelationship As PackageRelationship = wdPackage _ - .GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", _ - UriKind.Relative), docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - Dim xDoc As XDocument = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = documentPart _ - .GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - Dim stylePart As PackagePart = Nothing - Dim styleDoc As XDocument = Nothing - - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = PackUriHelper.ResolvePartUri( _ - documentUri, styleRelation.TargetUri) - stylePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - - Dim paraNode As XElement = xDoc.Root.....FirstOrDefault() - - Dim paraText As String = ParagraphText(paraNode) - - ' Remove all text runs. - paraNode....Remove() - - paraNode.Add(<%= paraText.ToUpper() %>) - - ' Save the XML into the package. - Using xw As XmlWriter = _ - XmlWriter.Create(documentPart.GetStream(FileMode.Create, FileAccess.Write)) - xDoc.Save(xw) - End Using - - Console.WriteLine("New first paragraph: >{0}<", paraText.ToUpper()) - End If - End Using - End Sub -End Module -``` - - If you open `SampleDoc.docx` after running this program, you can see that this program converted the first paragraph in the document to upper case. - - When run with the sample Open XML document described in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md), this example produces the following output: - -```console -New first paragraph: >PARSING WORDPROCESSINGML WITH LINQ TO XML< -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-parse-a-string.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-parse-a-string.md deleted file mode 100644 index e20932820e757..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-parse-a-string.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "How to: Parse a String" -ms.date: 07/20/2015 -ms.assetid: 896e1b4b-f9bd-4975-8bc1-55b6badce1ac ---- -# How to: Parse a String (Visual Basic) -This topic shows how to create an XML tree in C#. - -## Example - You can parse a string in Visual Basic by using the `XElement.Parse` method. However, it is more efficient to use XML literals, as shown in following code, because XML literals do not suffer from the same performance penalties as parsing XML from a string. - - By using XML literals, you can just copy and paste your XML into your Visual Basic program. - -> [!NOTE] -> Parsing text or loading an XML document from a text file is less efficient than functional construction. If you are initializing an XML tree from code, it takes less processor time to use functional construction than to parse text. - -```vb -Dim contacts as XElement = _ - - - Patrick Hines - 206-555-0144 - 425-555-0145 -
- 123 Main St - Mercer Island - WA - 68042 -
- 10 -
- - Gretchen Rivas - 206-555-0163 -
- 123 Main St - Mercer Island - WA - 68042 -
- 11 -
-
-``` - -## See also - -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md deleted file mode 100644 index 77220283e8c77..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-perform-streaming-transform-of-large-xml-documents.md +++ /dev/null @@ -1,438 +0,0 @@ ---- -title: "How to: Perform Streaming Transform of Large XML Documents" -ms.date: 07/20/2015 -ms.assetid: 3d954cc9-4b3c-4b47-8132-ff7541cff53b ---- -# How to: Perform Streaming Transform of Large XML Documents (Visual Basic) -Sometimes you have to transform large XML files, and write your application so that the memory footprint of the application is predictable. If you try to populate an XML tree with a very large XML file, your memory usage will be proportional to the size of the file (that is, excessive). Therefore, you should use a streaming technique instead. - - Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. Note that if you use a query operator that materializes its source before yielding the first item, you will not retain a small memory footprint for your application. - - Even if you use the technique described in [How to: Stream XML Fragments with Access to Header Information (Visual Basic)](how-to-stream-xml-fragments-with-access-to-header-information.md), if you try to assemble an XML tree that contains the transformed document, memory usage will be too great. - - There are two main approaches. One approach is to use the deferred processing characteristics of . Another approach is to create an , and use the capabilities of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to write elements to an . This topic demonstrates both approaches. - -## Example - The following example builds on the example in [How to: Stream XML Fragments with Access to Header Information (Visual Basic)](how-to-stream-xml-fragments-with-access-to-header-information.md). - - This example uses the deferred execution capabilities of to stream the output. This example can transform a very large document while maintaining a small memory footprint. - - Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would be prepared to parse an invalid document. - - The following is the source document, Source.xml: - -```xml - - - - A. Datum Corporation - - 0001 - - - 0002 - - - 0003 - - - 0004 - - - - Fabrikam, Inc. - - 0005 - - - 0006 - - - 0007 - - - 0008 - - - - Southridge Video - - 0009 - - - 0010 - - - -``` - -```vb -Module Module1 - Sub Main() - Dim root = New XStreamingElement("Root", - From el In New StreamCustomerItem("Source.xml") - Select - <%= el.Parent..Value %> - <%= el. %> - - ) - root.Save("Test.xml") - Console.WriteLine(My.Computer.FileSystem.ReadAllText("Test.xml")) - End Sub -End Module - -Public Class StreamCustomerItem - Implements IEnumerable(Of XElement) - - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - End Sub - - Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator - Return New StreamCustomerItemEnumerator(_uri) - End Function - - Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator - Return Me.GetEnumerator() - End Function -End Class - -Public Class StreamCustomerItemEnumerator - Implements IEnumerator(Of XElement) - - Private _current As XElement - Private _customerName As String - Private _reader As Xml.XmlReader - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - - Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current - Get - Return _current - End Get - End Property - - Public ReadOnly Property Current1 As Object Implements IEnumerator.Current - Get - Return Me.Current - End Get - End Property - - Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext - Dim item As XElement - Dim name As XElement - - ' Parse the file, save header information when encountered, and return the - ' current Item XElement. - - ' loop through Customer elements - While _reader.Read() - If _reader.NodeType = Xml.XmlNodeType.Element Then - Select Case _reader.Name - Case "Customer" - ' move to Name element - While _reader.Read() - - If _reader.NodeType = Xml.XmlNodeType.Element AndAlso - _reader.Name = "Name" Then - - name = TryCast(XElement.ReadFrom(_reader), XElement) - _customerName = If(name IsNot Nothing, name.Value, "") - Exit While - End If - - End While - Case "Item" - item = TryCast(XElement.ReadFrom(_reader), XElement) - Dim tempRoot = - <%= _customerName %> - <%= item %> - - _current = item - Return True - End Select - End If - End While - - Return False - End Function - - Public Sub Reset() Implements IEnumerator.Reset - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - -#Region "IDisposable Support" - Private disposedValue As Boolean ' To detect redundant calls - - ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - _reader.Close() - End If - End If - Me.disposedValue = True - End Sub - - Public Sub Dispose() Implements IDisposable.Dispose - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - -End Class -``` - - This code produces the following output: - -```xml - - - - A. Datum Corporation - 0001 - - - A. Datum Corporation - 0002 - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - - Fabrikam, Inc. - 0008 - - - Southridge Video - 0009 - - - Southridge Video - 0010 - - -``` - -## Example - The following example also builds on the example in [How to: Stream XML Fragments with Access to Header Information (Visual Basic)](how-to-stream-xml-fragments-with-access-to-header-information.md). - - This example uses the capability of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to write elements to an . This example can transform a very large document while maintaining a small memory footprint. - - Note that the custom axis (`StreamCustomerItem`) is specifically written so that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the following Source.xml document. A more robust implementation, however, would either validate the source document with an XSD, or would be prepared to parse an invalid document. - - This example uses the same source document, Source.xml, as the previous example in this topic. It also produces exactly the same output. - - Using for streaming the output XML is preferred over writing to an . - -```vb -Module Module1 - Sub Main() - Dim srcTree = - From el In New StreamCustomerItem("Source.xml") - Select - <%= el.Parent..Value %> - <%= el. %> - - - Dim xws = New Xml.XmlWriterSettings() - xws.OmitXmlDeclaration = True - xws.Indent = True - Using xw = Xml.XmlWriter.Create("Output.xml", xws) - xw.WriteStartElement("Root") - For Each el In srcTree - el.WriteTo(xw) - Next - xw.WriteEndElement() - End Using - - Dim s = My.Computer.FileSystem.ReadAllText("Output.xml") - Console.WriteLine(s) - End Sub -End Module - -Public Class StreamCustomerItem - Implements IEnumerable(Of XElement) - - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - End Sub - - Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator - Return New StreamCustomerItemEnumerator(_uri) - End Function - - Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator - Return Me.GetEnumerator() - End Function -End Class - -Public Class StreamCustomerItemEnumerator - Implements IEnumerator(Of XElement) - - Private _current As XElement - Private _customerName As String - Private _reader As Xml.XmlReader - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - - Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current - Get - Return _current - End Get - End Property - - Public ReadOnly Property Current1 As Object Implements IEnumerator.Current - Get - Return Me.Current - End Get - End Property - - Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext - Dim item As XElement - Dim name As XElement - - ' Parse the file, save header information when encountered, and return the - ' current Item XElement. - - ' loop through Customer elements - While _reader.Read() - If _reader.NodeType = Xml.XmlNodeType.Element Then - Select Case _reader.Name - Case "Customer" - ' move to Name element - While _reader.Read() - - If _reader.NodeType = Xml.XmlNodeType.Element AndAlso - _reader.Name = "Name" Then - - name = TryCast(XElement.ReadFrom(_reader), XElement) - _customerName = If(name IsNot Nothing, name.Value, "") - Exit While - End If - - End While - Case "Item" - item = TryCast(XElement.ReadFrom(_reader), XElement) - Dim tempRoot = - <%= _customerName %> - <%= item %> - - _current = item - Return True - End Select - End If - End While - - Return False - End Function - - Public Sub Reset() Implements IEnumerator.Reset - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - -#Region "IDisposable Support" - Private disposedValue As Boolean ' To detect redundant calls - - ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - _reader.Close() - End If - End If - Me.disposedValue = True - End Sub - - Public Sub Dispose() Implements IDisposable.Dispose - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - -End Class -``` - - This code produces the following output: - -```xml - - - A. Datum Corporation - 0001 - - - A. Datum Corporation - 0002 - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - - Fabrikam, Inc. - 0008 - - - Southridge Video - 0009 - - - Southridge Video - 0010 - - -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md deleted file mode 100644 index a84917ede0a89..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-from-the-file-system.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "How to: Populate an XML Tree from the File System" -ms.date: 07/20/2015 -ms.assetid: 34eec79e-7945-4ba8-9f74-d05bb8ec67f6 ---- -# How to: Populate an XML Tree from the File System (Visual Basic) -A common and useful application of XML trees is as a hierarchical name/value data store. You can populate an XML tree with hierarchical data, and then query it, transform it, and if necessary, serialize it. In this usage scenario, many of the XML specific semantics, such as namespaces and white space behavior, are not important. Instead, you are using the XML tree as a small, in memory, single user hierarchical database. - -## Example - The following example populates an XML tree from the local file system using recursion. It then queries the tree, calculating the total of the sizes of all files in the tree. - -```vb -Module Module1 - Function CreateFileSystemXmlTree(ByVal source As String) As XElement - Dim di As DirectoryInfo = New DirectoryInfo(source) - Return > - <%= From d In Directory.GetDirectories(source) _ - Select CreateFileSystemXmlTree(d) %> - <%= From fi In di.GetFiles() _ - Select - <%= fi.Name %> - <%= fi.Length %> - %> - - End Function - - Sub Main() - Dim fileSystemTree As XElement = CreateFileSystemXmlTree("C:/Tmp") - Console.WriteLine(fileSystemTree) - Console.WriteLine("------") - Dim totalFileSize As Long = _ - ( _ - From f In fileSystemTree... _ - Select CLng(f.(0)) _ - ).Sum() - Console.WriteLine("Total File Size:{0}", totalFileSize) - End Sub -End Module -``` - - This example produces output similar to the following: - -```xml - - - - - - ConsoleApplication1.exe - 4608 - - - ConsoleApplication1.pdb - 11776 - - - ConsoleApplication1.vshost.exe - 9568 - - - ConsoleApplication1.vshost.exe.manifest - 473 - - - - - - - - ConsoleApplication1.csproj.FileListAbsolute.txt - 322 - - - ConsoleApplication1.exe - 4608 - - - ConsoleApplication1.pdb - 11776 - - - - - - AssemblyInfo.cs - 1454 - - - - ConsoleApplication1.csproj - 2546 - - - ConsoleApplication1.sln - 937 - - - ConsoleApplication1.suo - 10752 - - - Program.cs - 269 - - - ------- -Total File Size:59089 -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md deleted file mode 100644 index 0318e84828066..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: "How to: Populate an XML Tree with an XmlWriter (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 5792a0eb-94ee-440d-b601-58cca8c0ee0b ---- -# How to: Populate an XML Tree with an XmlWriter (LINQ to XML) (Visual Basic) -One way to populate an XML tree is to use to create an , and then write to the . The XML tree is populated with all nodes that are written to the . - - You would typically use this method when you use [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] with another class that expects to write to an , such as . - -## Example - One possible use for is when invoking an XSLT transformation. This example creates an XML tree, creates an from the XML tree, creates a new document, and then creates an to write into the new document. It then invokes the XSLT transformation, passing in and . After the transformation successfully completes, the new XML tree is populated with the results of the transformation. - -```vb -Dim xslMarkup As XDocument = _ - - - - - - - - - - - - - - -Dim xmlTree As XDocument = _ - - - Child1 data - Child2 data - - -Dim newTree As XDocument = New XDocument() -Using writer As XmlWriter = newTree.CreateWriter() - ' Load the style sheet. - Dim xslt As XslCompiledTransform = New XslCompiledTransform() - xslt.Load(xslMarkup.CreateReader()) - - ' Execute the transformation and output the results to a writer. - xslt.Transform(xmlTree.CreateReader(), writer) -End Using - -Console.WriteLine(newTree) -``` - - This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- -- -- -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md deleted file mode 100644 index ffc59538480ae..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-a-new-type-linq-to-xml.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "How to: Project a New Type (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 8cfb24f5-89b2-4cfb-b85d-e7963f8f1845 ---- -# How to: Project a New Type (LINQ to XML) (Visual Basic) -Other examples in this section have shown queries that return results as of , of `string`, and of `int`. These are common result types, but they are not appropriate for every scenario. In many cases you will want your queries to return an of some other type. - -## Example - This example shows how to instantiate objects in the `Select` clause. The code first defines a new class with a constructor, and then modifies the `Select` statement so that the expression is a new instance of the new class. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Public Class NameQty - Public name As String - Public qty As Integer - Public Sub New(ByVal n As String, ByVal q As Integer) - name = n - qty = q - End Sub -End Class - -Public Class Program - Shared Sub Main() - Dim po As XElement = XElement.Load("PurchaseOrder.xml") - - Dim nqList As IEnumerable(Of NameQty) = _ - From n In po... _ - Select New NameQty( _ - n..Value, CInt(n..Value)) - - For Each n As NameQty In nqList - Console.WriteLine(n.name & ":" & n.qty) - Next - End Sub -End Class -``` - - This example uses the `M:System.Xml.Linq.XElement.Element` method that was introduced in the topic [How to: Retrieve a Single Child Element (LINQ to XML) (Visual Basic)](how-to-retrieve-a-single-child-element-linq-to-xml.md). It also uses casts to retrieve the values of the elements that are returned by the `M:System.Xml.Linq.XElement.Element` method. - - This example produces the following output: - -```console -Lawnmower:1 -Baby Monitor:2 -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md deleted file mode 100644 index 291a81017adea..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-anonymous-type.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: "How to: Project an Anonymous Type" -ms.date: 07/20/2015 -ms.assetid: 30b42987-0e0e-4b2b-adb1-5255ddfbcd7b ---- -# How to: Project an Anonymous Type (Visual Basic) -In some cases you might want to project a query to a new type, even though you know you will only use this type for a short while. It is a lot of extra work to create a new type just to use in the projection. A more efficient approach in this case is to project to an anonymous type. Anonymous types allow you to define a class, then declare and initialize an object of that class, without giving the class a name. - - Anonymous types are the C# implementation of the mathematical concept of a *tuple*. The mathematical term tuple originated from the sequence single, double, triple, quadruple, quintuple, n-tuple. It refers to a finite sequence of objects, each of a specific type. Sometimes this is called a list of name/value pairs. For example, the contents of an address in the [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md) XML document could be expressed as follows: - -``` -Name: Ellen Adams -Street: 123 Maple Street -City: Mill Valley -State: CA -Zip: 90952 -Country: USA -``` - - When you create an instance of an anonymous type, it is convenient to think of it as creating a tuple of order n. If you write a query that creates a tuple in the `Select` clause, the query returns an `IEnumerable` of the tuple. - -## Example - In this example, the `Select` clause projects an anonymous type. The example then uses `Dim` to create the `IEnumerable` object. Within the `For Each` loop, the iteration variable becomes an instance of the anonymous type created in the query expression. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim custOrd As XElement = XElement.Load("CustomersOrders.xml") -Dim custList = _ - From el In custOrd.. _ - Select New With { _ - .CustomerID = el.@, _ - .CompanyName = el..Value, _ - .ContactName = el..Value _ - } -For Each cust In custList - Console.WriteLine("{0}:{1}:{2}", cust.CustomerID, cust.CompanyName, cust.ContactName) -Next -``` - - This code produces the following output: - -```console -GREAL:Great Lakes Food Market:Howard Snyder -HUNGC:Hungry Coyote Import Store:Yoshi Latimer -LAZYK:Lazy K Kountry Store:John Steel -LETSS:Let's Stop N Shop:Jaime Yorres -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-object-graph.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-object-graph.md deleted file mode 100644 index a44d0db0761cb..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-project-an-object-graph.md +++ /dev/null @@ -1,338 +0,0 @@ ---- -title: "How to: Project an Object Graph" -ms.date: 07/20/2015 -ms.assetid: 9451eb47-6a31-49d7-84df-73368c618422 ---- -# How to: Project an Object Graph (Visual Basic) -This topic illustrates how to project, or populate, an object graph from XML. - -## Example - The following code populates an object graph with the `Address`, `PurchaseOrder`, and `PurchaseOrderItem` classes from the [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md) XML document. - -```vb -Class Address - Public Enum AddressUse - Shipping - Billing - End Enum - - Private addressTypeVal As AddressUse - Private nameVal As String - Private streetVal As String - Private cityVal As String - Private stateVal As String - Private zipVal As String - Private countryVal As String - - Public Property AddressType() As AddressUse - Get - Return addressTypeVal - End Get - Set(ByVal value As AddressUse) - addressTypeVal = value - End Set - End Property - - Public Property Name() As String - Get - Return nameVal - End Get - Set(ByVal value As String) - nameVal = value - End Set - End Property - - Public Property Street() As String - Get - Return streetVal - End Get - Set(ByVal value As String) - streetVal = value - End Set - End Property - - Public Property City() As String - Get - Return cityVal - End Get - Set(ByVal value As String) - cityVal = value - End Set - End Property - - Public Property State() As String - Get - Return stateVal - End Get - Set(ByVal value As String) - stateVal = value - End Set - End Property - - Public Property Zip() As String - Get - Return zipVal - End Get - Set(ByVal value As String) - zipVal = value - End Set - End Property - - Public Property Country() As String - Get - Return countryVal - End Get - Set(ByVal value As String) - countryVal = value - End Set - End Property - - Public Overrides Function ToString() As String - Dim sb As StringBuilder = New StringBuilder() - sb.Append(String.Format("Type: {0}" + vbNewLine, _ - IIf(AddressType = AddressUse.Shipping, "Shipping", "Billing"))) - sb.Append(String.Format("Name: {0}" + vbNewLine, Name)) - sb.Append(String.Format("Street: {0}" + vbNewLine, Street)) - sb.Append(String.Format("City: {0}" + vbNewLine, City)) - sb.Append(String.Format("State: {0}" + vbNewLine, State)) - sb.Append(String.Format("Zip: {0}" + vbNewLine, Zip)) - sb.Append(String.Format("Country: {0}" + vbNewLine, Country)) - Return sb.ToString() - End Function -End Class - -Class PurchaseOrderItem - Private partNumberVal As String - Private productNameVal As String - Private quantityVal As Integer - Private usPriceVal As Decimal - Private commentVal As String - Private shipDateVal As DateTime - - Public Property PartNumber() As String - Get - Return partNumberVal - End Get - Set(ByVal value As String) - partNumberVal = value - End Set - End Property - - Public Property ProductName() As String - Get - Return productNameVal - End Get - Set(ByVal value As String) - productNameVal = value - End Set - End Property - - Public Property Quantity() As Integer - Get - Return quantityVal - End Get - Set(ByVal value As Integer) - quantityVal = value - End Set - End Property - - Public Property USPrice() As Decimal - Get - Return usPriceVal - End Get - Set(ByVal value As Decimal) - usPriceVal = value - End Set - End Property - - Public Property Comment() As String - Get - Return commentVal - End Get - Set(ByVal value As String) - commentVal = value - End Set - End Property - - Public Property ShipDate() As DateTime - Get - Return shipDateVal - End Get - Set(ByVal value As DateTime) - shipDateVal = value - End Set - End Property - - Public Overrides Function ToString() As String - Dim sb As StringBuilder = New StringBuilder() - sb.Append(String.Format("PartNumber: {0}" + vbNewLine, PartNumber)) - sb.Append(String.Format("ProductName: {0}" + vbNewLine, ProductName)) - sb.Append(String.Format("Quantity: {0}" + vbNewLine, Quantity)) - sb.Append(String.Format("USPrice: {0}" + vbNewLine, USPrice)) - If (Comment <> Nothing) Then - sb.Append(String.Format("Comment: {0}" + vbNewLine, Comment)) - End If - If (ShipDate <> DateTime.MinValue) Then - sb.Append(String.Format("ShipDate: {0:d}" + vbNewLine, ShipDate)) - End If - Return sb.ToString() - End Function -End Class - -Class PurchaseOrder - Private purchaseOrderNumberVal As String - Private orderDateVal As DateTime - Private commentVal As String - Private addressesVal As List(Of Address) - Private itemsVal As List(Of PurchaseOrderItem) - - Public Property PurchaseOrderNumber() As String - Get - Return purchaseOrderNumberVal - End Get - Set(ByVal value As String) - purchaseOrderNumberVal = value - End Set - End Property - - Public Property OrderDate() As DateTime - Get - Return orderDateVal - End Get - Set(ByVal value As DateTime) - orderDateVal = value - End Set - End Property - - Public Property Comment() As String - Get - Return commentVal - End Get - Set(ByVal value As String) - commentVal = value - End Set - End Property - - Public Property Addresses() As List(Of Address) - Get - Return addressesVal - End Get - Set(ByVal value As List(Of Address)) - addressesVal = value - End Set - End Property - - Public Property Items() As List(Of PurchaseOrderItem) - Get - Return itemsVal - End Get - Set(ByVal value As List(Of PurchaseOrderItem)) - itemsVal = value - End Set - End Property - - Public Overrides Function ToString() As String - Dim sb As StringBuilder = New StringBuilder() - sb.Append(String.Format("PurchaseOrderNumber: {0}" _ - + vbNewLine, PurchaseOrderNumber)) - sb.Append(String.Format("OrderDate: {0:d}" + vbNewLine, OrderDate)) - sb.Append(vbNewLine) - sb.Append("Addresses" + vbNewLine) - sb.Append("=====" + vbNewLine) - For Each address As Address In Addresses - sb.Append(address) - sb.Append(vbNewLine) - Next - sb.Append("Items" + vbNewLine) - sb.Append("=====" + vbNewLine) - For Each item As PurchaseOrderItem In Items - sb.Append(item) - sb.Append(vbNewLine) - Next - Return sb.ToString() - End Function -End Class - -Sub Main() - Dim po As XElement = XElement.Load("PurchaseOrder.xml") - Dim purchOrder = New PurchaseOrder With { _ - .PurchaseOrderNumber = po.@, _ - .OrderDate = Convert.ToDateTime(po.@), _ - .Addresses = ( _ - From a In po.
_ - Select New Address With { _ - .AddressType = IIf(a.@ = "Shipping", _ - Address.AddressUse.Shipping, _ - Address.AddressUse.Billing), _ - .Name = a..Value, _ - .Street = a..Value, _ - .City = a..Value, _ - .State = a..Value, _ - .Zip = a..Value, _ - .Country = a..Value _ - } _ - ).ToList(), _ - .Items = ( _ - From i In po.. _ - Select New PurchaseOrderItem With { _ - .PartNumber = i.@, _ - .ProductName = i..Value, _ - .Quantity = i..Value, _ - .USPrice = i..Value, _ - .Comment = i..Value, _ - .ShipDate = IIf(i..Value <> Nothing, _ - Convert.ToDateTime(i..Value), _ - DateTime.MinValue) _ - } _ - ).ToList() _ - } - Console.WriteLine(purchOrder) -End Sub -``` - - In this example, the result of the LINQ query is returned as an of `PurchaseOrderItem`. The items in the `PurchaseOrder` class are of type of `PurchaseOrderItem`. The code uses the extension method to create a collection from the results of the query. - - The example produces the following output: - -```console -PurchaseOrderNumber: 99503 -OrderDate: 10/20/1999 - -Addresses -===== -Type: Shipping -Name: Ellen Adams -Street: 123 Maple Street -City: Mill Valley -State: CA -Zip: 10999 -Country: USA - -Type: Billing -Name: Tai Yee -Street: 8 Oak Avenue -City: Old Town -State: PA -Zip: 95819 -Country: USA - -Items -===== -PartNumber: 872-AA -ProductName: Lawnmower -Quantity: 1 -USPrice: 148.95 -Comment: Confirm this is electric - -PartNumber: 926-AA -ProductName: Baby Monitor -Quantity: 2 -USPrice: 39.98 -ShipDate: 5/21/1999 -``` - -## See also - -- -- -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md deleted file mode 100644 index f4aa3a0d72aa6..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-query-linq-to-xml-using-xpath.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: "How to: Query LINQ to XML Using XPath" -ms.date: 07/20/2015 -ms.assetid: e1f69a20-1efa-452d-9089-c472fa84b3d5 ---- -# How to: Query LINQ to XML Using XPath (Visual Basic) -This topic introduces the extension methods that enable you to query an XML tree by using XPath. For detailed information about using these extension methods, see . - - Unless you have a very specific reason for querying using XPath, such as extensive use of legacy code, using XPath with LINQ to XML is not recommended. XPath queries will not perform as well as [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. - -## Example - The following example creates a small XML tree and uses to select a set of elements. - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - -Dim list As IEnumerable(Of XElement) = root.XPathSelectElements("./Child2") -For Each el As XElement In list - Console.WriteLine(el) -Next -``` - - This example produces the following output: - -```xml -4 -5 -6 -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md deleted file mode 100644 index c124d0409b0e3..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-attributes-linq-to-xml.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: "How to: Retrieve a Collection of Attributes (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: a07e9645-b45b-403b-b698-f652f904c7d2 ---- -# How to: Retrieve a Collection of Attributes (LINQ to XML) (Visual Basic) -This topic introduces the method. This method retrieves the attributes of an element. - -## Example - The following example shows how to iterate through the collection of attributes of an element. - -```vb -Dim val = _ - 100 -Dim listOfAttributes As IEnumerable(Of XAttribute) = _ - From att In val.Attributes() _ - Select att -For Each att As XAttribute In listOfAttributes - Console.WriteLine(att) -Next -``` - - This code produces the following output: - -```console -ID="1243" -Type="int" -ConvertableTo="double" -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md deleted file mode 100644 index 142ac933ba3b3..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-collection-of-elements-linq-to-xml.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "How to: Retrieve a Collection of Elements (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 2269f9de-8fb9-4666-b8a1-a4e754fa6a81 ---- -# How to: Retrieve a Collection of Elements (LINQ to XML) (Visual Basic) -This topic demonstrates the method. This method retrieves a collection of the child elements of an element. - -## Example - This example iterates through the child elements of the `purchaseOrder` element. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Dim po As XElement = XElement.Load("PurchaseOrder.xml") -Dim childElements As IEnumerable(Of XElement) -childElements = _ - From el In po.Elements() _ - Select el -For Each el As XElement In childElements - Console.WriteLine("Name: " & el.Name.ToString()) -Next -``` - - This example produces the following output. - -```console -Name: Address -Name: Address -Name: DeliveryNotes -Name: Items -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md deleted file mode 100644 index feac859b5b649..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-attribute-linq-to-xml.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "How to: Retrieve a Single Attribute (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 11b938d7-c011-4048-900e-8b9183c41c94 ---- -# How to: Retrieve a Single Attribute (LINQ to XML) (Visual Basic) -This topic explains how to retrieve a single attribute of an element, given the attribute name. This is useful for writing query expressions where you want to find an element that has a particular attribute. - - The method of the class returns the with the specified name. - -## Example - The following example uses the method. - -```vb -Dim cust As XElement = - 555-555-5555 - 555-555-6666 - -Dim elList = From el In cust... -For Each e As XElement In elList - Console.WriteLine(e.@type) -Next -``` - - This example finds all the descendants in the tree named `Phone`, and then finds the attribute named `type`. - - This code produces the following output: - -```console -home -work -``` - -## Example - If you want to retrieve the value of the attribute, you can cast it, just as you do for with objects. The following example demonstrates this. - -```vb -Dim cust As XElement = - 555-555-5555 - 555-555-6666 - -Dim elList As IEnumerable(Of XElement) = _ - From el In cust... _ - Select el -For Each el As XElement In elList - Console.WriteLine(el.@type) -Next -``` - - This code produces the following output: - -```console -home -work -``` - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides explicit cast operators for the class to `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. - -## Example - The following example shows the same code for an attribute that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim cust As XElement = _ - - 555-555-5555 - 555-555-6666 - - Dim elList As IEnumerable(Of XElement) = _ - From el In cust... _ - Select el - For Each el As XElement In elList - Console.WriteLine(el.@aw:type) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -home -work -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md deleted file mode 100644 index be5723051edb8..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-a-single-child-element-linq-to-xml.md +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: "How to: Retrieve a Single Child Element (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 0033e258-d9c4-4569-86f6-79b7c06d1204 ---- -# How to: Retrieve a Single Child Element (LINQ to XML) (Visual Basic) -This topic explains how to retrieve a single child element, given the name of the child element. When you know the name of the child element and that there is only one element that has this name, it can be convenient to retrieve just one element, instead of a collection. - - The method returns the first child with the specified . - - If you want to retrieve a single child element in Visual Basic, a common approach is to use the XML property, and then retrieve the first element using array indexer notation. - -## Example - The following example demonstrates the use of the method. This example takes the XML tree named `po` and finds the first element named `Comment`. - - The Visual Basic example shows using array indexer notation to retrieve a single element. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Dim po As XElement = XElement.Load("PurchaseOrder.xml") -Dim e As XElement = po.(0) -Console.WriteLine(e) -``` - - This example produces the following output: - -```xml -Please leave packages in shed by driveway. -``` - -## Example - The following example shows the same code for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Typical Purchase Order in a Namespace](sample-xml-file-typical-purchase-order-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim po As XElement = XElement.Load("PurchaseOrderInNamespace.xml") - Dim e As XElement = po.(0) - Console.WriteLine(e) - End Sub -End Module -``` - - This example produces the following output: - -```xml -Please leave packages in shed by driveway. -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md deleted file mode 100644 index 8f0b70abdc80b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-paragraphs-from-an-office-open-xml-document.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -title: "How to: Retrieve Paragraphs from an Office Open XML Document" -ms.date: 07/20/2015 -ms.assetid: 66053f21-9217-473c-a6f3-a0897be07756 ---- -# How to: Retrieve Paragraphs from an Office Open XML Document (Visual Basic) -This topic presents an example that opens an Office Open XML document, and retrieves a collection of all of the paragraphs in the document. - - For more information on Office Open XML, see [Eric White's Blog](http://www.ericwhite.com). - -## Example - This example opens an Office Open XML package, uses the relationships within the Open XML package to find the document and the style parts. It then queries the document, projecting a collection of an anonymous type that contains the paragraph node, the style name of each paragraph, and the text of each paragraph. - - The example uses an extension method named `StringConcatenate`, which is also supplied in the example. - - For a detailed tutorial that explains how this example works, see [Pure Functional Transformations of XML (Visual Basic)](pure-functional-transformations-of-xml.md). - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - Public Function ParagraphText(ByVal e As XElement) As String - Dim w As XNamespace = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) _ - As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage _ - .GetRelationshipsByType(documentRelationshipType) _ - .FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = _ - PackUriHelper _ - .ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = ParagraphText(para.ParagraphNode) _ - } - - For Each p In paraWithText - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - End Sub -End Module -``` - - When run with the sample Open XML document described in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md), this example produces the following output: - -```console -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >using System;< -StyleName:Code >< -StyleName:Code >class Program {< -StyleName:Code > public static void (string[] args) {< -StyleName:Code > Console.WriteLine("Hello World");< -StyleName:Code > }< -StyleName:Code >}< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md deleted file mode 100644 index 17cf19e833ad2..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-shallow-value-of-an-element.md +++ /dev/null @@ -1,76 +0,0 @@ ---- -title: "How to: Retrieve the Shallow Value of an Element" -ms.date: 07/20/2015 -ms.assetid: 730a6670-fb8c-41fc-8a1b-eb97a837e432 ---- - -# How to: Retrieve the Shallow Value of an Element (Visual Basic) - -This topic shows how to get the shallow value of an element. The shallow value is the value of the specific element only, as opposed to the deep value, which includes the values of all descendent elements concatenated into a single string. - -When you retrieve an element value by using either casting or the property, you retrieve the deep value. To retrieve the shallow value, you can use the `ShallowValue` extension method, as shown in the following example. Retrieving the shallow value is useful when you want to select elements based on their content. - -The following example declares an extension method that retrieves the shallow value of an element. It then uses the extension method in a query to list all elements that contain a calculated value. - -## Example - -The following text file, Report.xml, is the source for this example. - -```xml - - -
- - =Customer.CustomerId.Heading - =Customer.Name.Heading - - - =Customer.CustomerId - =Customer.Name - -
-
-``` - -```vb -Module Module1 - _ - Public Function ShallowValue(ByVal xe As XElement) - Return xe _ - .Nodes() _ - .OfType(Of XText)() _ - .Aggregate(New StringBuilder(), _ - Function(s, c) s.Append(c), _ - Function(s) s.ToString()) - End Function - - Sub Main() - Dim root As XElement = XElement.Load("Report.xml") - - Dim query As IEnumerable(Of XElement) = _ - From el In root.Descendants() _ - Where (el.ShallowValue().StartsWith("=")) _ - Select el - - For Each q As XElement In query - Console.WriteLine("{0}{1}{2}", _ - q.Name.ToString().PadRight(8), _ - q.Attribute("Name").ToString().PadRight(20), _ - q.ShallowValue()) - Next - End Sub -End Module -``` - -This example produces the following output: - -```console -Column Name="CustomerId" =Customer.CustomerId.Heading -Column Name="Name" =Customer.Name.Heading -Column Name="CustomerId" =Customer.CustomerId -Column Name="Name" =Customer.Name -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md deleted file mode 100644 index c14b173e6f60e..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -title: "How to: Retrieve the Value of an Attribute (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 5f4b3790-c83f-4eb3-a889-e3587edf3ca1 ---- -# How to: Retrieve the Value of an Attribute (LINQ to XML) (Visual Basic) -This topic shows how to obtain the value of attributes. There are two main ways: You can cast an to the desired type; the explicit conversion operator then converts the contents of the element or attribute to the specified type. Alternatively, you can use the property. However, casting is generally the better approach. If you cast the attribute to a nullable value type, the code is simpler to write when retrieving the value of an attribute that might or might not exist. For examples of this technique, see [How to: Retrieve the Value of an Element (LINQ to XML) (Visual Basic)](how-to-retrieve-the-value-of-an-element-linq-to-xml.md). - -## Example - In Visual Basic, you can use the integrated attribute property to retrieve the value of an attribute. - -```vb -Dim root As XElement = -Console.WriteLine(root) -Dim str As String = root.@Attr -Console.WriteLine(str) -``` - - This example produces the following output: - -```xml - -abcde -``` - -## Example - In Visual Basic, you can use the integrated attribute property to set the value of an attribute. Further, if you use the integrated attribute property to set the value of an attribute that does not exist, the attribute will be created. - -```vb -Dim root As XElement = -root.@Att1 = "new content" -root.@Att2 = "new attribute" -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - -``` - -## Example - The following example shows how to retrieve the value of an attribute where the attribute is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = - Dim str As String = root.@aw:Attr - Console.WriteLine(str) - End Sub -End Module -``` - - This example produces the following output: - -```console -abcde -``` - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md deleted file mode 100644 index 75e392d99fe0b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-retrieve-the-value-of-an-element-linq-to-xml.md +++ /dev/null @@ -1,148 +0,0 @@ ---- -title: "How to: Retrieve the Value of an Element (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 76b9b2a5-b3ba-49da-ba74-82100e1bd21c ---- -# How to: Retrieve the Value of an Element (LINQ to XML) (Visual Basic) -This topic shows how to get the value of elements. There are two main ways to do this. One way is to cast an or an to the desired type. The explicit conversion operator then converts the contents of the element or attribute to the specified type and assigns it to your variable. Alternatively, you can use the property or the property. - - With Visual Basic, the best approach is to use the property. - -## Example - To retrieve the value of an element, you just cast the object to your desired type. You can always cast an element to a string, as follows: - -```vb -Dim e As XElement = abcde -Console.WriteLine(e) -Console.WriteLine("Value of e:" & e.Value) -``` - - This example produces the following output: - -```xml -abcde -Value of e:abcde -``` - -## Example - You can also cast elements to types other than string. For example, if you have an element that contains an integer, you can cast it to `int`, as shown in the following code: - -```vb -Dim e As XElement = 44 -Console.WriteLine(e) -Console.WriteLine("Value of e:" & CInt(e)) -``` - - This example produces the following output: - -```xml -44 -Value of e:44 -``` - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides explicit cast operators for the following data types: `string`, `bool`, `bool?`, `int`, `int?`, `uint`, `uint?`, `long`, `long?`, `ulong`, `ulong?`, `float`, `float?`, `double`, `double?`, `decimal`, `decimal?`, `DateTime`, `DateTime?`, `TimeSpan`, `TimeSpan?`, `GUID`, and `GUID?`. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides the same cast operators for objects. - -## Example - You can use the property to retrieve the contents of an element: - -```vb -Dim e As XElement = abcde -Console.WriteLine(e) -Console.WriteLine("Value of e:" & e.Value) -``` - - This example produces the following output: - -```xml -abcde -Value of e:abcde -``` - -## Example - Sometimes you try to retrieve the value of an element even though you are not sure it exists. In this case, when you assign the casted element to a nullable type (either `string` or one of the nullable value types in the .NET Framework), if the element does not exist the assigned variable is just set to `Nothing`. The following code shows that when the element might or might not exist, it is easier to use casting than to use the property. - -```vb -Dim root As XElement = - child 1 content - 2 - - -' The following assignments show why it is easier to use -' casting when the element might or might not exist. - -Dim c1 As String = CStr(root.Element("Child1")) -Console.WriteLine("c1:{0}", IIf(c1 Is Nothing, "element does not exist", c1)) - -Dim c2 As Nullable(Of Integer) = CType(root.Element("Child2"), Nullable(Of Integer)) -Console.WriteLine("c2:{0}", IIf(Not (c2.HasValue), "element does not exist", c2.ToString())) - -Dim c3 As String = CStr(root.Element("Child3")) -Console.WriteLine("c3:{0}", IIf(c3 Is Nothing, "element does not exist", c3)) - -Dim c4 As Nullable(Of Integer) = CType(root.Element("Child4"), Nullable(Of Integer)) -Console.WriteLine("c4:{0}", IIf(Not (c4.HasValue), "element does not exist", c4.ToString())) - -Console.WriteLine() - -' The following assignments show the required code when using -' the Value property when the attribute might or might not exist. -' Notice that this is more difficult than the casting approach. - -Dim e1 As XElement = root.Element("Child1") -Dim v1 As String -If (e1 Is Nothing) Then - v1 = Nothing -Else - v1 = e1.Value -End If -Console.WriteLine("v1:{0}", IIf(v1 Is Nothing, "element does not exist", v1)) - -Dim e2 As XElement = root.Element("Child2") -Dim v2 As Nullable(Of Integer) -If (e2 Is Nothing) Then - v2 = Nothing -Else - v2 = e2.Value -End If -Console.WriteLine("v2:{0}", IIf(Not (v2.HasValue), "element does not exist", v2)) - -Dim e3 As XElement = root.Element("Child3") -Dim v3 As String -If (e3 Is Nothing) Then - v3 = Nothing -Else - v3 = e3.Value -End If -Console.WriteLine("v3:{0}", IIf(v3 Is Nothing, "element does not exist", v3)) - -Dim e4 As XElement = root.Element("Child4") -Dim v4 As Nullable(Of Integer) -If (e4 Is Nothing) Then - v4 = Nothing -Else - v4 = e4.Value -End If -Console.WriteLine("v4:{0}", IIf(Not (v4.HasValue), "element does not exist", v4)) -``` - - This code produces the following output: - -```console -c1:child 1 content -c2:2 -c3:element does not exist -c4:element does not exist - -v1:child 1 content -v2:2 -v3:element does not exist -v4:element does not exist -``` - - In general, you can write simpler code when using casting to retrieve the contents of elements and attributes. - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md deleted file mode 100644 index 01bf83d1c607b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-datacontractserializer.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: "How to: Serialize Using DataContractSerializer" -ms.date: 07/20/2015 -ms.assetid: ecaea518-8a0f-4249-b4e5-9b3fb0cdd8ad ---- -# How to: Serialize Using DataContractSerializer (Visual Basic) -This topic shows an example that serializes and deserializes using . - -## Example - The following example creates a number of objects that contain objects. It then serializes them to text files, and then deserializes them from the text files. - -```vb -Imports System -Imports System.Xml -Imports System.Xml.Linq -Imports System.IO -Imports System.Runtime.Serialization - -Public Class XLinqTest - Shared Sub Main() - Test(Of XElement)(CreateXElement()) - Test(Of XElementContainer)(New XElementContainer()) - Test(Of XElementNullContainer)(New XElementNullContainer()) - End Sub - - Public Shared Sub Test(Of T)(ByRef obj) - Dim s As DataContractSerializer = New DataContractSerializer(GetType(T)) - Using fs As FileStream = File.Open("test" & GetType(T).Name & ".xml", FileMode.Create) - Console.WriteLine("Testing for type: {0}", GetType(T)) - s.WriteObject(fs, obj) - End Using - - Using fs As FileStream = File.Open("test" & GetType(T).Name & ".xml", FileMode.Open) - Dim s2 As Object = s.ReadObject(fs) - If s2 Is Nothing Then - Console.WriteLine(" Deserialized object is null (Nothing in VB)") - Else - Console.WriteLine(" Deserialized type: {0}", s2.GetType()) - End If - End Using - End Sub - - Public Shared Function CreateXElement() As XElement - Return New XElement(XName.Get("NameInNamespace", "http://www.adventure-works.org")) - End Function -End Class - - _ -Public Class XElementContainer - _ - Public member As XElement - - Public Sub XElementContainer() - member = XLinqTest.CreateXElement() - End Sub -End Class - - _ -Public Class XElementNullContainer - _ - Public member As XElement - - Public Sub XElementNullContainer() - member = Nothing - End Sub -End Class -``` - - This example produces the following output: - -```console -Testing for type: System.Xml.Linq.XElement - Deserialized type: System.Xml.Linq.XElement -Testing for type: XElementContainer - Deserialized type: XElementContainer -Testing for type: XElementNullContainer - Deserialized type: XElementNullContainer -``` - -## See also - -- [Serializing Object Graphs that Contain XElement Objects (Visual Basic)](serializing-object-graphs-that-contain-xelement-objects.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md deleted file mode 100644 index 6c17a45d752f0..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-serialize-using-xmlserializer.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: "How to: Serialize Using XmlSerializer" -ms.date: 07/20/2015 -ms.assetid: cace24eb-0f43-4016-8e4b-199e5ef73a1c ---- -# How to: Serialize Using XmlSerializer (Visual Basic) -This topic shows an example that serializes and deserializes using . - -## Example - The following example creates a number of objects that contain objects. It then serializes them to a memory stream, and then deserializes them from the memory stream. - -```vb -Imports System -Imports System.Xml -Imports System.Xml.Linq -Imports System.IO -Imports System.Runtime.Serialization -Imports System.Xml.Serialization - -Public Class XElementContainer - Public member As XElement - - Public Sub XElementContainer() - member = XLinqTest.CreateXElement() - End Sub - - Overrides Function ToString() As String - Return member.ToString() - End Function -End Class - -Public Class XElementNullContainer - Public member As XElement - - Public Sub XElementNullContainer() - member = Nothing - End Sub -End Class - -Public Class XLinqTest - Shared Sub Main() - Test(Of XElementNullContainer)(New XElementNullContainer()) - Test(Of XElement)(CreateXElement()) - Test(Of XElementContainer)(New XElementContainer()) - End Sub - - Public Shared Function CreateXElement() As XElement - Dim ns As XNamespace = "http://www.adventure-works.com" - Return New XElement(ns + "aw") - End Function - - Public Shared Sub Test(Of T)(ByRef obj) - Using stream As New MemoryStream() - Dim s As XmlSerializer = New XmlSerializer(GetType(T)) - Console.WriteLine("Testing for type: {0}", GetType(T)) - s.Serialize(XmlWriter.Create(stream), obj) - stream.Flush() - stream.Seek(0, SeekOrigin.Begin) - Dim o As Object = s.Deserialize(XmlReader.Create(stream)) - Console.WriteLine(" Deserialized type: {0}", o.GetType()) - End Using - End Sub -End Class -``` - - This example produces the following output: - -```console -Testing for type: XElementNullContainer - Deserialized type: XElementNullContainer -Testing for type: System.Xml.Linq.XElement - Deserialized type: System.Xml.Linq.XElement -Testing for type: XElementContainer - Deserialized type: XElementContainer -``` - -## See also - -- [Serializing Object Graphs that Contain XElement Objects (Visual Basic)](serializing-object-graphs-that-contain-xelement-objects.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md deleted file mode 100644 index 177c2cb97a1a6..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements-on-multiple-keys.md +++ /dev/null @@ -1,115 +0,0 @@ ---- -title: "How to: Sort Elements on Multiple Keys" -ms.date: 07/20/2015 -ms.assetid: 0c4c1462-3047-4766-b9e2-7e0e9cc7f421 ---- -# How to: Sort Elements on Multiple Keys (Visual Basic) -This topic shows how to sort on multiple keys. - -## Example - In this example, the results are ordered first by the shipping postal code, then by the order date. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim co As XElement = XElement.Load("CustomersOrders.xml") -Dim result = _ - From c In co.. _ - Order By c...Value, Convert.ToDateTime(c..Value) _ - Select New With { _ - .CustomerID = c..Value, _ - .EmployeeID = c..Value, _ - .ShipPostalCode = c...Value, _ - .OrderDate = Convert.ToDateTime(c..Value) _ - } -For Each r In result - Console.WriteLine("CustomerID:{0} EmployeeID:{1} ShipPostalCode:{2} OrderDate:{3:d}", _ - r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate) -Next -``` - - This code produces the following output: - -```console -CustomerID:LETSS EmployeeID:1 ShipPostalCode:94117 OrderDate:6/25/1997 -CustomerID:LETSS EmployeeID:8 ShipPostalCode:94117 OrderDate:10/27/1997 -CustomerID:LETSS EmployeeID:6 ShipPostalCode:94117 OrderDate:11/10/1997 -CustomerID:LETSS EmployeeID:4 ShipPostalCode:94117 OrderDate:2/12/1998 -CustomerID:GREAL EmployeeID:6 ShipPostalCode:97403 OrderDate:5/6/1997 -CustomerID:GREAL EmployeeID:8 ShipPostalCode:97403 OrderDate:7/4/1997 -CustomerID:GREAL EmployeeID:1 ShipPostalCode:97403 OrderDate:7/31/1997 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:7/31/1997 -CustomerID:GREAL EmployeeID:6 ShipPostalCode:97403 OrderDate:9/4/1997 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:9/25/1997 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:1/6/1998 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:3/9/1998 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:4/7/1998 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:4/22/1998 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:4/30/1998 -CustomerID:HUNGC EmployeeID:3 ShipPostalCode:97827 OrderDate:12/6/1996 -CustomerID:HUNGC EmployeeID:1 ShipPostalCode:97827 OrderDate:12/25/1996 -CustomerID:HUNGC EmployeeID:3 ShipPostalCode:97827 OrderDate:1/15/1997 -CustomerID:HUNGC EmployeeID:4 ShipPostalCode:97827 OrderDate:7/16/1997 -CustomerID:HUNGC EmployeeID:8 ShipPostalCode:97827 OrderDate:9/8/1997 -CustomerID:LAZYK EmployeeID:1 ShipPostalCode:99362 OrderDate:3/21/1997 -CustomerID:LAZYK EmployeeID:8 ShipPostalCode:99362 OrderDate:5/22/1997 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Customers and Orders in a Namespace](sample-xml-file-customers-and-orders-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim co As XElement = XElement.Load("CustomersOrdersInNamespace.xml") - Dim result = _ - From c In co.. _ - Order By c...Value, Convert.ToDateTime(c..Value) _ - Select New With { _ - .CustomerID = c..Value, _ - .EmployeeID = c..Value, _ - .ShipPostalCode = c...Value, _ - .OrderDate = Convert.ToDateTime(c..Value) _ - } - For Each r In result - Console.WriteLine("CustomerID:{0} EmployeeID:{1} ShipPostalCode:{2} OrderDate:{3:d}", _ - r.CustomerID, r.EmployeeID, r.ShipPostalCode, r.OrderDate) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -CustomerID:LETSS EmployeeID:1 ShipPostalCode:94117 OrderDate:6/25/1997 -CustomerID:LETSS EmployeeID:8 ShipPostalCode:94117 OrderDate:10/27/1997 -CustomerID:LETSS EmployeeID:6 ShipPostalCode:94117 OrderDate:11/10/1997 -CustomerID:LETSS EmployeeID:4 ShipPostalCode:94117 OrderDate:2/12/1998 -CustomerID:GREAL EmployeeID:6 ShipPostalCode:97403 OrderDate:5/6/1997 -CustomerID:GREAL EmployeeID:8 ShipPostalCode:97403 OrderDate:7/4/1997 -CustomerID:GREAL EmployeeID:1 ShipPostalCode:97403 OrderDate:7/31/1997 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:7/31/1997 -CustomerID:GREAL EmployeeID:6 ShipPostalCode:97403 OrderDate:9/4/1997 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:9/25/1997 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:1/6/1998 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:3/9/1998 -CustomerID:GREAL EmployeeID:3 ShipPostalCode:97403 OrderDate:4/7/1998 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:4/22/1998 -CustomerID:GREAL EmployeeID:4 ShipPostalCode:97403 OrderDate:4/30/1998 -CustomerID:HUNGC EmployeeID:3 ShipPostalCode:97827 OrderDate:12/6/1996 -CustomerID:HUNGC EmployeeID:1 ShipPostalCode:97827 OrderDate:12/25/1996 -CustomerID:HUNGC EmployeeID:3 ShipPostalCode:97827 OrderDate:1/15/1997 -CustomerID:HUNGC EmployeeID:4 ShipPostalCode:97827 OrderDate:7/16/1997 -CustomerID:HUNGC EmployeeID:8 ShipPostalCode:97827 OrderDate:9/8/1997 -CustomerID:LAZYK EmployeeID:1 ShipPostalCode:99362 OrderDate:3/21/1997 -CustomerID:LAZYK EmployeeID:8 ShipPostalCode:99362 OrderDate:5/22/1997 -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements.md deleted file mode 100644 index 62e106a78e74c..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-sort-elements.md +++ /dev/null @@ -1,74 +0,0 @@ ---- -title: "How to: Sort Elements" -ms.date: 07/20/2015 -ms.assetid: c2c09279-6c8a-482e-8e71-b1453a815052 ---- -# How to: Sort Elements (Visual Basic) -This example shows how to write a query that sorts its results. - -## Example - This example uses the following XML document: [Sample XML File: Numerical Data (LINQ to XML)](sample-xml-file-numerical-data-linq-to-xml.md). - -```vb -Dim root As XElement = XElement.Load("Data.xml") -Dim prices As IEnumerable(Of Decimal) = _ - From el In root. _ - Let price = Convert.ToDecimal(el..Value) _ - Order By (price) _ - Select price -For Each el As Decimal In prices - Console.WriteLine(el) -Next -``` - - This code produces the following output: - -```console -0.99 -4.95 -6.99 -24.50 -29.00 -66.00 -89.99 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Numerical Data in a Namespace](sample-xml-file-numerical-data-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = XElement.Load("DataInNamespace.xml") - Dim prices As IEnumerable(Of Decimal) = _ - From el In root. _ - Let price = Convert.ToDecimal(el..Value) _ - Order By (price) _ - Select price - For Each el As Decimal In prices - Console.WriteLine(el) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -0.99 -4.95 -6.99 -24.50 -29.00 -66.00 -89.99 -``` - -## See also - -- [Sorting Data](sorting-data.md) -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md deleted file mode 100644 index 74169ae5ce9fd..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-from-an-xmlreader.md +++ /dev/null @@ -1,145 +0,0 @@ ---- -title: "How to: Stream XML Fragments from an XmlReader" -ms.date: 07/20/2015 -ms.assetid: f67ce598-4a12-4dcb-9a07-24deca02a111 ---- -# How to: Stream XML Fragments from an XmlReader (Visual Basic) -When you have to process large XML files, it might not be feasible to load the whole XML tree into memory. This topic shows how to stream fragments using an . - - One of the most effective ways to use an to read objects is to write your own custom axis method. An axis method typically returns a collection such as of , as shown in the example in this topic. In the custom axis method, after you create the XML fragment by calling the method, return the collection using `yield return`. This provides deferred execution semantics to your custom axis method. - - When you create an XML tree from an object, the must be positioned on an element. The method does not return until it has read the close tag of the element. - - If you want to create a partial tree, you can instantiate an , position the reader on the node that you want to convert to an tree, and then create the object. - - The topic [How to: Stream XML Fragments with Access to Header Information (Visual Basic)](how-to-stream-xml-fragments-with-access-to-header-information.md) contains information and an example on how to stream a more complex document. - - The topic [How to: Perform Streaming Transform of Large XML Documents (Visual Basic)](how-to-perform-streaming-transform-of-large-xml-documents.md) contains an example of using LINQ to XML to transform extremely large XML documents while maintaining a small memory footprint. - -## Example - This example creates a custom axis method. You can query it by using a LINQ query. The custom axis method, `StreamRootChildDoc`, is a method that is designed specifically to read a document that has a repeating `Child` element. - -```vb -Module Module1 - Sub Main() - Dim markup = "" & - " " & - " aaa" & - " " & - " " & - " bbb" & - " " & - " " & - " ccc" & - " " & - "" - - Dim grandChildData = - From el In New StreamRootChildDoc(New IO.StringReader(markup)) - Where CInt(el.@Key) > 1 - Select el..Value - - For Each s In grandChildData - Console.WriteLine(s) - Next - End Sub -End Module - -Public Class StreamRootChildDoc - Implements IEnumerable(Of XElement) - - Private _stringReader As IO.StringReader - - Public Sub New(ByVal stringReader As IO.StringReader) - _stringReader = stringReader - End Sub - - Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator - Return New StreamChildEnumerator(_stringReader) - End Function - - Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator - Return Me.GetEnumerator() - End Function -End Class - -Public Class StreamChildEnumerator - Implements IEnumerator(Of XElement) - - Private _current As XElement - Private _reader As Xml.XmlReader - Private _stringReader As IO.StringReader - - Public Sub New(ByVal stringReader As IO.StringReader) - _stringReader = stringReader - _reader = Xml.XmlReader.Create(_stringReader) - _reader.MoveToContent() - End Sub - - Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current - Get - Return _current - End Get - End Property - - Public ReadOnly Property Current1 As Object Implements IEnumerator.Current - Get - Return Me.Current - End Get - End Property - - Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext - While _reader.Read() - Select Case _reader.NodeType - Case Xml.XmlNodeType.Element - Dim el = TryCast(XElement.ReadFrom(_reader), XElement) - If el IsNot Nothing Then - _current = el - Return True - End If - End Select - End While - - Return False - End Function - - Public Sub Reset() Implements IEnumerator.Reset - _reader = Xml.XmlReader.Create(_stringReader) - _reader.MoveToContent() - End Sub - -#Region "IDisposable Support" - Private disposedValue As Boolean ' To detect redundant calls - - ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - _reader.Close() - End If - End If - Me.disposedValue = True - End Sub - - Public Sub Dispose() Implements IDisposable.Dispose - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - -End Class -``` - - This example produces the following output: - -```console -bbb -ccc -``` - - In this example, the source document is very small. However, even if there were millions of `Child` elements, this example would still have a small memory footprint. - -## See also - -- [Walkthrough: Implementing IEnumerable(Of T) in Visual Basic](../../language-features/control-flow/walkthrough-implementing-ienumerable-of-t.md) -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md deleted file mode 100644 index 1c91ecd27376a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-stream-xml-fragments-with-access-to-header-information.md +++ /dev/null @@ -1,229 +0,0 @@ ---- -title: "How to: Stream XML Fragments with Access to Header Information" -ms.date: 07/20/2015 -ms.assetid: effd10df-87c4-4d7a-8a9a-1434d829dca5 ---- -# How to: Stream XML Fragments with Access to Header Information (Visual Basic) -Sometimes you have to read arbitrarily large XML files, and write your application so that the memory footprint of the application is predictable. If you attempt to populate an XML tree with a large XML file, your memory usage will be proportional to the size of the file—that is, excessive. Therefore, you should use a streaming technique instead. - - One option is to write your application using . However, you might want to use LINQ to query the XML tree. If this is the case, you can write your own custom axis method. For more information, see [How to: Write a LINQ to XML Axis Method (Visual Basic)](how-to-write-a-linq-to-xml-axis-method.md). - - To write your own axis method, you write a small method that uses the to read nodes until it reaches one of the nodes in which you are interested. The method then calls , which reads from the and instantiates an XML fragment. You can then write LINQ queries on your custom axis method. - - Streaming techniques are best applied in situations where you need to process the source document only once, and you can process the elements in document order. Certain standard query operators, such as , iterate their source, collect all of the data, sort it, and then finally yield the first item in the sequence. Note that if you use a query operator that materializes its source before yielding the first item, you will not retain a small memory footprint. - -## Example - Sometimes the problem gets just a little more interesting. In the following XML document, the consumer of your custom axis method also has to know the name of the customer that each item belongs to. - -```xml - - - - A. Datum Corporation - - 0001 - - - 0002 - - - 0003 - - - 0004 - - - - Fabrikam, Inc. - - 0005 - - - 0006 - - - 0007 - - - 0008 - - - - Southridge Video - - 0009 - - - 0010 - - - -``` - - The approach that this example takes is to also watch for this header information, save the header information, and then build a small XML tree that contains both the header information and the detail that you are enumerating. The axis method then yields this new, small XML tree. The query then has access to the header information as well as the detail information. - - This approach has a small memory footprint. As each detail XML fragment is yielded, no references are kept to the previous fragment, and it is available for garbage collection. Note that this technique creates many short lived objects on the heap. - - The following example shows how to implement and use a custom axis method that streams XML fragments from the file specified by the URI. This custom axis is specifically written such that it expects a document that has `Customer`, `Name`, and `Item` elements, and that those elements will be arranged as in the above `Source.xml` document. It is a simplistic implementation. A more robust implementation would be prepared to parse an invalid document. - -```vb -Module Module1 - - Sub Main() - Dim xmlTree = - <%= - From el In New StreamCustomerItem("Source.xml") - Let itemKey = CInt(el..Value) - Where itemKey >= 3 AndAlso itemKey <= 7 - Select - <%= el.Parent..Value %> - <%= el. %> - - %> - - - Console.WriteLine(xmlTree) - End Sub - -End Module - -Public Class StreamCustomerItem - Implements IEnumerable(Of XElement) - - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - End Sub - - Public Function GetEnumerator() As IEnumerator(Of XElement) Implements IEnumerable(Of XElement).GetEnumerator - Return New StreamCustomerItemEnumerator(_uri) - End Function - - Public Function GetEnumerator1() As IEnumerator Implements IEnumerable.GetEnumerator - Return Me.GetEnumerator() - End Function -End Class - -Public Class StreamCustomerItemEnumerator - Implements IEnumerator(Of XElement) - - Private _current As XElement - Private _customerName As String - Private _reader As Xml.XmlReader - Private _uri As String - - Public Sub New(ByVal uri As String) - _uri = uri - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - - Public ReadOnly Property Current As XElement Implements IEnumerator(Of XElement).Current - Get - Return _current - End Get - End Property - - Public ReadOnly Property Current1 As Object Implements IEnumerator.Current - Get - Return Me.Current - End Get - End Property - - Public Function MoveNext() As Boolean Implements IEnumerator.MoveNext - Dim item As XElement - Dim name As XElement - - ' Parse the file, save header information when encountered, and return the - ' current Item XElement. - - ' loop through Customer elements - While _reader.Read() - If _reader.NodeType = Xml.XmlNodeType.Element Then - Select Case _reader.Name - Case "Customer" - ' move to Name element - While _reader.Read() - - If _reader.NodeType = Xml.XmlNodeType.Element AndAlso - _reader.Name = "Name" Then - - name = TryCast(XElement.ReadFrom(_reader), XElement) - _customerName = If(name IsNot Nothing, name.Value, "") - Exit While - End If - - End While - Case "Item" - item = TryCast(XElement.ReadFrom(_reader), XElement) - Dim tempRoot = - <%= _customerName %> - <%= item %> - - _current = item - Return True - End Select - End If - End While - - Return False - End Function - - Public Sub Reset() Implements IEnumerator.Reset - _reader = Xml.XmlReader.Create(_uri) - _reader.MoveToContent() - End Sub - -#Region "IDisposable Support" - Private disposedValue As Boolean ' To detect redundant calls - - ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not Me.disposedValue Then - If disposing Then - _reader.Close() - End If - End If - Me.disposedValue = True - End Sub - - Public Sub Dispose() Implements IDisposable.Dispose - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region - -End Class -``` - - This code produces the following output: - -```xml - - - A. Datum Corporation - 0003 - - - A. Datum Corporation - 0004 - - - Fabrikam, Inc. - 0005 - - - Fabrikam, Inc. - 0006 - - - Fabrikam, Inc. - 0007 - - -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md deleted file mode 100644 index f087bd2321ff9..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-transform-the-shape-of-an-xml-tree.md +++ /dev/null @@ -1,142 +0,0 @@ ---- -title: "How to: Transform the Shape of an XML Tree" -ms.date: 07/20/2015 -ms.assetid: 84b60854-48b2-452c-87f2-77d53e1d653a ---- -# How to: Transform the Shape of an XML Tree (Visual Basic) -The *shape* of an XML document refers to its element names, attribute names, and the characteristics of its hierarchy. - - Sometimes you will have to change the shape of an XML document. For example, you might have to send an existing XML document to another system that requires different element and attribute names. You could go through the document, deleting and renaming elements as required, but using functional construction results in more readable and maintainable code. For more information about functional construction, see [Functional Construction (LINQ to XML) (Visual Basic)](functional-construction-linq-to-xml.md). - - The first example changes the organization of the XML document. It moves complex elements from one location in the tree to another. - - The second example in this topic creates an XML document with a different shape than the source document. It changes the casing of the element names, renames some elements, and leaves some elements from the source tree out of the transformed tree. - -## Example - The following code changes the shape of an XML file using embedded query expressions. - - The source XML document in this example contains a `Customers` element under the `Root` element that contains all customers. It also contains an `Orders` element under the `Root` element that contains all orders. This example creates a new XML tree in which the orders for each customer are contained in an `Orders` element within the `Customer` element. The original document also contains a `CustomerID` element in the `Order` element; this element will be removed from the re-shaped document. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - -```vb -Dim co As XElement = XElement.Load("CustomersOrders.xml") -Dim newCustOrd = _ - - <%= From cust In co.. _ - Select _ - - <%= cust.Attributes() %> - <%= cust.Elements() %> - - <%= From ord In co.. _ - Where ord..Value = cust.@CustomerID _ - Select _ - - <%= ord.Attributes() %> - <%= ord. %> - <%= ord. %> - <%= ord. %> - <%= ord. %> - _ - %> - - _ - %> - -Console.WriteLine(newCustOrd) -``` - - This code produces the following output: - -```xml - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
- -
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
- -
-... -
-``` - -## Example - This example renames some elements and converts some attributes to elements. - - The code calls `ConvertAddress`, which returns a list of objects. The argument to the method is a query that determines the `Address` complex element where the `Type` attribute has a value of `"Shipping"`. - - This example uses the following XML document: [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). - -```vb -Function ConvertAddress(ByVal add As XElement) As IEnumerable(Of XElement) - Dim fragment = New List(Of XElement) - fragment.Add(<%= add..Value %>) - fragment.Add(<%= add..Value %>) - fragment.Add(<%= add..Value %>) - fragment.Add(<%= add..Value %>) - fragment.Add(<%= add..Value %>) - fragment.Add(<%= add..Value %>) - Return fragment -End Function - -Sub Main() - Dim po As XElement = XElement.Load("PurchaseOrder.xml") - Dim newPo As XElement = _ - - <%= po.@PurchaseOrderNumber %> - <%= CDate(po.@OrderDate) %> - <%= _ - ConvertAddress( _ - (From el In po.
_ - Where el.@Type = "Shipping" _ - Select el) _ - .First() _ - ) _ - %> - - Console.WriteLine(newPo) -End Sub -``` - - This code produces the following output: - -```xml - - 99503 - 1999-10-20T00:00:00 - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md deleted file mode 100644 index 7c9ee9733a92a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md +++ /dev/null @@ -1,373 +0,0 @@ ---- -title: "How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style" -ms.date: 07/20/2015 -ms.assetid: 08e91fa2-dac2-4463-9ef1-87b1ac3fa890 ---- -# How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style (Visual Basic) - -Annotations can be used to facilitate transforms of an XML tree. - -Some XML documents are "document centric with mixed content." With such documents, you don't necessarily know the shape of child nodes of an element. For instance, a node that contains text may look like this: - -```xml -A phrase with bold and italic text. -``` - -For any given text node, there may be any number of child `` and `` elements. This approach extends to a number of other situations: such as, pages that can contain a variety of child elements, such as regular paragraphs, bulleted paragraphs, and bitmaps. Cells in a table may contain text, drop down lists, or bitmaps. One of the primary characteristics of document centric XML is that you do not know which child element any particular element will have. - -If you want to transform elements in a tree where you don't necessarily know much about the children of the elements that you want to transform, then this approach that uses annotations is an effective approach. - -The summary of the approach is: - -- First, annotate elements in the tree with a replacement element. - -- Second, iterate through the entire tree, creating a new tree where you replace each element with its annotation. This example implements the iteration and creation of the new tree in a function named `XForm`. - -In detail, the approach consists of: - -- Execute one or more LINQ to XML queries that return the set of elements that you want to transform from one shape to another. For each element in the query, add a new object as an annotation to the element. This new element will replace the annotated element in the new, transformed tree. This is simple code to write, as demonstrated by the example. - -- The new element that is added as an annotation can contain new child nodes; it can form a sub-tree with any desired shape. - -- There is a special rule: If a child node of the new element is in a different namespace, a namespace that is made up for this purpose (in this example, the namespace is `http://www.microsoft.com/LinqToXmlTransform/2007`), then that child element is not copied to the new tree. Instead, if the namespace is the above mentioned special namespace, and the local name of the element is `ApplyTransforms`, then the child nodes of the element in the source tree are iterated, and copied to the new tree (with the exception that annotated child elements are themselves transformed according to these rules). - -- This is somewhat analogous to the specification of transforms in XSL. The query that selects a set of nodes is analogous to the XPath expression for a template. The code to create the new that is saved as an annotation is analogous to the sequence constructor in XSL, and the `ApplyTransforms` element is analogous in function to the `xsl:apply-templates` element in XSL. - -- One advantage to taking this approach - as you formulate queries, you are always writing queries on the unmodified source tree. You need not worry about how modifications to the tree affect the queries that you are writing. - -## Transforming a Tree - -This first example renames all `Paragraph` nodes to `para`: - -```vb -Imports - -Module Module1 - Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" - - Sub Main() - Dim root As XElement = _ - - This is a sentence with bold and italic text. - More text. - - - ' Replace Paragraph with p. - For Each el In root... - ' same idea as xsl:apply-templates - el.AddAnnotation( _ - - <<%= at %>> - ) - Next - - ' The XForm function, shown later in this topic, accomplishes the transform - Dim newRoot As XElement = XForm(root) - Console.WriteLine(newRoot) - End Sub -End Module -``` - - This example produces the following output: - -```xml - - This is a sentence with bold and italic text. - More text. - -``` - -## A more complicated transform - -The following example queries the tree and calculates the average and sum of the `Data` elements, and adds them as new elements to the tree. - -```vb -Imports - -Module Module1 - Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" - - Sub Main() - Dim data As XElement = _ - - 20 - 10 - 3 - - - ' While adding annotations, you can query the source tree all you want, - ' as the tree is not mutated while annotating. - data.AddAnnotation( _ - - <<%= at %>/> - - <%= _ - String.Format("{0:F4}", _ - data.Elements("Data") _ - .Select(Function(z) CDec(z)).Average()) _ - %> - - - <%= _ - data.Elements("Data").Select(Function(z) CInt(z)).Sum() _ - %> - - _ - ) - - Console.WriteLine("Before Transform") - Console.WriteLine("----------------") - Console.WriteLine(data) - Console.WriteLine(vbNewLine) - - ' The XForm function, shown later in this topic, accomplishes the transform - Dim newData As XElement = XForm(data) - - Console.WriteLine("After Transform") - Console.WriteLine("----------------") - Console.WriteLine(newData) - End Sub -End Module -``` - -This example produces the following output: - -```console -Before Transform ----------------- - - 20 - 10 - 3 - - -After Transform ----------------- - - 20 - 10 - 3 - 11.0000 - 33 - -``` - -## Effecting the transform - -A small function, `XForm`, creates a new transformed tree from the original, annotated tree. - -The pseudo code for the function is quite simple: - -> The function takes an XElement as an argument and returns an XElement. -> -> If an element has an XElement annotation, then return a new XElement: -> -> - The name of the new XElement is the annotation element's name. -> - All attributes are copied from the annotation to the new node. -> - All child nodes are copied from the annotation, with the exception that the special node xf:ApplyTransforms is recognized, and the source element's child nodes are iterated. If the source child node is not an XElement, it is copied to the new tree. If the source child is an XElement, then it is transformed by calling this function recursively. -> -> If an element is not annotated: -> -> - Return a new XElement -> - The name of the new XElement is the source element's name. -> - All attributes are copied from the source element to the destination's element. -> - All child nodes are copied from the source element. -> - If the source child node is not an XElement, it is copied to the new tree. If the source child is an XElement, then it is transformed by calling this function recursively. - -The following code is the implementation of this function: - -```vb -' Build a transformed XML tree per the annotations. -Function XForm(ByVal source As XElement) As XElement - If source.Annotation(Of XElement)() IsNot Nothing Then - Dim anno As XElement = source.Annotation(Of XElement)() - Return _ - <<%= anno.Name.ToString() %>> - <%= anno.Attributes() %> - <%= anno.Nodes().Select(Function(n As XNode) _ - GetSubNodes(n, source)) %> - - Else - Return _ - <<%= source.Name %>> - <%= source.Attributes() %> - <%= source.Nodes().Select(Function(n) GetExpandedNodes(n)) %> - - End If -End Function - -Private Function GetSubNodes(ByVal n As XNode, ByVal s As XElement) As Object - Dim annoEl As XElement = TryCast(n, XElement) - If annoEl IsNot Nothing Then - If annoEl.Name = at Then - Return s.Nodes().Select(Function(n2 As XNode) GetExpandedNodes(n2)) - End If - End If - Return n -End Function - -Private Function GetExpandedNodes(ByVal n2 As XNode) As XNode - Dim e2 As XElement = TryCast(n2, XElement) - If e2 Is Nothing Then - Return n2 - Else - Return XForm(e2) - End If -End Function -``` - -## Complete example - -The following code is a complete example that includes the `XForm` function. It includes a few of the typical uses of this type of transform: - -```vb -Imports System.Collections.Generic -Imports System.Linq -Imports System.Text -Imports System.Xml -Imports System.Xml.Linq - -Imports - -Module Module1 - Dim at As XName = GetXmlNamespace(xf) + "ApplyTransforms" - - ' Build a transformed XML tree per the annotations. - Function XForm(ByVal source As XElement) As XElement - If source.Annotation(Of XElement)() IsNot Nothing Then - Dim anno As XElement = source.Annotation(Of XElement)() - Return _ - <<%= anno.Name.ToString() %>> - <%= anno.Attributes() %> - <%= anno.Nodes().Select(Function(n As XNode) _ - GetSubNodes(n, source)) %> - - Else - Return _ - <<%= source.Name %>> - <%= source.Attributes() %> - <%= source.Nodes().Select(Function(n) GetExpandedNodes(n)) %> - - End If - End Function - - Private Function GetSubNodes(ByVal n As XNode, ByVal s As XElement) As Object - Dim annoEl As XElement = TryCast(n, XElement) - If annoEl IsNot Nothing Then - If annoEl.Name = at Then - Return s.Nodes().Select(Function(n2 As XNode) GetExpandedNodes(n2)) - End If - End If - Return n - End Function - - Private Function GetExpandedNodes(ByVal n2 As XNode) As XNode - Dim e2 As XElement = TryCast(n2, XElement) - If e2 Is Nothing Then - Return n2 - Else - Return XForm(e2) - End If - End Function - - Sub Main() - Dim root As XElement = _ - - - 1 - 2 - - 3 - 4 - - This is an element that has some mixed content - 42 - - - ' Each of the following serves the same semantic purpose as - ' XSLT templates and sequence constructors. - - ' Replace Child with NewChild. - For Each el In root. - el.AddAnnotation(<%= CStr(el) %>) - Next - - ' Replace first GC with GrandChild, add an attribute. - For Each el In root....Take(1) - el.AddAnnotation(<%= CStr(el) %>) - Next - - ' Replace Other with NewOther, add new child elements around original content. - For Each el In root. - el.AddAnnotation( _ - - 1 - <<%= at %>> - - ) - Next - - ' Change name of element that has mixed content. - root...(0).AddAnnotation( _ - <<%= at %>>) - - ' Replace with . - For Each el In root... - el.AddAnnotation(<<%= at %>>) - Next - - ' Replace with . - For Each el In root... - el.AddAnnotation(<<%= at %>>) - Next - - Console.WriteLine("Before Transform") - Console.WriteLine("----------------") - Console.WriteLine(root) - Console.WriteLine(vbNewLine) - Dim newRoot As XElement = XForm(root) - - Console.WriteLine("After Transform") - Console.WriteLine("----------------") - Console.WriteLine(newRoot) - End Sub -End Module -``` - -This example produces the following output: - -```console -Before Transform ----------------- - - - 1 - 2 - - 3 - 4 - - This is an element that has some mixed content - 42 - - -After Transform ----------------- - - - 1 - 2 - - 1 - 3 - 4 - - - This is an element that has some mixed content - 42 - -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md deleted file mode 100644 index 2168aa70a3fa6..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-validate-using-xsd-linq-to-xml.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -title: "How to: Validate Using XSD (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: a0fe88d4-4e77-49e7-90de-8953feeccc21 ---- -# How to: Validate Using XSD (LINQ to XML) (Visual Basic) -The namespace contains extension methods that make it easy to validate an XML tree against an XML Schema Definition Language (XSD) file. For more information, see the method documentation. - -## Example - The following example creates an , then validates two objects against the schema set. One of the documents is valid, the other is not. - -```vb -Dim errors As Boolean = False - -Private Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs) - Console.WriteLine("{0}", e.Message) - errors = True -End Sub - -Sub Main() - Dim xsdMarkup As XElement = _ - - - - - - - - - - - Dim schemas As XmlSchemaSet = New XmlSchemaSet() - schemas.Add("", xsdMarkup.CreateReader) - - Dim doc1 As XDocument = _ - - - content1 - content1 - - - Dim doc2 As XDocument = _ - - - content1 - content1 - - - Console.WriteLine("Validating doc1") - errors = False - doc1.Validate(schemas, AddressOf XSDErrors) - Console.WriteLine("doc1 {0}", IIf(errors = True, "did not validate", "validated")) - - Console.WriteLine() - Console.WriteLine("Validating doc2") - errors = False - doc2.Validate(schemas, AddressOf XSDErrors) - Console.WriteLine("doc2 {0}", IIf(errors = True, "did not validate", "validated")) -End Sub -``` - - This example produces the following output: - -```console -Validating doc1 -doc1 validated - -Validating doc2 -The element 'Root' has invalid child element 'Child3'. List of possible elements expected: 'Child2'. -doc2 did not validate -``` - -## Example - The following example validates that the XML document from [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md) is valid per the schema from [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md). It then modifies the source XML document. It changes the `CustomerID` attribute on the first customer. After the change, orders will then refer to a customer that does not exist, so the XML document will no longer validate. - - This example uses the following XML document: [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). - - This example uses the following XSD schema: [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md). - -```vb -Dim errors As Boolean = False - -Private Sub XSDErrors(ByVal o As Object, ByVal e As ValidationEventArgs) - Console.WriteLine("{0}", e.Message) - errors = True -End Sub - -Sub Main() - Dim schemas As XmlSchemaSet = New XmlSchemaSet() - schemas.Add("", "CustomersOrders.xsd") - - Console.WriteLine("Attempting to validate") - Dim custOrdDoc As XDocument = XDocument.Load("CustomersOrders.xml") - errors = False - custOrdDoc.Validate(schemas, AddressOf XSDErrors) - Console.WriteLine("custOrdDoc {0}", IIf(errors, "did not validate", "validated")) - - Console.WriteLine() - ' Modify the source document so that it will not validate. - custOrdDoc....(0).Value = "AAAAA" - Console.WriteLine("Attempting to validate after modification") - errors = False - custOrdDoc.Validate(schemas, AddressOf XSDErrors) - Console.WriteLine("custOrdDoc {0}", IIf(errors, "did not validate", "validated")) -End Sub -``` - - This example produces the following output: - -```console -Attempting to validate -custOrdDoc validated - -Attempting to validate after modification -The key sequence 'AAAAA' in Keyref fails to refer to some key. -custOrdDoc did not validate -``` - -## See also - -- -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md deleted file mode 100644 index aa861e45f9bc0..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-work-with-dictionaries-using-linq-to-xml.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: "How to: Work with Dictionaries Using LINQ to XML" -ms.date: 07/20/2015 -ms.assetid: 6cb3f969-1986-414a-b850-87418712edea ---- -# How to: Work with Dictionaries Using LINQ to XML (Visual Basic) -It is often convenient to convert varieties of data structures to XML, and XML back to other data structures. This topic shows a specific implementation of this general approach by converting a to XML and back. - -## Example - This example uses XML literals and a query in an embedded expression. The query projects new objects, which then become the new content for the `Root` object. - -```vb -Dim dict As Dictionary(Of String, String) = New Dictionary(Of String, String)() -dict.Add("Child1", "Value1") -dict.Add("Child2", "Value2") -dict.Add("Child3", "Value3") -dict.Add("Child4", "Value4") -Dim root As XElement = _ - - <%= From keyValue In dict _ - Select New XElement(keyValue.Key, keyValue.Value) %> - -Console.WriteLine(root) -``` - - This code produces the following output: - -```xml - - Value1 - Value2 - Value3 - Value4 - -``` - -## Example - The following code creates a dictionary from XML. - -```vb -Dim root As XElement = _ - - Value1 - Value2 - Value3 - Value4 - - -Dim dict As Dictionary(Of String, String) = New Dictionary(Of String, String) -For Each el As XElement In root.Elements - dict.Add(el.Name.LocalName, el.Value) -Next -For Each str As String In dict.Keys - Console.WriteLine("{0}:{1}", str, dict(str)) -Next -``` - - This code produces the following output: - -```console -Child1:Value1 -Child2:Value2 -Child3:Value3 -Child4:Value4 -``` - -## See also - -- [Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md deleted file mode 100644 index 1871d5b454bb9..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-linq-to-xml-axis-method.md +++ /dev/null @@ -1,214 +0,0 @@ ---- -title: "How to: Write a LINQ to XML Axis Method" -ms.date: 07/20/2015 -ms.assetid: b676f025-a24c-4076-8713-aa809b2b8ce0 ---- -# How to: Write a LINQ to XML Axis Method (Visual Basic) -You can write your own axis methods to retrieve collections from an XML tree. One of the best ways to do this is to write an extension method that returns a collection of elements or attributes. You can write your extension method to return specific subsets of elements or attributes, based on the requirements of your application. - -## Example - The following example uses two extension methods. The first extension method, `GetXPath`, operates on , and returns an XPath expression that when evaluated will return the node or attribute. The second extension method, `Find`, operates on . It returns a collection of objects and objects that contain some specified text. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - -```vb -Imports System.Runtime.CompilerServices -Imports System.Text - -Module Module1 - Sub Main() - Dim purchaseOrders = XElement.Load("..\..\PurchaseOrders.xml") - - Dim subset = From xobj In purchaseOrders.Find("1999") - - For Each obj In subset - Console.WriteLine(obj.GetXPath()) - If obj.GetType() = GetType(XElement) Then - Console.WriteLine(CType(obj, XElement).Value) - ElseIf obj.GetType() = GetType(XAttribute) Then - Console.WriteLine(CType(obj, XAttribute).Value) - End If - Next - End Sub -End Module - -Public Module MyExtensions - - Private Function GetQName(ByVal xe As XElement) As String - Dim prefix = xe.GetPrefixOfNamespace(xe.Name.Namespace) - If xe.Name.Namespace = XNamespace.None OrElse prefix Is Nothing Then - Return xe.Name.LocalName - Else - Return prefix & ":" & xe.Name.LocalName - End If - End Function - - Private Function GetQName(ByVal xa As XAttribute) As String - Dim prefix = xa.Parent.GetPrefixOfNamespace(xa.Name.Namespace) - If xa.Name.Namespace = XNamespace.None OrElse prefix Is Nothing Then - Return xa.Name.LocalName - Else - Return prefix & ":" & xa.Name.LocalName - End If - End Function - - Private Function NameWithPredicate(ByVal el As XElement) As String - If el.Parent IsNot Nothing AndAlso - el.Parent.Elements(el.Name).Count() <> 1 Then - Return GetQName(el) & "[" & - (el.ElementsBeforeSelf(el.Name).Count() + 1) & "]" - Else - Return GetQName(el) - End If - End Function - - - Public Function StrCat(Of T)(ByVal source As IEnumerable(Of T), - ByVal separator As String) As String - Return source.Aggregate(New StringBuilder, - Function(sb, i) sb. - Append(i.ToString()). - Append(separator), - Function(s) s.ToString()) - End Function - - - Public Function GetXPath(ByVal xobj As XObject) As String - - If xobj.Parent Is Nothing Then - Dim doc = TryCast(xobj, XDocument) - If doc IsNot Nothing Then Return "." - - Dim el = TryCast(xobj, XElement) - If el IsNot Nothing Then Return "/" + NameWithPredicate(el) - - ' the XPath data model does not include white space text nodes - ' that are children of a document, so this method returns null. - - Dim xt = TryCast(xobj, XText) - If xt IsNot Nothing Then Return Nothing - - Dim com = TryCast(xobj, XComment) - If com IsNot Nothing Then - Return "/" & - If(com.Document.Nodes().OfType(Of XComment)().Count() <> 1, - "comment()[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]", - "comment()") - End If - - Dim pi = TryCast(xobj, XProcessingInstruction) - If pi IsNot Nothing Then - Return "/" & - If(pi.Document.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1, - "processing-instruction()[" & - (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)().Count() + 1) & "]", - "processing-instruction()") - End If - Return Nothing - Else - Dim el = TryCast(xobj, XElement) - If el IsNot Nothing Then - Return "/" & - el.Ancestors(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & NameWithPredicate(el) - End If - Dim at = TryCast(xobj, XAttribute) - If at IsNot Nothing Then - Return "/" & - at.Parent. - AncestorsAndSelf(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & "@" & GetQName(at) - End If - Dim com = TryCast(xobj, XComment) - If com IsNot Nothing Then - Return "/" & - com.Parent. - AncestorsAndSelf(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & - If(com.Parent.Nodes().OfType(Of XComment)().Count() <> 1, - "comment()[" & (com.NodesBeforeSelf().OfType(Of XComment)().Count() + 1) & "]", - "comment()") - End If - - Dim cd = TryCast(xobj, XCData) - If cd IsNot Nothing Then - Return "/" & - cd.Parent. - AncestorsAndSelf(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & - If(cd.Parent.Nodes().OfType(Of XText)().Count() <> 1, - "text()[" & (cd.NodesBeforeSelf().OfType(Of XText)().Count() + 1) & "]", - "text()") - End If - Dim tx = TryCast(xobj, XText) - If tx IsNot Nothing Then - Return "/" & - tx.Parent. - AncestorsAndSelf(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & - If(tx.Parent.Nodes().OfType(Of XText)().Count() <> 1, - "text()[" & (tx.NodesBeforeSelf().OfType(Of XText)().Count() + 1) & "]", - "text()") - End If - Dim pi As XProcessingInstruction = TryCast(xobj, XProcessingInstruction) - If pi IsNot Nothing Then - Return "/" & - pi.Parent. - AncestorsAndSelf(). - InDocumentOrder(). - Select(Function(e) NameWithPredicate(e)).StrCat("/") & - If(pi.Parent.Nodes().OfType(Of XProcessingInstruction)().Count() <> 1, - "processing-instruction()[" & - (pi.NodesBeforeSelf().OfType(Of XProcessingInstruction)().Count() + 1) & "]", - "processing-instruction()") - End If - Return Nothing - End If - End Function - - - Public Function Find(ByVal source As XElement, ByVal value As String) As IEnumerable(Of XObject) - Dim results = From att In source.Attributes() - Where att.Value.Contains(value) - Let a As XObject = att - Select a - - If source.Elements().Any Then - For Each result In From child In source.Elements() Select Find(child, value) - results = If(results Is Nothing, result, results.Union(result)) - Next - Else - If source.Value.Contains(value) Then - results = If(results Is Nothing, - New List(Of XObject) From {source}, - results.Union(New List(Of XObject) From {source})) - End If - End If - - Return results - End Function - -End Module -``` - - This code produces the following output: - -```console -/PurchaseOrders/PurchaseOrder[1]/@OrderDate -1999-10-20 -/PurchaseOrders/PurchaseOrder[1]/Items/Item[2]/ShipDate -1999-05-21 -/PurchaseOrders/PurchaseOrder[2]/@OrderDate -1999-10-22 -/PurchaseOrders/PurchaseOrder[3]/@OrderDate -1999-10-22 -``` - -## See also - -- [Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md deleted file mode 100644 index d37737b449c50..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-a-query-that-finds-elements-based-on-context.md +++ /dev/null @@ -1,109 +0,0 @@ ---- -title: "How to: Write a Query that Finds Elements Based on Context" -ms.date: 07/20/2015 -ms.assetid: 0b085290-ddc1-4126-aaa0-e4c95a3d9a09 ---- -# How to: Write a Query that Finds Elements Based on Context (Visual Basic) -Sometimes you might have to write a query that selects elements based on their context. You might want to filter based on preceding or following sibling elements. You might want to filter based on child or ancestor elements. - - You can do this by writing a query and using the results of the query in the `where` clause. If you have to first test against null, and then test the value, it is more convenient to do the query in a `let` clause, and then use the results in the `where` clause. - -## Example - The following example selects all `p` elements that are immediately followed by a `ul` element. - -```vb -Dim doc As XElement = _ - -

-

    abc
- -

- -

-

    def
-

- - -

- -

-

    abc
-

- - - -Dim items As IEnumerable(Of XElement) = _ - From e In doc...

_ - Let z = e.ElementsAfterSelf().FirstOrDefault() _ - Where z IsNot Nothing AndAlso z.Name.LocalName = "ul" _ - Select e - -For Each e As XElement In items - Console.WriteLine("id = {0}", e.@) -Next -``` - - This code produces the following output: - -```console -id = 1 -id = 3 -id = 6 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim doc As XElement = _ - -

-

    abc
- -

- -

-

    def
-

- - -

- -

-

    abc
-

- - - - Dim items As IEnumerable(Of XElement) = _ - From e In doc...

_ - Let z = e.ElementsAfterSelf().FirstOrDefault() _ - Where z IsNot Nothing AndAlso z.Name = GetXmlNamespace().GetName("ul") _ - Select e - - For Each e As XElement In items - Console.WriteLine("id = {0}", e.@) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -id = 1 -id = 3 -id = 6 -``` - -## See also - -- -- -- -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md deleted file mode 100644 index df76beb0e5ebd..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-on-xml-in-namespaces.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: "How to: Write Queries on XML in Namespaces" -ms.date: 07/20/2015 -ms.assetid: 7d4131b5-3288-414f-b77c-b2edc2a1f465 ---- -# How to: Write Queries on XML in Namespaces (Visual Basic) -To write a query on XML that is in a namespace, you must use objects that have the correct namespace. - - In Visual Basic, the most common approach is to define a global namespace, and then use XML literals and XML properties that use the global namespace. You can define a global default namespace, in which case elements in the XML literals will be in the namespace by default. Alternatively, you can define a global namespace with a prefix, and then use the prefix as required in the XML literals, and in XML properties. As with other forms of XML, attributes are always in no namespace by default. - - The first set of examples in this topic shows how to create an XML tree in a default namespace. The second set shows how to create an XML tree in a namespace with a prefix. - -## Example - The following example creates an XML tree that is in a default namespace. It then retrieves a collection of elements. - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el - For Each el As XElement In c1 - Console.WriteLine(el.Value) - Next - End Sub -End Module -``` - - This example produces the following output: - -```console -1 -2 -3 -``` - -## Example - In Visual Basic, however, writing queries on an XML tree that uses a namespace with a prefix is quite different from querying an XML tree in a default namespace. Typically you use the `Imports` statement to import the namespace with a prefix. You then use the prefix in the element and attribute names when you construct the XML tree. You also use the prefix when querying an XML tree using XML properties. - - The following example creates an XML tree that is in a namespace with a prefix. It then retrieves a collection of elements. - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el - For Each el As XElement In c1 - Console.WriteLine(CInt(el)) - Next - End Sub -End Module -``` - - This example produces the following output: - -```console -1 -2 -3 -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md b/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md deleted file mode 100644 index 52a45a1faf15a..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/how-to-write-queries-with-complex-filtering.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -title: "How to: Write Queries with Complex Filtering" -ms.date: 07/20/2015 -ms.assetid: bf286ffc-7990-4b00-a4eb-ee3d70129950 ---- -# How to: Write Queries with Complex Filtering (Visual Basic) -Sometimes you want to write LINQ to XML queries with complex filters. For example, you might have to find all elements that have a child element with a particular name and value. This topic gives an example of writing a query with complex filtering. - -## Example - This example shows how to find all `PurchaseOrder` elements that have a child `Address` element that has a `Type` attribute equal to "Shipping" and a child `State` element equal to "NY". It uses a nested query in the `Where` clause, and the `Any` operator returns `True` if the collection has any elements in it. - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md). - - For more information about the `Any` operator, see [Quantifier Operations (Visual Basic)](quantifier-operations.md). - -```vb -Dim root As XElement = XElement.Load("PurchaseOrders.xml") -Dim purchaseOrders As IEnumerable(Of XElement) = _ - From el In root. _ - Where _ - (From add In el.

_ - Where _ - add.@Type = "Shipping" And _ - add..Value = "NY" _ - Select add) _ - .Any() _ - Select el -For Each el As XElement In purchaseOrders - Console.WriteLine(el.@PurchaseOrderNumber) -Next -``` - - This code produces the following output: - -```console -99505 -``` - -## Example - The following example shows the same query for XML that is in a namespace. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - This example uses the following XML document: [Sample XML File: Multiple Purchase Orders in a Namespace](sample-xml-file-multiple-purchase-orders-in-a-namespace.md). - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = XElement.Load("PurchaseOrdersInNamespace.xml") - Dim purchaseOrders As IEnumerable(Of XElement) = _ - From el In root. _ - Where _ - (From add In el. _ - Where _ - add.@aw:Type = "Shipping" And _ - add..Value = "NY" _ - Select add) _ - .Any() _ - Select el - For Each el As XElement In purchaseOrders - Console.WriteLine(el.@aw:PurchaseOrderNumber) - Next - End Sub -End Module -``` - - This code produces the following output: - -```console -99505 -``` - -## See also - -- -- -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) -- [XML Child Axis Property](../../../language-reference/xml-axis/xml-child-axis-property.md) -- [XML Attribute Axis Property](../../../language-reference/xml-axis/xml-attribute-axis-property.md) -- [XML Value Property](../../../language-reference/xml-axis/xml-value-property.md) -- [Projection Operations (Visual Basic)](projection-operations.md) -- [Quantifier Operations (Visual Basic)](quantifier-operations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction.md b/docs/visual-basic/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction.md deleted file mode 100644 index 43ca4e83525ed..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/in-memory-xml-tree-modification-vs-functional-construction.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: d91c4ebf-6549-43cc-9961-26d4a82f722b ---- -# In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (Visual Basic) -Modifying an XML tree in place is a traditional approach to changing the shape of an XML document. A typical application loads a document into a data store such as DOM or [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]; uses a programming interface to insert nodes, delete nodes, or change the content of nodes; and then saves the XML to a file or transmits it over a network. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] enables another approach that is useful in many scenarios*: functional construction*. Functional construction treats modifying data as a problem of transformation, rather than as detailed manipulation of a data store. If you can take a representation of data and transform it efficiently from one form to another, the result is the same as if you took one data store and manipulated it in some way to take another shape. A key to the functional construction approach is to pass the results of queries to and constructors. - - In many cases you can write the transformational code in a fraction of the time that it would take to manipulate the data store, and that code is more robust and easier to maintain. In these cases, even though the transformational approach can take more processing power, it is a more effective way to modify data. If a developer is familiar with the functional approach, the resulting code in many cases is easier to understand. It is easy to find the code that modifies each part of the tree. - - The approach where you modify an XML tree in-place is more familiar to many DOM programmers, whereas code written using the functional approach might look unfamiliar to a developer who doesn't yet understand that approach. If you have to only make a small modification to a large XML tree, the approach where you modify a tree in place in many cases will take less CPU time. - - This topic provides an example that is implemented with both approaches. - -## Transforming Attributes into Elements - For this example, suppose you want to modify the following simple XML document so that the attributes become elements. This topic first presents the traditional in-place modification approach. It then shows the functional construction approach. - -```xml - - - Content - -``` - -### Modifying the XML Tree - You can write some procedural code to create elements from the attributes, and then delete the attributes, as follows: - -```vb -Dim root As XElement = XElement.Load("Data.xml") -For Each att As XAttribute In root.Attributes() - root.Add(New XElement(att.Name, att.Value)) -Next -root.Attributes().Remove() -Console.WriteLine(root) -``` - - This code produces the following output: - -```xml - - Content - 123 - 456 - -``` - -### Functional Construction Approach - By contrast, a functional approach consists of code to form a new tree, picking and choosing elements and attributes from the source tree, and transforming them as appropriate as they are added to the new tree. The functional approach looks like the following: - -```vb -Dim root As XElement = XElement.Load("Data.xml") -Dim newTree As XElement = _ - - <%= root. %> - <%= From att In root.Attributes() _ - Select New XElement(att.Name, att.Value) %> - -Console.WriteLine(newTree) -``` - - This example outputs the same XML as the first example. However, notice that you can actually see the resulting structure of the new XML in the functional approach. You can see the creation of the `Root` element, the code that pulls the `Child1` element from the source tree, and the code that transforms the attributes from the source tree to elements in the new tree. - - The functional example in this case is not any shorter than the first example, and it is not really any simpler. However, if you have many changes to make to an XML tree, the non functional approach will become quite complex and somewhat obtuse. In contrast, when using the functional approach, you still just form the desired XML, embedding queries and expressions as appropriate, to pull in the desired content. The functional approach yields code that is easier to maintain. - - Notice that in this case the functional approach probably would not perform quite as well as the tree manipulation approach. The main issue is that the functional approach creates more short lived objects. However, the tradeoff is an effective one if using the functional approach allows for greater programmer productivity. - - This is a very simple example, but it serves to show the difference in philosophy between the two approaches. The functional approach yields greater productivity gains for transforming larger XML documents. - -## See also - -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md b/docs/visual-basic/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md deleted file mode 100644 index 34951d4726b84..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/introduction-to-pure-functional-transformations.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -title: "Introduction to Pure Functional Transformations" -ms.date: 07/20/2015 -ms.assetid: 82bf3348-c503-4854-a91f-71f9835779ff ---- -# Introduction to Pure Functional Transformations (Visual Basic) -This section introduces functional transformations, including the underlying concepts and supporting language constructs. It contrasts the object-oriented and functional transformation approaches to programming, including advice on how to transition to the latter. Although functional transformations can be used in many programming scenarios, XML transformation is used here as a concrete example. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Concepts and Terminology (Functional Transformation) (Visual Basic)](concepts-and-terminology-functional-transformation.md)|Introduces the concepts and terminology of pure functional transformations.| -|[Functional Programming vs. Imperative Programming (Visual Basic)](functional-programming-vs-imperative-programming.md)|Compares and contrasts functional programming to more traditional imperative (procedural) programming.| -|[Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md)|Introduces pure functions, and shows examples of and pure and impure functions.| -|[Applicability of Functional Transformation (Visual Basic)](applicability-of-functional-transformation.md)|Describes typical scenarios for functional transformations.| -|[Functional Transformation of XML (Visual Basic)](functional-transformation-of-xml.md)|Describes functional transformations in the context of transforming XML trees.| - -## See also - -- [Pure Functional Transformations of XML (Visual Basic)](pure-functional-transformations-of-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/introduction-to-xml-literals.md b/docs/visual-basic/programming-guide/concepts/linq/introduction-to-xml-literals.md deleted file mode 100644 index eafbb61a80596..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/introduction-to-xml-literals.md +++ /dev/null @@ -1,194 +0,0 @@ ---- -title: "Introduction to XML Literals in Visual Basic2" -ms.date: 07/20/2015 -ms.assetid: 94fc0e03-978e-4c08-ab6c-0dc3c1e64f10 ---- -# Introduction to XML Literals in Visual Basic -This section provides information about creating XML trees in Visual Basic. - - For information about using the results of LINQ queries as the content for an XML tree, see [Functional Construction (LINQ to XML) (Visual Basic)](functional-construction-linq-to-xml.md). - - For more information on XML literals in Visual Basic, see [Overview of LINQ to XML in Visual Basic](../../language-features/xml/overview-of-linq-to-xml.md). - -## Creating XML Trees - The following example shows how to create an , in this case `contacts`: - -```vb -Dim contacts As XElement = _ - - - Patrick Hines - 206-555-0144 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` - -### Creating an XElement with Simple Content - You can create an that contains simple content, as follows: - -```vb -Dim n as XElement = Adventure Works -Console.WriteLine(n) -``` - - This example produces the following output: - -```xml -Adventure Works -``` - -### Creating an Empty Element - You can create an empty , as follows: - -```vb -Dim n As XElement = -Console.WriteLine(n) -``` - - This example produces the following output: - -```xml - -``` - -### Using Embedded Expressions - An important feature of XML literals is that they allow embedded expressions. Embedded expressions enable you to evaluate an expression and insert the results of the expression into the XML tree. If the expression evaluates to a type of , an element is inserted into the tree. If the expression evaluates to a type of , an attribute is inserted into the tree. You can insert elements and attributes into the tree only where they are valid. - - It is important to note that only a single expression can go into an embedded expression. You cannot embed multiple statements. If an expression extends beyond a single line, you must use the line continuation character. - - If you use an embedded expression to add existing nodes (including elements) and attributes to a new XML tree and if the existing nodes are already parented, the nodes are cloned. The newly cloned nodes are attached to the new XML tree. If the existing nodes are not parented, the nodes are simply attached to the new XML tree. The last example in this topic demonstrates this. - - The following example uses an embedded expression to insert an element into the tree: - -```vb -xmlTree1 As XElement = _ - - Contents - -Dim xmlTree2 As XElement = _ - - <%= xmlTree1. %> - -Console.WriteLine(xmlTree2) -``` - - This example produces the following output: - -```xml - - Contents - -``` - -### Using Embedded Expressions for Content - You can use an embedded expression to supply the content of an element: - -```vb -Dim str As String -str = "Some content" -Dim root As XElement = <%= str %> -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml -Some content -``` - -### Using a LINQ Query in an Embedded Expression - You can use the results of a LINQ query for the content of an element: - -```vb -Dim arr As Integer() = {1, 2, 3} - -Dim n As XElement = _ - - <%= From i In arr Select <%= i %> %> - - -Console.WriteLine(n) -``` - - This example produces the following output: - -```xml - - 1 - 2 - 3 - -``` - -### Using Embedded Expressions for Node Names - You can also use embedded expressions to calculate attribute names, attribute values, element names, and element values: - -```vb -Dim eleName As String = "ele" -Dim attName As String = "att" -Dim attValue As String = "aValue" -Dim eleValue As String = "eValue" -Dim n As XElement = _ - =<%= attValue %>> - <<%= eleName %>> - <%= eleValue %> - - -Console.WriteLine(n) -``` - - This example produces the following output: - -```xml - - eValue - -``` - -### Cloning vs. Attaching - As mentioned earlier, if you use an embedded expression to add existing nodes (including elements) and attributes to a new XML tree, if the existing nodes are already parented, the nodes are cloned and the newly cloned nodes are attached to the new XML tree. If the existing nodes are not parented, they are simply attached to the new XML tree. - -```vb -' Create a tree with a child element. -Dim xmlTree1 As XElement = _ - - 1 - - -' Create an element that is not parented. -Dim child2 As XElement = 2 - -' Create a tree and add Child1 and Child2 to it. -Dim xmlTree2 As XElement = _ - - <%= xmlTree1.(0) %> - <%= child2 %> - - -' Compare Child1 identity. -Console.WriteLine("Child1 was {0}", _ - IIf(xmlTree1.Element("Child1") Is xmlTree2.Element("Child1"), _ - "attached", "cloned")) - -' Compare Child2 identity. -Console.WriteLine("Child2 was {0}", _ - IIf(child2 Is xmlTree2.Element("Child2"), _ - "attached", "cloned")) -``` - - This example produces the following output: - -```console -Child1 was cloned -Child2 was attached -``` - -## See also - -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/language-integrated-axes.md b/docs/visual-basic/programming-guide/concepts/linq/language-integrated-axes.md deleted file mode 100644 index 404d10c692cba..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/language-integrated-axes.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Language-Integrated Axes in Visual Basic (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: d450a556-a134-4261-b011-44e399660894 ---- -# Language-Integrated Axes in Visual Basic (LINQ to XML) -This section describes features built directly into the Visual Basic language to make it easy to access XML. Many of the examples in the LINQ to XML documentation use these integrated Visual Basic axes. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[XML Child Axis Property](../../../language-reference/xml-axis/xml-child-axis-property.md)|Provides access to the children of one of the following: an object, an object, a collection of objects, or a collection of objects. This axis is equivalent to the axis.| -|[XML Descendant Axis Property](../../../language-reference/xml-axis/xml-descendant-axis-property.md)|Provides access to the descendants of the following: an object, an object, or a collection of objects. This axis is equivalent to the axis.| -|[XML Attribute Axis Property](../../../language-reference/xml-axis/xml-attribute-axis-property.md)|Provides access to an attribute of an object. This axis is roughly equivalent to the axis. This axis differs from the axis in that it returns the value of the attribute, not an object.| -|[Extension Indexer Property](../../../language-reference/xml-axis/extension-indexer-property.md)|Provides access to individual elements in a collection.| - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-annotations.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-annotations.md deleted file mode 100644 index 8c7fd2f42d8df..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-annotations.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "LINQ to XML Annotations2" -ms.date: 07/20/2015 -ms.assetid: c3e8b3ff-fceb-4428-b0ca-1ed6f128aac8 ---- -# LINQ to XML Annotations -Annotations in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] enable you to associate any arbitrary object of any arbitrary type with any XML component in an XML tree. - - To add an annotation to an XML component, such as an or , you call the method. You retrieve annotations by type. - - Note that annotations are not part of the XML infoset; they are not serialized or deserialized. - -## Methods - You can use the following methods when working with annotations: - -|Method|Description| -|------------|-----------------| -||Adds an object to the annotation list of an .| -||Gets the first annotation object of the specified type from an .| -||Gets a collection of annotations of the specified type for an .| -||Removes the annotations of the specified type from an .| - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes-overview.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes-overview.md deleted file mode 100644 index 7616a6b235f31..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes-overview.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "LINQ to XML Axes Overview" -ms.date: 07/20/2015 -ms.assetid: 9161f151-cfa8-4408-94ba-08a9ba3a486d ---- -# LINQ to XML Axes Overview (Visual Basic) -After you have created an XML tree or loaded an XML document into an XML tree, you can query it to find elements and attributes and retrieve their values. You retrieve collections through the *axis methods*, also called *axes*. Some of the axes are methods in the and classes that return collections. Some of the axes are extension methods in the class. The axes that are implemented as extension methods operate on collections, and return collections. - - As described in [XElement Class Overview](xelement-class-overview.md), an object represents a single element node. The content of an element can be complex (sometimes called structured content), or it can be a simple element. A simple element can be empty or can contain a value. If the node contains structured content, you can use the various axis methods to retrieve enumerations of descendant elements. The most commonly used axis methods are and . - - In addition to the axis methods, which return collections, there are two more methods that you will commonly use in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. The method returns a single . The method returns a single . - - For many purposes, LINQ queries provide the most powerful way to examine a tree, extract data from it, and transform it. LINQ queries operate on objects that implement , and the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axes return of collections, and of collections. You need these collections to perform your queries. - - In addition to the axis methods that retrieve collections of elements and attributes, there are axis methods that allow you to iterate through the tree in great detail. For example, instead of dealing with elements and attributes, you can work with the nodes of the tree. Nodes are a finer level of granularity than elements and attributes. When working with nodes, you can examine XML comments, text nodes, processing instructions, and more. This functionality is important, for example, to someone who is writing a word processor and wants to save documents as XML. However, the majority of XML programmers are primarily concerned with elements, attributes, and their values. - -## Methods for Retrieving a Collection of Elements - The following is a summary of the methods of the class (or its base classes) that you call on an to return a collection of elements. - -|Method|Description| -|------------|-----------------| -||Returns an of of the ancestors of this element. An overload returns an of of the ancestors that have the specified .| -||Returns an of of the descendants of this element. An overload returns an of of the descendants that have the specified .| -||Returns an of of the child elements of this element. An overload returns an of of the child elements that have the specified .| -||Returns an of of the elements that come after this element. An overload returns an of of the elements after this element that have the specified .| -||Returns an of of the elements that come before this element. An overload returns an of of the elements before this element that have the specified .| -||Returns an of of this element and its ancestors. An overload returns an of of the elements that have the specified .| -||Returns an of of this element and its descendants. An overload returns an of of the elements that have the specified .| - -## Method for Retrieving a Single Element - The following method retrieves a single child from an object. - -|Method|Description| -|------------|-----------------| -||Returns the first child object that has the specified .| - -## Method for Retrieving a Collection of Attributes - The following method retrieves attributes from an object. - -|Method|Description| -|------------|-----------------| -||Returns an of of all of the attributes.| - -## Method for Retrieving a Single Attribute - The following method retrieves a single attribute from an object. - -|Method|Description| -|------------|-----------------| -||Returns the that has the specified .| - -## See also - -- [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes.md deleted file mode 100644 index a702e5ed7828e..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-axes.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "LINQ to XML Axes" -ms.date: 07/20/2015 -ms.assetid: ecd3bd00-28e5-4517-a59f-53bff39fd478 ---- -# LINQ to XML Axes (Visual Basic) -After you have created an XML tree or loaded an XML document into an XML tree, you can query it to find elements and attributes and retrieve their values. - - Before you can write any queries, you must understand the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axes. There are two kinds of axis methods: First, there are the methods that you call on a single object, object, or object. These methods operate on a single object and return a collection of , , or objects. Second, there are extension methods that operate on collections and return collections. The extension methods enumerate the source collection, call the appropriate axis method on each item in the collection, and concatenate the results. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[LINQ to XML Axes Overview (Visual Basic)](linq-to-xml-axes-overview.md)|Defines axes, and explains how they are used in the context of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries.| -|[How to: Retrieve a Collection of Elements (LINQ to XML) (Visual Basic)](how-to-retrieve-a-collection-of-elements-linq-to-xml.md)|Introduces the method. This method retrieves a collection of the child elements of an element.| -|[How to: Retrieve the Value of an Element (LINQ to XML) (Visual Basic)](how-to-retrieve-the-value-of-an-element-linq-to-xml.md)|Shows how to get the values of elements.| -|[How to: Filter on Element Names (LINQ to XML) (Visual Basic)](how-to-filter-on-element-names-linq-to-xml.md)|Shows how to filter on element names when using axes.| -|[How to: Chain Axis Method Calls (LINQ to XML) (Visual Basic)](how-to-chain-axis-method-calls-linq-to-xml.md)|Shows how to chain calls to axes methods.| -|[How to: Retrieve a Single Child Element (LINQ to XML) (Visual Basic)](how-to-retrieve-a-single-child-element-linq-to-xml.md)|Shows how to retrieve a single child element of an element, given the tag name of the child element.| -|[How to: Retrieve a Collection of Attributes (LINQ to XML) (Visual Basic)](how-to-retrieve-a-collection-of-attributes-linq-to-xml.md)|Introduces the method. This method retrieves the attributes of an element.| -|[How to: Retrieve a Single Attribute (LINQ to XML) (Visual Basic)](how-to-retrieve-a-single-attribute-linq-to-xml.md)|Shows how to retrieve a single attribute of an element, given the attribute name.| -|[How to: Retrieve the Value of an Attribute (LINQ to XML) (Visual Basic)](how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md)|Shows how to get the values of attributes.| -|[How to: Retrieve the Shallow Value of an Element (Visual Basic)](how-to-retrieve-the-shallow-value-of-an-element.md)|Shows how to retrieve the shallow value of an element.| -|[Language-Integrated Axes in Visual Basic (LINQ to XML)](language-integrated-axes.md)|Summarizes the Visual Basic integrated axes.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md deleted file mode 100644 index 4949dc11af2e5..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-classes-overview.md +++ /dev/null @@ -1,85 +0,0 @@ ---- -title: "LINQ to XML Classes Overview" -ms.date: 07/20/2015 -ms.assetid: f11b62b5-d522-4c23-92ae-23186dc16447 ---- -# LINQ to XML Classes Overview (Visual Basic) -This topic provides a list of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes in the namespace, and a short description of each. - -## LINQ to XML Classes - -### XAttribute Class - represents an XML attribute. For detailed information and examples, see [XAttribute Class Overview (Visual Basic)](xattribute-class-overview.md). - -### XCData Class - represents a CDATA text node. - -### XComment Class - represents an XML comment. - -### XContainer Class - is an abstract base class for all nodes that can have child nodes. The following classes derive from the class: - -- - -- - -### XDeclaration Class - represents an XML declaration. An XML declaration is used to declare the XML version and the encoding of a document. In addition, an XML declaration specifies whether the XML document is stand-alone. If a document is stand-alone, there are no external markup declarations, either in an external DTD, or in an external parameter entity referenced from the internal subset. - -### XDocument Class - represents an XML document. For detailed information and examples, see [XDocument Class Overview (Visual Basic)](xdocument-class-overview.md). - -### XDocumentType Class - represents an XML Document Type Definition (DTD). - -### XElement Class - represents an XML element. For detailed information and examples, see [XElement Class Overview (Visual Basic)](xelement-class-overview.md). - -### XName Class - represents names of elements () and attributes (). For detailed information and examples, see [XDocument Class Overview (Visual Basic)](xdocument-class-overview.md). - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is designed to make XML names as straightforward as possible. Due to their complexity, XML names are often considered to be an advanced topic in XML. Arguably, this complexity comes not from namespaces, which developers use regularly in programming, but from namespace prefixes. Namespace prefixes can be useful to reduce the keystrokes required when you input XML, or to make XML easier to read. However, prefixes are often just a shortcut for using the full XML namespace, and are not required in most cases. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies XML names by resolving all prefixes to their corresponding XML namespace. Prefixes are available, if they are required, through the method. - - It is possible, if necessary, to control namespace prefixes. In some circumstances, if you are working with other XML systems, such as XSLT or XAML, you need to control namespace prefixes. For example, if you have an XPath expression that uses namespace prefixes and is embedded in an XSLT stylesheet, you must make sure that your XML document is serialized with namespace prefixes that match those used in the XPath expression. - -### XNamespace Class - represents a namespace for an or . Namespaces are a component of an . - -### XNode Class - is an abstract class that represents the nodes of an XML tree. The following classes derive from the class: - -- - -- - -- - -- - -- - -### XNodeDocumentOrderComparer Class - provides functionality to compare nodes for their document order. - -### XNodeEqualityComparer Class - provides functionality to compare nodes for value equality. - -### XObject Class - is an abstract base class of and . It provides annotation and event functionality. - -### XObjectChange Class - specifies the event type when an event is raised for an . - -### XObjectChangeEventArgs Class - provides data for the and events. - -### XProcessingInstruction Class - represents an XML processing instruction. A processing instruction communicates information to an application that processes the XML. - -### XText Class - represents a text node. In most cases, you do not have to use this class. This class is primarily used for mixed content. - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-events.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-events.md deleted file mode 100644 index 4c39082b4f13b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-events.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -title: "LINQ to XML Events" -ms.date: 07/20/2015 -ms.assetid: 34923928-b99c-4004-956e-38f6db25e910 ---- -# LINQ to XML Events (Visual Basic) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] events enable you to be notified when an XML tree is altered. - - You can add events to an instance of any . The event handler will then receive events for modifications to that and any of its descendants. For example, you can add an event handler to the root of the tree, and handle all modifications to the tree from that event handler. - - For examples of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] events, see and . - -## Types and Events - You use the following types when working with events: - -|Type|Description| -|----------|-----------------| -||Specifies the event type when an event is raised for an .| -||Provides data for the and events.| - - The following events are raised when you modify an XML tree: - -|Event|Description| -|-----------|-----------------| -||Occurs just before this or any of its descendants is going to change.| -||Occurs when an has changed or any of its descendants have changed.| - -## Example - -### Description - Events are useful when you want to maintain some aggregate information in an XML tree. For example, you may want maintain an invoice total that is the sum of the line items of the invoice. This example uses events to maintain the total of all of the child elements under the complex element `Items`. - -### Code - -```vb -Module Module1 - Dim WithEvents items As XElement = Nothing - Dim total As XElement = Nothing - Dim root As XElement = _ - - 0 - - - - Private Sub XObjectChanged( _ - ByVal sender As Object, _ - ByVal cea As XObjectChangeEventArgs) _ - Handles items.Changed - Select Case cea.ObjectChange - Case XObjectChange.Add - If sender.GetType() Is GetType(XElement) Then - total.Value = CStr(CInt(total.Value) + _ - CInt((DirectCast(sender, XElement)).Value)) - End If - If sender.GetType() Is GetType(XText) Then - total.Value = CStr(CInt(total.Value) + _ - CInt((DirectCast(sender, XText)).Value)) - End If - Case XObjectChange.Remove - If sender.GetType() Is GetType(XElement) Then - total.Value = CStr(CInt(total.Value) - _ - CInt((DirectCast(sender, XElement)).Value)) - End If - If sender.GetType() Is GetType(XText) Then - total.Value = CStr(CInt(total.Value) - _ - CInt((DirectCast(sender, XText)).Value)) - End If - End Select - Console.WriteLine("Changed {0} {1}", _ - sender.GetType().ToString(), _ - cea.ObjectChange.ToString()) - End Sub - - Sub Main() - total = root.(0) - items = root.(0) - items.SetElementValue("Item1", 25) - items.SetElementValue("Item2", 50) - items.SetElementValue("Item2", 75) - items.SetElementValue("Item3", 133) - items.SetElementValue("Item1", Nothing) - items.SetElementValue("Item4", 100) - Console.WriteLine("Total:{0}", CInt(total)) - Console.WriteLine(root) - End Sub -End Module -``` - -### Comments - This code produces the following output: - -```console -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XText Remove -Changed System.Xml.Linq.XText Add -Changed System.Xml.Linq.XElement Add -Changed System.Xml.Linq.XElement Remove -Changed System.Xml.Linq.XElement Add -Total:308 - - 308 - - 75 - 133 - 100 - - -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md deleted file mode 100644 index d46bd49d28915..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-for-xpath-users.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: "LINQ to XML for XPath Users" -ms.date: 07/20/2015 -ms.assetid: 0e64911c-a7cc-4c20-b927-ca99078b5656 ---- -# LINQ to XML for XPath Users (Visual Basic) - -This set of topics show a number of XPath expressions and their [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] equivalents. - - All of the examples use the XPath functionality in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] that is made available by the extension methods in . The examples execute both the XPath expression and the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] expression. Each example then compares the results of both queries, validating that the XPath expression is functionally equivalent to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query. As both types of queries return nodes from the same XML tree, the query result comparison is made using referential identity. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Comparison of XPath and LINQ to XML](../../../../csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md)|Provides an overview of the similarities and differences between XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].| -|[How to: Find a Child Element (XPath-LINQ to XML) (Visual Basic)](how-to-find-a-child-element-xpath-linq-to-xml.md)|Compares the XPath child element axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] method.

The associated XPath expression is:`"DeliveryNotes"`.| -|[How to: Find a List of Child Elements (XPath-LINQ to XML) (Visual Basic)](how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md)|Compares the XPath child elements axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axis.

The associated XPath expression is:`"./*"`| -|[How to: Find the Root Element (XPath-LINQ to XML) (Visual Basic)](how-to-find-the-root-element-xpath-linq-to-xml.md)|Compares how to get the root element with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"/PurchaseOrders"`| -|[How to: Find Descendant Elements (XPath-LINQ to XML) (Visual Basic)](how-to-find-descendant-elements-xpath-linq-to-xml.md)|Compares how to get the descendant elements with a particular name with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"//Name"`| -|[How to: Filter on an Attribute (XPath-LINQ to XML) (Visual Basic)](how-to-filter-on-an-attribute-xpath-linq-to-xml.md)|Compares how to get the descendant elements with a specified name, and with an attribute with a specified value with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"./Address[@Type='Shipping']"`| -|[How to: Find Related Elements (XPath-LINQ to XML) (Visual Basic)](how-to-find-related-elements-xpath-linq-to-xml.md)|Compares how to get an element selecting on an attribute that is referred to by the value of another element with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"./Customer[@CustomerID=/Root/Orders/Order[12]/CustomerID]"`| -|[How to: Find Elements in a Namespace (XPath-LINQ to XML) (Visual Basic)](how-to-find-elements-in-a-namespace.md)|Compares the use of the XPath class with the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] property of the class for working with XML namespaces.

The associated XPath expression is:`"./aw:*"`| -|[How to: Find Preceding Siblings (XPath-LINQ to XML) (Visual Basic)](how-to-find-preceding-siblings-xpath-linq-to-xml.md)|Compares the XPath `preceding-sibling` axis to the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] child axis.

The associated XPath expression is:`"preceding-sibling::*"`| -|[How to: Find Descendants of a Child Element (XPath-LINQ to XML) (Visual Basic)](how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md)|Compares how to get the descendant elements of a child element with a particular name with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"./Paragraph//Text/text()"`| -|[How to: Find a Union of Two Location Paths (XPath-LINQ to XML) (Visual Basic)](how-to-find-a-union-of-two-location-paths-xpath.md)|Compares the use of the union operator, |, in XPath with the standard query operator in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:"//Category|//Price"| -|[How to: Find Sibling Nodes (XPath-LINQ to XML) (Visual Basic)](how-to-find-sibling-nodes-xpath-linq-to-xml.md)|Compares how to find all siblings of a node that have a specific name with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"../Book"`| -|[How to: Find an Attribute of the Parent (XPath-LINQ to XML) (Visual Basic)](how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md)|Compares how to navigate to the parent element and find an associated attribute using XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"../@id"`| -|[How to: Find Attributes of Siblings with a Specific Name (XPath-LINQ to XML) (Visual Basic)](how-to-find-attributes-of-siblings-with-a-specific-name.md)|Compares how to find specific attributes of the siblings of the context node with XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"../Book/@id"`| -|[How to: Find Elements with a Specific Attribute (XPath-LINQ to XML) (Visual Basic)](how-to-find-elements-with-a-specific-attribute.md)|Compares how to find al elements containing a specific attribute using XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"./*[@Select]"`| -|[How to: Find Child Elements Based on Position (XPath-LINQ to XML) (Visual Basic)](how-to-find-child-elements-based-on-position.md)|Compares how to find an element based on its relative position using XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"Test[position() >= 2 and position() <= 4]"`| -|[How to: Find the Immediate Preceding Sibling (XPath-LINQ to XML) (Visual Basic)](how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md)|Compares how to find the immediate preceding sibling of a node using XPath and [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)].

The associated XPath expression is:`"preceding-sibling::*[1]"`| - -## See also - -- -- [Querying XML Trees (Visual Basic)](querying-xml-trees.md) -- [Process XML Data Using the XPath Data Model](../../../../standard/data/xml/process-xml-data-using-the-xpath-data-model.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-overview.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-overview.md deleted file mode 100644 index f22709b49887c..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-overview.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: "LINQ to XML Overview" -ms.date: 07/20/2015 -ms.assetid: 502661e0-bc5d-438d-94c2-7efb63bb6fbd ---- -# LINQ to XML Overview (Visual Basic) -XML has been widely adopted as a way to format data in many contexts. For example, you can find XML on the Web, in configuration files, in Microsoft Office Word files, and in databases. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is an up-to-date, redesigned approach to programming with XML. It provides the in-memory document-modification capabilities of the Document Object Model (DOM) and supports LINQ query expressions. Although these query expressions are syntactically different from XPath, they provide similar functionality. - -## LINQ to XML Developers - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] targets a variety of developers. For an average developer who just wants to get something done, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] makes XML easier by providing a query experience that is similar to SQL. With just a bit of study, programmers can learn to write succinct and powerful queries in their programming language of choice. - - Professional developers can use [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to greatly increase their productivity. With [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], they can write less code that is more expressive, more compact, and more powerful. They can use query expressions from multiple data domains at the same time. - -## What Is LINQ to XML? - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is a LINQ-enabled, in-memory XML programming interface that enables you to work with XML from within the .NET Framework programming languages. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is like the Document Object Model (DOM) in that it brings the XML document into memory. You can query and modify the document, and after you modify it you can save it to a file or serialize it and send it over the Internet. However, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] differs from DOM: It provides a new object model that is lighter weight and easier to work with, and that takes advantage of language features in Visual Basic. - - The most important advantage of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is its integration with Language-Integrated Query (LINQ). This integration enables you to write queries on the in-memory XML document to retrieve collections of elements and attributes. The query capability of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is comparable in functionality (although not in syntax) to XPath and XQuery. The integration of LINQ in Visual Basic provides stronger typing, compile-time checking, and improved debugger support. - - Another advantage of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is the ability to use query results as parameters to and object constructors enables a powerful approach to creating XML trees. This approach, called *functional construction*, enables developers to easily transform XML trees from one shape to another. - - For example, you might have a typical XML purchase order as described in [Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md). By using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you could run the following query to obtain the part number attribute value for every item element in the purchase order: - -```vb -Dim partNos = _ - From item In purchaseOrder... _ - Select item.@PartNumber -``` - - As another example, you might want a list, sorted by part number, of the items with a value greater than $100. To obtain this information, you could run the following query: - -```vb -Dim partNos = _ -From item In purchaseOrder... _ -Where (item..Value * _ - item..Value) > 100 _ -Order By item..Value _ -Select item -``` - - In addition to these LINQ capabilities, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides an improved XML programming interface. Using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can: - -- Load XML from files or streams. - -- Serialize XML to files or streams. - -- Create XML from scratch by using functional construction. - -- Query XML using XPath-like axes. - -- Manipulate the in-memory XML tree by using methods such as , , , and . - -- Validate XML trees using XSD. - -- Use a combination of these features to transform XML trees from one shape into another. - -## Creating XML Trees - IOne of the most significant advantages of programming with [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is that it is easy to create XML trees. For example, to create a small XML tree, you can write code as follows: - -```vb -Dim contacts = _ - - - Patrick Hines - 206-555-0144 - 425-555-0145 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` - - The Visual Basic compiler translates XML literals into [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] method calls. - - For more information, see [Creating XML Trees (Visual Basic)](creating-xml-trees.md). - -## See also - -- -- [Getting Started (LINQ to XML)](getting-started-linq-to-xml.md) -- [Overview of LINQ to XML in Visual Basic](../../language-features/xml/overview-of-linq-to-xml.md) -- [XML](../../language-features/xml/index.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md deleted file mode 100644 index 99f5d42acf827..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-programming-overview.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "LINQ to XML Programming Overview" -ms.date: 07/20/2015 -ms.assetid: a7c07d0a-1fae-4610-ae51-56dd7075cc14 ---- -# LINQ to XML Programming Overview (Visual Basic) -These topics provide high-level overview information about the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes, as well as detailed information about three of the most important classes. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Functional vs. Procedural Programming (LINQ to XML) (Visual Basic)](functional-vs-procedural-programming-linq-to-xml.md)|Provides a high level view of the two principle approaches to writing LINQ to XML applications.| -|[LINQ to XML Classes Overview (Visual Basic)](linq-to-xml-classes-overview.md)|Provides an overview of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes.| -|[XElement Class Overview (Visual Basic)](xelement-class-overview.md)|Introduces the class, which represents XML elements. is one of the fundamental classes in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] class hierarchy.| -|[XAttribute Class Overview (Visual Basic)](xattribute-class-overview.md)|Introduces the class, which represents XML attributes.| -|[XDocument Class Overview (Visual Basic)](xdocument-class-overview.md)|Introduces the class, which represents XML documents.| -|[How to: Build LINQ to XML Examples (Visual Basic)](how-to-build-linq-to-xml-examples.md)|Contains the `Imports` statements that are required to build the LINQ to XML examples.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-security.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-security.md deleted file mode 100644 index 3788f2690125b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-security.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: "LINQ to XML Security" -ms.date: 07/20/2015 -ms.assetid: d99b4af2-d447-4a3b-991b-6da0231a8637 ---- -# LINQ to XML Security (Visual Basic) -This topic describes security issues associated with LINQ to XML. In addition, it provides some guidance for mitigating security exposure. - -## LINQ to XML Security Overview - LINQ to XML is designed more for programming convenience than for server-side applications with stringent security requirements. Most XML scenarios consist of processing trusted XML documents, rather than processing untrusted XML documents that are uploaded to a server. LINQ to XML is optimized for these scenarios. - - If you must process untrusted data from unknown sources, Microsoft recommends that you use an instance of the class that has been configured to filter out known XML denial of service (DoS) attacks. - - If you have configured an to mitigate denial of service attacks, you can use that reader to populate a LINQ to XML tree and still benefit from the programmer productivity enhancements of LINQ to XML. Many mitigation techniques involve creating readers that are configured to mitigate the security issue, and then instantiating an XML tree through the configured reader. - - XML is intrinsically vulnerable to denial of service attacks because documents are unbounded in size, depth, element name size, and more. Regardless of the component that you use to process XML, you should always be prepared to recycle the application domain if it uses excessive resources. - -## Mitigation of XML, XSD, XPath, and XSLT Attacks - LINQ to XML is built upon and . LINQ to XML supports XSD and XPath through extension methods in the and namespaces. Using the , , and classes in conjunction with LINQ to XML, you can invoke XSLT to transform XML trees. - - If you are operating in a less secure environment, there are a number of security issues that are associated with XML and the use of the classes in , , , and . These issues include, but are not limited to, the following: - -- XSD, XPath, and XSLT are string-based languages in which you can specify operations that consume a lot of time or memory. It is the responsibility of application programmers who take XSD, XPath, or XSLT strings from untrusted sources to validate that the strings are not malicious, or to monitor and mitigate the possibility that evaluating these strings will lead to excessive system resource consumption. - -- XSD schemas (including inline schemas) are inherently vulnerable to denial of service attacks; you should not accept schemas from untrusted sources. - -- XSD and XSLT can include references to other files, and such references can result in cross-zone and cross-domain attacks. - -- External entities in DTDs can result in cross-zone and cross-domain attacks. - -- DTDs are vulnerable to denial of service attacks. - -- Exceptionally deep XML documents can pose denial of service issues; you might want to limit the depth of XML documents. - -- Do not accept supporting components, such as , , and objects, from untrusted assemblies. - -- Read data in chunks to mitigate large document attacks. - -- Script blocks in XSLT style sheets can expose a number of attacks. - -- Validate carefully before constructing dynamic XPath expressions. - -## LINQ to XML Security Issues - The security issues in this topic are not presented in any particular order. All issues are important and should be addressed as appropriate. - - A successful elevation of privilege attack gives a malicious assembly more control over its environment. A successful elevation of privilege attack can result in disclosure of data, denial of service, and more. - - Applications should not disclose data to users who are not authorized to see that data. - - Denial of service attacks cause the XML parser or LINQ to XML to consume excessive amounts of memory or CPU time. Denial of service attacks are considered to be less severe than elevation of privilege attacks or disclosure of data attacks. However, they are important in a scenario where a server needs to process XML documents from untrusted sources. - -### Exceptions and Error Messages Might Reveal Data - The description of an error might reveal data, such as the data being transformed, file names, or implementation details. Error messages should not be exposed to callers that are not trusted. You should catch all errors and report errors with your own custom error messages. - -### Do Not Call CodeAccessPermissions.Assert in an Event Handler - An assembly can have lesser or greater permissions. An assembly that has greater permissions has greater control over the computer and its environments. - - If code in an assembly with greater permissions calls in an event handler, and then the XML tree is passed to a malicious assembly that has restricted permissions, the malicious assembly can cause an event to be raised. Because the event runs code that is in the assembly with greater permissions, the malicious assembly would then be operating with elevated privileges. - - Microsoft recommends that you never call in an event handler. - -### DTDs are Not Secure - Entities in DTDs are inherently not secure. It is possible for a malicious XML document that contains a DTD to cause the parser to use all memory and CPU time, causing a denial of service attack. Therefore, in LINQ to XML, DTD processing is turned off by default. You should not accept DTDs from untrusted sources. - - One example of accepting DTDs from untrusted sources is a Web application that allows Web users to upload an XML file that references a DTD and a DTD file. Upon validation of the file, a malicious DTD could execute a denial of service attack on your server. Another example of accepting DTDs from untrusted sources is to reference a DTD on a network share that also allows anonymous FTP access. - -### Avoid Excessive Buffer Allocation - Application developers should be aware that extremely large data sources can lead to resource exhaustion and denial of service attacks. - - If a malicious user submits or uploads a very large XML document, it could cause LINQ to XML to consume excessive system resources. This can constitute a denial of service attack. To prevent this, you can set the property, and create a reader that is then limited in the size of document that it can load. You then use the reader to create the XML tree. - - For example, if you know that the maximum expected size of your XML documents coming from an untrusted source will be less than 50K bytes, set to 100,000. This will not encumber your processing of XML documents, and at the same time it will mitigate denial of service threats where documents might be uploaded that would consume large amounts of memory. - -### Avoid Excess Entity Expansion - One of the known denial of service attacks when using a DTD is a document that causes excessive entity expansion. To prevent this, you can set the property, and create a reader that is then limited in the number of characters that result from entity expansion. You then use the reader to create the XML tree. - -### Limit the Depth of the XML Hierarchy - One possible denial of service attack is when a document is submitted that has excessive depth of hierarchy. To prevent this, you can wrap a in your own class that counts the depth of elements. If the depth exceeds a predetermined reasonable level, you can terminate the processing of the malicious document. - -### Protect Against Untrusted XmlReader or XmlWriter Implementations - Administrators should verify that any externally supplied or implementations have strong names and have been registered in the machine configuration. This prevents malicious code masquerading as a reader or writer from being loaded. - -### Periodically Free Objects that Reference XName - To protect against certain kinds of attacks, application programmers should free all objects that reference an object in the application domain on a regular basis. - -### Protect Against Random XML Names - Applications that take data from untrusted sources should consider using an that is wrapped in custom code to inspect for the possibility of random XML names and namespaces. If such random XML names and namespaces are detected, the application can then terminate the processing of the malicious document. - - You might want to limit the number of names in any given namespace (including names in no namespace) to a reasonable limit. - -### Annotations Are Accessible by Software Components that Share a LINQ to XML Tree - LINQ to XML could be used to build processing pipelines in which different application components load, validate, query, transform, update, and save XML data that is passed between components as XML trees. This can help optimize performance, because the overhead of loading and serializing objects to XML text is done only at the ends of the pipeline. Developers must be aware, however, that all annotations and event handlers created by one component are accessible to other components. This can create a number of vulnerabilities if the components have different levels of trust. To build secure pipelines across less trusted components, you must serialize LINQ to XML objects to XML text before passing the data to an untrusted component. - - Some security is provided by the common language runtime (CLR). For example, a component that does not include a private class cannot access annotations keyed by that class. However, annotations can be deleted by components that cannot read them. This could be used as a tampering attack. - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-dom.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-dom.md deleted file mode 100644 index 743d0566d9f95..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-dom.md +++ /dev/null @@ -1,129 +0,0 @@ ---- -title: "LINQ to XML vs. DOM" -ms.date: 07/20/2015 -ms.assetid: 18c36130-d598-40b7-9007-828232252978 ---- -# LINQ to XML vs. DOM (Visual Basic) -This section describes some key differences between [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] and the current predominant XML programming API, the W3C Document Object Model (DOM). - -## New Ways to Construct XML Trees - In the W3C DOM, you build an XML tree from the bottom up; that is, you create a document, you create elements, and then you add the elements to the document. - - For example, the following would be a typical way to create an XML tree using the Microsoft implementation of DOM, : - -```vb -Dim doc As XmlDocument = New XmlDocument() -Dim name As XmlElement = doc.CreateElement("Name") -name.InnerText = "Patrick Hines" -Dim phone1 As XmlElement = doc.CreateElement("Phone") -phone1.SetAttribute("Type", "Home") -phone1.InnerText = "206-555-0144" -Dim phone2 As XmlElement = doc.CreateElement("Phone") -phone2.SetAttribute("Type", "Work") -phone2.InnerText = "425-555-0145" -Dim street1 As XmlElement = doc.CreateElement("Street1") -street1.InnerText = "123 Main St" -Dim city As XmlElement = doc.CreateElement("City") -city.InnerText = "Mercer Island" -Dim state As XmlElement = doc.CreateElement("State") -state.InnerText = "WA" -Dim postal As XmlElement = doc.CreateElement("Postal") -postal.InnerText = "68042" -Dim address As XmlElement = doc.CreateElement("Address") -address.AppendChild(street1) -address.AppendChild(city) -address.AppendChild(state) -address.AppendChild(postal) -Dim contact As XmlElement = doc.CreateElement("Contact") -contact.AppendChild(name) -contact.AppendChild(phone1) -contact.AppendChild(phone2) -contact.AppendChild(address) -Dim contacts As XmlElement = doc.CreateElement("Contacts") -contacts.AppendChild(contact) -doc.AppendChild(contacts) -Console.WriteLine(doc.OuterXml) -``` - - This style of coding does not visually provide much information about the structure of the XML tree. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] supports this approach to constructing an XML tree, but also supports an alternative approach, *functional construction*. In Visual Basic, functional construction uses XML literals to build an XML tree. - - Here is how you would construct the same XML tree by using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] functional construction: - -```vb -Dim contacts = _ - - - Patrick Hines - 206-555-0144 - 425-555-0145 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` - - Notice that indenting the code to construct the XML tree shows the structure of the underlying XML. - - For more information, see [Creating XML Trees (Visual Basic)](creating-xml-trees.md). - -## Working Directly with XML Elements - When you program with XML, your primary focus is usually on XML elements and perhaps on attributes. In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can work directly with XML elements and attributes. For example, you can do the following: - -- Create XML elements without using a document object at all. This simplifies programming when you have to work with fragments of XML trees. - -- Load `T:System.Xml.Linq.XElement` objects directly from an XML file. - -- Serialize `T:System.Xml.Linq.XElement` objects to a file or a stream. - - Compare this to the W3C DOM, in which the XML document is used as a logical container for the XML tree. In DOM, XML nodes, including elements and attributes, must be created in the context of an XML document. Here is a fragment of the code to create a name element in DOM: - -```vb -Dim doc As XmlDocument = New XmlDocument() -Dim name As XmlElement = doc.CreateElement("Name") -name.InnerText = "Patrick Hines" -doc.AppendChild(name) -``` - - If you want to use an element across multiple documents, you must import the nodes across documents. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] avoids this layer of complexity. - - When using LINQ to XML, you use the class only if you want to add a comment or processing instruction at the root level of the document. - -## Simplified Handling of Names and Namespaces - Handling names, namespaces, and namespace prefixes is generally a complex part of XML programming. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] simplifies names and namespaces by eliminating the requirement to deal with namespace prefixes. If you want to control namespace prefixes, you can. But if you decide to not explicitly control namespace prefixes, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] will assign namespace prefixes during serialization if they are required, or will serialize using default namespaces if they are not. If default namespaces are used, there will be no namespace prefixes in the resulting document. For more information, see [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md). - - Another problem with the DOM is that it does not let you change the name of a node. Instead, you have to create a new node and copy all the child nodes to it, losing the original node identity. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] avoids this problem by enabling you to set the property on a node. - -## Static Method Support for Loading XML - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] lets you load XML by using static methods, instead of instance methods. This simplifies loading and parsing. For more information, see [How to: Load XML from a File (Visual Basic)](how-to-load-xml-from-a-file.md). - -## Removal of Support for DTD Constructs - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] further simplifies XML programming by removing support for entities and entity references. The management of entities is complex, and is rarely used. Removing their support increases performance and simplifies the programming interface. When a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] tree is populated, all DTD entities are expanded. - -## Support for Fragments - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] does not provide an equivalent for the `XmlDocumentFragment` class. In many cases, however, the `XmlDocumentFragment` concept can be handled by the result of a query that is typed as of , or of . - -## Support for XPathNavigator - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides support for through extension methods in the namespace. For more information, see . - -## Support for White Space and Indentation - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] handles white space more simply than the DOM. - - A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can do this by preserving white space when you load or parse the XML and disabling formatting when you serialize the XML. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] stores white space as an node, instead of having a specialized node type, as the DOM does. - -## Support for Annotations - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] elements support an extensible set of annotations. This is useful for tracking miscellaneous information about an element, such as schema information, information about whether the element is bound to a UI, or any other kind of application-specific information. For more information, see [LINQ to XML Annotations](linq-to-xml-annotations.md). - -## Support for Schema Information - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides support for XSD validation through extension methods in the namespace. You can validate that an XML tree complies with an XSD. You can populate the XML tree with the post-schema-validation infoset (PSVI). For more information, see [How to: Validate Using XSD](how-to-validate-using-xsd-linq-to-xml.md) and . - -## See also - -- [Getting Started (LINQ to XML)](getting-started-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md deleted file mode 100644 index 6af69e46e8089..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml-vs-other-xml-technologies.md +++ /dev/null @@ -1,51 +0,0 @@ ---- -title: "LINQ to XML vs. Other XML Technologies2" -ms.date: 07/20/2015 -ms.assetid: 72ce3a82-ffc6-488c-98e7-b9b40f3591ec ---- -# LINQ to XML vs. Other XML Technologies -This topic compares [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to the following XML technologies: , XSLT, MSXML, and XmlLite. This information can help you decide which technology to use. - - For a comparison of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] to the Document Object Model (DOM), see [LINQ to XML vs. DOM (Visual Basic)](linq-to-xml-vs-dom.md). - -## LINQ to XML vs. XmlReader - is a fast, forward-only, non-caching parser. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is implemented on top of , and they are tightly integrated. However, you can also use by itself. - - For example, suppose you are building a Web service that will parse hundreds of XML documents per second, and the documents have the same structure, meaning that you only have to write one implementation of the code to parse the XML. In this case, you would probably want to use by itself. - - In contrast, if you are building a system that parses many smaller XML documents, and each one is different, you would want to take advantage of the productivity improvements that [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] provides. - -## LINQ to XML vs. XSLT - Both [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] and XSLT provide extensive XML document transformation capabilities. XSLT is a rule-based, declarative approach. Advanced XSLT programmers write XSLT in a functional programming style that emphasizes a stateless approach. Transformations can be written using pure functions that are implemented without side effects. This rule-based or functional approach is unfamiliar to many developers, and can be difficult and time-consuming to learn. - - XSLT can be a very productive system that yields high-performance applications. For example, some big Web companies use XSLT as a way to generate HTML from XML that has been pulled from a variety of data stores. The managed XSLT engine compiles XSLT to CLR code, and performs even better in some scenarios than the native XSLT engine. - - However, XSLT does not take advantage of the C# and Visual Basic knowledge that many developers have. It requires developers to write code in a different and complex programming language. Using two non-integrated development systems such as C# (or Visual Basic) and XSLT results in software systems that are more difficult to develop and maintain. - - After you have mastered [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query expressions, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] transformations are a powerful technology that is easy to use. Basically, you form your XML document by using functional construction, pulling in data from various sources, constructing objects dynamically, and assembling the whole into a new XML tree. The transformation can generate a completely new document. Constructing transformations in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is relatively easy and intuitive, and the resulting code is readable. This reduces development and maintenance costs. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is not intended to replace XSLT. XSLT is still the tool of choice for complicated and document-centric XML transformations, especially if the structure of the document is not well defined. - - XSLT has the advantage of being a World Wide Web Consortium (W3C) standard. If you have a requirement that you use only technologies that are standards, XSLT might be more appropriate. - - XSLT is XML, and therefore can be programmatically manipulated. - -## LINQ to XML vs. MSXML - MSXML is the COM-based technology for processing XML that is included with Microsoft Windows. MSXML provides a native implementation of the DOM with support for XPath and XSLT. It also contains the SAX2 non-caching, event-based parser. - - MSXML performs well, is secure by default in most scenarios, and can be accessed in Internet Explorer for performing client-side XML processing in AJAX-style applications. MSXML can be used from any programming language that supports COM, including C++, JavaScript, and Visual Basic 6.0. - - MSXML is not recommended for use in managed code based on the common language runtime (CLR). - -## LINQ to XML vs. XmlLite - XmlLite is a non-caching, forward only, pull parser. Developers primarily use XmlLite with C++. It is not recommended for developers to use XmlLite with managed code. - - The main advantage of XmlLite is that it is a lightweight, fast XML parser that is secure in most scenarios. Its threat surface area is very small. If you have to parse untrusted documents and you want to protect against attacks such as denial of service or exposure of data, XmlLite might be a good option. - - XmlLite is not integrated with Language-Integrated Query (LINQ). It does not yield the programmer productivity improvements that are the motivating force behind LINQ. - -## See also - -- [Getting Started (LINQ to XML)](getting-started-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml.md deleted file mode 100644 index bfc5387331952..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/linq-to-xml.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "LINQ to XML" -ms.date: 07/20/2015 -ms.assetid: f7386556-a6b9-40d5-92b6-e8701dc2c63e ---- -# LINQ to XML (Visual Basic) -LINQ to XML provides an in-memory XML programming interface that leverages the .NET Language-Integrated Query (LINQ) Framework. LINQ to XML uses the latest .NET Framework language capabilities and is comparable to an updated, redesigned Document Object Model (DOM) XML programming interface. - - The LINQ family of technologies provides a consistent query experience for objects (LINQ to Objects), relational databases (LINQ to SQL), and XML (LINQ to XML). - -## In this Section - [Getting Started (LINQ to XML)](getting-started-linq-to-xml.md) - Provides introductory information about LINQ to XML, including a conceptual overview and an overview of the classes. - - [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) - Provides conceptual and how-to information about programming with LINQ to XML. - - [Reference (LINQ to XML)](reference-linq-to-xml.md) - Provides pointers to the LINQ to XML managed reference documentation. - -## See also - -- [Overview of LINQ to XML in Visual Basic](../../language-features/xml/overview-of-linq-to-xml.md) -- [XML](../../language-features/xml/index.md) -- [Language-Integrated Query (LINQ) (Visual Basic)](index.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/maintaining-name-value-pairs.md b/docs/visual-basic/programming-guide/concepts/linq/maintaining-name-value-pairs.md deleted file mode 100644 index e8d4fb2b18311..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/maintaining-name-value-pairs.md +++ /dev/null @@ -1,119 +0,0 @@ ---- -title: "Maintaining Name-Value Pairs" -ms.date: 07/20/2015 -ms.assetid: 57ac2072-d9f5-432b-84f0-a889c62fd813 ---- -# Maintaining Name/Value Pairs (Visual Basic) -Many applications have to maintain information that is best kept as name/value pairs. This information might be configuration information or global settings. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] contains some methods that make it easy to keep a set of name/value pairs. You can either keep the information as attributes or as a set of child elements. - - One difference between keeping the information as attributes or as child elements is that attributes have the constraint that there can be only one attribute with a particular name for an element. This limitation does not apply to child elements. - -## SetAttributeValue and SetElementValue - The two methods that facilitate keeping name/value pairs are and . These two methods have similar semantics. - - can add, modify, or remove attributes of an element. - -- If you call with a name of an attribute that does not exist, the method creates a new attribute and adds it to the specified element. - -- If you call with a name of an existing attribute and with some specified content, the contents of the attribute are replaced with the specified content. - -- If you call with a name of an existing attribute, and specify null for the content, the attribute is removed from its parent. - - can add, modify, or remove child elements of an element. - -- If you call with a name of a child element that does not exist, the method creates a new element and adds it to the specified element. - -- If you call with a name of an existing element and with some specified content, the contents of the element are replaced with the specified content. - -- If you call with a name of an existing element, and specify null for the content, the element is removed from its parent. - -## Example - The following example creates an element with no attributes. It then uses the method to create and maintain a list of name/value pairs. - -```vb -' Create an element with no content. -Dim root As XElement = - -' Add a number of name/value pairs as attributes. -root.SetAttributeValue("Top", 22) -root.SetAttributeValue("Left", 20) -root.SetAttributeValue("Bottom", 122) -root.SetAttributeValue("Right", 300) -root.SetAttributeValue("DefaultColor", "Color.Red") -Console.WriteLine(root) - -' Replace the value of Top. -root.SetAttributeValue("Top", 10) -Console.WriteLine(root) - -' Remove DefaultColor. -root.SetAttributeValue("DefaultColor", Nothing) -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - - - -``` - -## Example - The following example creates an element with no child elements. It then uses the method to create and maintain a list of name/value pairs. - -```vb -' Create an element with no content. -Dim root As XElement = - -' Add a number of name/value pairs as elements. -root.SetElementValue("Top", 22) -root.SetElementValue("Left", 20) -root.SetElementValue("Bottom", 122) -root.SetElementValue("Right", 300) -root.SetElementValue("DefaultColor", "Color.Red") -Console.WriteLine(root) -Console.WriteLine("----") - -' Replace the value of Top. -root.SetElementValue("Top", 10) -Console.WriteLine(root) -Console.WriteLine("----") - -' Remove DefaultColor. -root.SetElementValue("DefaultColor", Nothing) -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - - 22 - 20 - 122 - 300 - Color.Red - ----- - - 10 - 20 - 122 - 300 - Color.Red - ----- - - 10 - 20 - 122 - 300 - -``` - -## See also - -- -- -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md deleted file mode 100644 index bb652f692bb45..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/mixed-declarative-code-imperative-code-bugs-linq-to-xml.md +++ /dev/null @@ -1,175 +0,0 @@ ---- -title: "Mixed Declarative Code-Imperative Code Bugs (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: f12b1ab4-bb92-4b92-a648-0525e45b3ce7 ---- -# Mixed Declarative Code/Imperative Code Bugs (LINQ to XML) (Visual Basic) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] contains various methods that allow you to modify an XML tree directly. You can add elements, delete elements, change the contents of an element, add attributes, and so on. This programming interface is described in [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md). If you are iterating through one of the axes, such as , and you are modifying the XML tree as you iterate through the axis, you can end up with some strange bugs. - - This problem is sometimes known as "The Halloween Problem". - -## Definition of the Problem - When you write some code using LINQ that iterates through a collection, you are writing code in a declarative style. It is more akin to describing *what* you want, rather that *how* you want to get it done. If you write code that 1) gets the first element, 2) tests it for some condition, 3) modifies it, and 4) puts it back into the list, then this would be imperative code. You are telling the computer *how* to do what you want done. - - Mixing these styles of code in the same operation is what leads to problems. Consider the following: - - Suppose you have a linked list with three items in it (a, b, and c): - - `a -> b -> c` - - Now, suppose that you want to move through the linked list, adding three new items (a', b', and c'). You want the resulting linked list to look like this: - - `a -> a' -> b -> b' -> c -> c'` - - So you write code that iterates through the list, and for every item, adds a new item right after it. What happens is that your code will first see the `a` element, and insert `a'` after it. Now, your code will move to the next node in the list, which is now `a'`! It happily adds a new item to the list, `a''`. - - How would you solve this in the real world? Well, you might make a copy of the original linked list, and create a completely new list. Or if you are writing purely imperative code, you might find the first item, add the new item, and then advance twice in the linked list, advancing over the element that you just added. - -## Adding While Iterating - For example, suppose you want to write some code that for every element in a tree, you want to create a duplicate element: - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -For Each e As XElement In root.Elements() - root.Add(New XElement(e.Name, e.Value)) -Next -``` - - This code goes into an infinite loop. The `foreach` statement iterates through the `Elements()` axis, adding new elements to the `doc` element. It ends up iterating also through the elements it just added. And because it allocates new objects with every iteration of the loop, it will eventually consume all available memory. - - You can fix this problem by pulling the collection into memory using the standard query operator, as follows: - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -For Each e As XElement In root.Elements().ToList() - root.Add(New XElement(e.Name, e.Value)) -Next -Console.WriteLine(root) -``` - - Now the code works. The resulting XML tree is the following: - -```xml - - 1 - 2 - 3 - 1 - 2 - 3 - -``` - -## Deleting While Iterating - If you want to delete all nodes at a certain level, you might be tempted to write code like the following: - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -For Each e As XElement In root.Elements() - e.Remove() -Next -Console.WriteLine(root) -``` - - However, this does not do what you want. In this situation, after you have removed the first element, A, it is removed from the XML tree contained in root, and the code in the Elements method that is doing the iterating cannot find the next element. - - The preceding code produces the following output: - -```xml - - 2 - 3 - -``` - - The solution again is to call to materialize the collection, as follows: - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -For Each e As XElement In root.Elements().ToList() - e.Remove() -Next -Console.WriteLine(root) -``` - - This produces the following output: - -```xml - -``` - - Alternatively, you can eliminate the iteration altogether by calling on the parent element: - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -root.RemoveAll() -Console.WriteLine(root) -``` - -## Why Can't LINQ Automatically Handle This? - One approach would be to always bring everything into memory instead of doing lazy evaluation. However, it would be very expensive in terms of performance and memory use. In fact, if LINQ and (LINQ to XML) were to take this approach, it would fail in real-world situations. - - Another possible approach would be to put in some sort of transaction syntax into LINQ, and have the compiler attempt to analyze the code and determine if any particular collection needed to be materialized. However, attempting to determine all code that has side-effects is incredibly complex. Consider the following code: - -```vb -Dim z = _ - From e In root.Elements() _ - Where (TestSomeCondition(e)) _ - Select DoMyProjection(e) -``` - - Such analysis code would need to analyze the methods TestSomeCondition and DoMyProjection, and all methods that those methods called, to determine if any code had side-effects. But the analysis code could not just look for any code that had side-effects. It would need to select for just the code that had side-effects on the child elements of `root` in this situation. - - LINQ to XML does not attempt to do any such analysis. - - It is up to you to avoid these problems. - -## Guidance - First, do not mix declarative and imperative code. - - Even if you know exactly the semantics of your collections and the semantics of the methods that modify the XML tree, if you write some clever code that avoids these categories of problems, your code will need to be maintained by other developers in the future, and they may not be as clear on the issues. If you mix declarative and imperative coding styles, your code will be more brittle. - - If you write code that materializes a collection so that these problems are avoided, note it with comments as appropriate in your code, so that maintenance programmers will understand the issue. - - Second, if performance and other considerations allow, use only declarative code. Don't modify your existing XML tree. Generate a new one. - -```vb -Dim root As XElement = _ - - 1 - 2 - 3 - -Dim newRoot As XElement = New XElement("Root", _ - root.Elements(), root.Elements()) -Console.WriteLine(newRoot) -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md deleted file mode 100644 index 1848c2f81366b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/modifying-elements-attributes-and-nodes-in-an-xml-tree.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -title: "Modifying Elements, Attributes, and Nodes in an XML Tree1" -ms.date: 07/20/2015 -ms.assetid: 865cf54e-f8ac-4871-863b-a3e6fc61a4b9 ---- -# Modifying Elements, Attributes, and Nodes in an XML Tree -The following table summarizes the methods and properties that you can use to modify an element, its child elements, or its attributes. - - The following methods modify an . - -|Method|Description| -|------------|-----------------| -||Replaces an element with parsed XML.| -||Removes all content (child nodes and attributes) of an element.| -||Removes the attributes of an element.| -||Replaces all content (child nodes and attributes) of an element.| -||Replaces the attributes of an element.| -||Sets the value of an attribute. Creates the attribute if it doesn't exist. If the value is set to `null`, removes the attribute.| -||Sets the value of a child element. Creates the element if it doesn't exist. If the value is set to `null`, removes the element.| -||Replaces the content (child nodes) of an element with the specified text.| -||Sets the value of an element.| - - The following methods modify an . - -|Method|Description| -|------------|-----------------| -||Sets the value of an attribute.| -||Sets the value of an attribute.| - - The following methods modify an (including an or ). - -|Method|Description| -|------------|-----------------| -||Replaces a node with new content.| - - The following methods modify an (an or ). - -|Method|Description| -|------------|-----------------| -||Replaces the children nodes with new content.| - -## See also - -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md deleted file mode 100644 index dec7049bb0bcb..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/modifying-xml-trees-linq-to-xml.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Modifying XML Trees (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 4ae511a5-4fc9-4178-9c8e-761357deae3f ---- -# Modifying XML Trees (LINQ to XML) (Visual Basic) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is an in-memory store for an XML tree. After you load or parse an XML tree from a source, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] lets you modify that tree in place, and then serialize the tree, perhaps saving it to a file or sending it to a remote server. - - When you modify a tree in place, you use certain methods, such as . - - However, there is another approach, which is to use functional construction to generate a new tree with a different shape. Depending on the types of changes that you need to make to your XML tree, and depending on the size of the tree, this approach can be more robust and easier to develop. The first topic in this section compares these two approaches. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) (Visual Basic)](in-memory-xml-tree-modification-vs-functional-construction.md)|Compares modifying an XML tree in memory to functional construction.| -|[Adding Elements, Attributes, and Nodes to an XML Tree (Visual Basic)](adding-elements-attributes-and-nodes-to-an-xml-tree.md)|Provides information about adding elements, attributes, or nodes to an XML tree.| -|[Modifying Elements, Attributes, and Nodes in an XML Tree](modifying-elements-attributes-and-nodes-in-an-xml-tree.md)|Provides information about modifying existing elements, attributes, or nodes.| -|[Removing Elements, Attributes, and Nodes from an XML Tree (Visual Basic)](removing-elements-attributes-and-nodes-from-an-xml-tree.md)|Provides information about removing elements, attributes, or nodes from the XML tree.| -|[Maintaining Name/Value Pairs (Visual Basic)](maintaining-name-value-pairs.md)|Describes how to maintain application information that is best kept as name/value pairs, such as configuration information or global settings.| -|[How to: Change the Namespace for an Entire XML Tree (Visual Basic)](how-to-change-the-namespace-for-an-entire-xml-tree.md)|Shows how to move an XML tree from one namespace into another.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md deleted file mode 100644 index 88977772b8de9..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/namespaces-overview-linq-to-xml.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Namespaces Overview (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: b8eb31fa-4b26-4acf-8050-6e705687f458 ---- -# Namespaces Overview (LINQ to XML) - -This topic introduces namespaces, the class, and the class. - -## XML Names - -XML names are often a source of complexity in XML programming. An XML name consists of an XML namespace (also called an XML namespace URI) and a local name. An XML namespace is similar to a namespace in a .NET Framework-based program. It enables you to uniquely qualify the names of elements and attributes. This helps avoid name conflicts between various parts of an XML document. When you have declared an XML namespace, you can select a local name that only has to be unique within that namespace. - - Another aspect of XML names is XML *namespace prefixes*. XML prefixes cause most of the complexity of XML names. These prefixes enable you to create a shortcut for an XML namespace, which makes the XML document more concise and understandable. However, XML prefixes depend on their context to have meaning, which adds complexity. For example, the XML prefix `aw` could be associated with one XML namespace in one part of an XML tree, and with a different XML namespace in a different part of the XML tree. - -When using [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] with Visual Basic and XML literals, you must use namespace prefixes when working with documents in namespaces. - -In [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], the class that represents XML names is . XML names appear frequently throughout the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] API, and wherever an XML name is required, you will find an parameter. However, you rarely work directly with an . contains an implicit conversion from string. - -For more information, see and . diff --git a/docs/visual-basic/programming-guide/concepts/linq/parsing-xml.md b/docs/visual-basic/programming-guide/concepts/linq/parsing-xml.md deleted file mode 100644 index 5fa0adddca3ae..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/parsing-xml.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Parsing XML" -ms.date: 07/20/2015 -ms.assetid: 5bcbd7e2-d9f1-4c8f-80d6-39915fe17bd1 ---- -# Parsing XML (Visual Basic) -The topics in this section describe how to parse XML documents. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[How to: Parse a String (Visual Basic)](how-to-parse-a-string.md)|Shows how to parse a string to create an XML tree.| -|[How to: Load XML from a File (Visual Basic)](how-to-load-xml-from-a-file.md)|Shows how to load XML from a URI using the method.| -|[Preserving White Space while Loading or Parsing XML](preserving-white-space-while-loading-or-parsing-xml.md)|Describes how to control the white space behavior of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] while loading XML trees.| -|[How to: Catch Parsing Errors (Visual Basic)](how-to-catch-parsing-errors.md)|Shows how to detect badly formed or invalid XML.| -|[How to: Create a Tree from an XmlReader (Visual Basic)](how-to-create-a-tree-from-an-xmlreader.md)|Shows how to create an XML tree directly from an .| -|[How to: Stream XML Fragments from an XmlReader (Visual Basic)](how-to-stream-xml-fragments-from-an-xmlreader.md)|Shows how to stream XML fragments by using an .

When you have to process arbitrarily large XML files, it might not be feasible to load the whole XML tree into memory. Instead, you can stream XML fragments.| - -## See also - -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/performance-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/performance-linq-to-xml.md deleted file mode 100644 index ca6611a6b3e5f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/performance-linq-to-xml.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Performance (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 155557f6-5d7e-4784-9d00-f42092a28857 ---- -# Performance (LINQ to XML) (Visual Basic) -This section provides information about performance in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], specifically the performance of functional construction and queries. - -## In This Section - [Performance of Chained Queries (LINQ to XML) (Visual Basic)](performance-of-chained-queries-linq-to-xml.md) - Provides performance information about chained [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. - - [Atomized XName and XNamespace Objects (LINQ to XML) (Visual Basic)](atomized-xname-and-xnamespace-objects-linq-to-xml.md) - Provides performance information about the atomization of and objects. - - [Pre-Atomization of XName Objects (LINQ to XML) (Visual Basic)](pre-atomization-of-xname-objects-linq-to-xml.md) - Describes a technique to pre-atomize and objects. This can significantly improve performance in some scenarios. - - [Statically Compiled Queries (LINQ to XML) (Visual Basic)](statically-compiled-queries-linq-to-xml.md) - Provides performance information about statically compiled queries, in contrast to the parsing and processing that must be done by an XPath expression evaluator. - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md deleted file mode 100644 index 2f0d2331cc564..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/performance-of-chained-queries-linq-to-xml.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: "Performance of Chained Queries (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 589f2adc-69f9-404d-b9d6-4c28dabea7f7 ---- - -# Performance of Chained Queries (LINQ to XML) (Visual Basic) - -One of the most important benefits of LINQ (and LINQ to XML) is that chained queries can perform as well as a single larger, more complicated query. - -A chained query is a query that uses another query as its source. For example, in the following simple code, `query2` has `query1` as its source: - -```vb -Dim root As New XElement("Root", New XElement("Child", 1), New XElement("Child", 2), New XElement("Child", 3), New XElement("Child", 4)) - -Dim query1 = From x In root.Elements("Child") Where CInt(x) >= 3x - -Dim query2 = From e In query1 Where CInt(e) Mod 2 = 0e - -For Each i As var In query2 - Console.WriteLine("{0}", CInt(i)) -Next -``` - -This example produces the following output: - -```console -4 -``` - -This chained query provides the same performance profile as iterating through a linked list. - -- The axis has essentially the same performance as iterating through a linked list. is implemented as an iterator with deferred execution. This means that it does some work in addition to iterating through the linked list, such as allocating the iterator object and keeping track of execution state. This work can be divided into two categories: the work that is done at the time the iterator is set up, and the work that is done during each iteration. The setup work is a small, fixed amount of work and the work done during each iteration is proportional to the number of items in the source collection. - -- In `query1`, the `Where` clause causes the query to call the method. This method is also implemented as an iterator. The setup work consists of instantiating the delegate that will reference the lambda expression, plus the normal setup for an iterator. With each iteration, the delegate is called to execute the predicate. The setup work and the work done during each iteration is the similar to the work done while iterating through the axis. - -- In `query1`, the select clause causes the query to call the method. This method has the same performance profile as the method. - -- In `query2`, both the `Where` clause and the `Select` clause have the same performance profile as in `query1`. - - The iteration through `query2` is therefore directly proportional to the number of items in the source of the first query, in other words, linear time. - -## See also - -- [Performance (LINQ to XML) (Visual Basic)](performance-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md deleted file mode 100644 index c034c54387a82..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/pre-atomization-of-xname-objects-linq-to-xml.md +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: "Pre-Atomization of XName Objects (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 06ea104b-f44c-4bb2-9c34-889ae025c80d ---- -# Pre-Atomization of XName Objects (LINQ to XML) (Visual Basic) - -One way to improve performance in LINQ to XML is to pre-atomize objects. Pre-atomization means that you assign a string to an object before you create the XML tree by using the constructors of the and classes. Then, instead of passing a string to the constructor, which would use the implicit conversion from string to , you pass the initialized object. - -This improves performance when you create a large XML tree in which specific names are repeated. To do this, you declare and initialize objects before you construct the XML tree, and then use the objects instead of specifying strings for the element and attribute names. This technique can yield significant performance gains if you are creating a large number of elements (or attributes) with the same name. - -You should test pre-atomization with your scenario to decide if you should use it. - -## Example - -The following example demonstrates this: - -```vb -Dim root1 As XName = "Root" -Dim data As XName = "Data" -Dim id As XName = "ID" - -Dim root2 As New XElement(root1, New XElement(data, New XAttribute(id, "1"), "4,100,000"), - New XElement(data, New XAttribute(id, "2"), "3,700,000"), - New XElement(data, New XAttribute(id, "3"), "1,150,000")) - -Console.WriteLine(root2) -``` - -This example produces the following output: - -```xml - - 4,100,000 - 3,700,000 - 1,150,000 - -``` - -The following example shows the same technique where the XML document is in a namespace: - -```vb -Dim aw As XNamespace = "http://www.adventure-works.com" -Dim root1 As XName = aw + "Root" -Dim data As XName = aw + "Data" -Dim id As XName = "ID" - -Dim root2 As New XElement(root1, New XAttribute(XNamespace.Xmlns + "aw", aw), - New XElement(data, New XAttribute(id, "1"), "4,100,000"), - New XElement(data, New XAttribute(id, "2"), "3,700,000"), - New XElement(data, New XAttribute(id, "3"), "1,150,000")) - -Console.WriteLine(root2) -``` - -This example produces the following output: - -```xml - - 4,100,000 - 3,700,000 - 1,150,000 - -``` - -The following example is more similar to what you will likely encounter in the real world. In this example, the content of the element is supplied by a query: - -```vb -Dim root1 As XName = "Root" -Dim data As XName = "Data" -Dim id As XName = "ID" - -Dim sw As Stopwatch = Stopwatch.StartNew() -Dim root2 As New XElement(root1, From i In Enumerable.Range(1, 100000) - Select New XElement(data, New XAttribute(ID, i), i * 5)) -sw.Stop() -Console.WriteLine($"Time to construct: {sw.ElapsedMilliseconds} milliseconds") -``` - -The previous example performs better than the following example, in which names are not pre-atomized: - -```vb -Dim sw As Stopwatch = Stopwatch.StartNew() -Dim root As New XElement("Root", From i In Enumerable.Range(1, 100000) - Select New XElement("Data", New XAttribute("ID", i), i * 5)) -sw.Stop() -Console.WriteLine($"Time to construct: {sw.ElapsedMilliseconds} milliseconds") -``` - -## See also - -- [Performance (LINQ to XML) (Visual Basic)](performance-linq-to-xml.md) -- [Atomized XName and XNamespace Objects (LINQ to XML) (Visual Basic)](atomized-xname-and-xnamespace-objects-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml.md b/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml.md deleted file mode 100644 index 9547b38cb8856..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-loading-or-parsing-xml.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Preserving White Space while Loading or Parsing XML2" -ms.date: 07/20/2015 -ms.assetid: ef6518e0-2c8d-462c-8b92-a16e9dc737ad ---- -# Preserving White Space while Loading or Parsing XML -This topic describes how to control the white space behavior of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. - - This topic describes the white space behavior of methods that populate XML trees. For information about controlling white space when you serialize XML trees, see [Preserving White Space While Serializing](preserving-white-space-while-serializing.md). - -## Behavior of Methods that Populate XML Trees - The following methods in the and classes populate an XML tree. You can populate an XML tree from a file, a , an , or a string: - -- - -- - -- - -- - - If the method does not take as an argument, the method will not preserve insignificant white space. - - In most cases, if the method takes as an argument, you can optionally preserve insignificant white space as text nodes in the XML tree. However, if the method is loading the XML from an , then the determines whether white space will be preserved or not. Setting will have no effect. - - With these methods, if white space is preserved, insignificant white space is inserted into the XML tree as nodes. If white space is not preserved, text nodes are not inserted. - - You can create an XML tree by using an . Nodes that are written to the are populated in the tree. However, when you build an XML tree using this method, all nodes are preserved, regardless of whether the node is white space or not, or whether the white space is significant or not. - -## See also - -- [Parsing XML (Visual Basic)](parsing-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-serializing.md b/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-serializing.md deleted file mode 100644 index 3c71d724c8733..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/preserving-white-space-while-serializing.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -title: "Preserving White Space While Serializing2" -ms.date: 07/20/2015 -ms.assetid: 2d7abbd4-37f4-422b-89dd-0a694b5edc17 ---- -# Preserving White Space While Serializing -This topic describes how to control white space when serializing an XML tree. - - A common scenario is to read indented XML, create an in-memory XML tree without any white space text nodes (that is, not preserving white space), perform some operations on the XML, and then save the XML with indentation. When you serialize the XML with formatting, only significant white space in the XML tree is preserved. This is the default behavior for [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - - Another common scenario is to read and modify XML that has already been intentionally indented. You might not want to change this indentation in any way. To do this in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you preserve white space when you load or parse the XML and disable formatting when you serialize the XML. - -## White Space Behavior of Methods that Serialize XML Trees - The following methods in the and classes serialize an XML tree. You can serialize an XML tree to a file, a , or an . The `ToString` method serializes to a string. - -- - -- - -- [XElement.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) - -- [XDocument.ToString()](xref:System.Xml.Linq.XNode.ToString%2A?displayProperty=nameWithType) - - If the method does not take as an argument, then the method will format (indent) the serialized XML. In this case, all insignificant white space in the XML tree is discarded. - - If the method does take as an argument, then you can specify that the method not format (indent) the serialized XML. In this case, all white space in the XML tree is preserved. - -## See also - -- [Serializing XML Trees (Visual Basic)](serializing-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/programming-guide-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/programming-guide-linq-to-xml.md deleted file mode 100644 index d415a94d17cf3..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/programming-guide-linq-to-xml.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: "Programming Guide (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: f1f942bf-3404-4354-b4c5-4fe35e37a02b ---- -# Programming Guide (LINQ to XML) (Visual Basic) -This section provides conceptual and how-to information about programming with [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. - -## Who Should Read This Documentation - This documentation targets developers who already understand Visual Basic and some basic aspects of the .NET Framework. - - The goal of this documentation is to make [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] easy to use for all kinds of developers. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] makes XML programming easier. You do not have to be an expert developer to use it. - - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] relies heavily on generic classes. Therefore, is very important that you understand the use of generic types and classes. For more information, see [Generic Types in Visual Basic](../../language-features/data-types/generic-types.md). - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md)|Provides an overview of the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] classes, and detailed information about three of the most important classes: , , and .| -|[Creating XML Trees (Visual Basic)](creating-xml-trees.md)|Provides conceptual and task-based information about creating XML trees. You can create XML trees by using functional construction, or by parsing XML text from a string or a file. You can also use an to populate an XML tree.| -|[Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md)|Provides detailed information about creating XML trees that use namespaces.| -|[Serializing XML Trees (Visual Basic)](serializing-xml-trees.md)|Describes multiple approaches to serializing an XML tree, and gives guidance on which approach to use.| -|[LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md)|Enumerates and describes the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axis methods, which you must understand before you can write [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries.| -|[Querying XML Trees (Visual Basic)](querying-xml-trees.md)|Provides common examples of querying XML trees.| -|[Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md)|Like the Document Object Model (DOM), [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] enables you to modify an XML tree in place.| -|[Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md)|Provides information about annotations, events, streaming, and other advanced scenarios.| -|[LINQ to XML Security (Visual Basic)](linq-to-xml-security.md)|Describes security issues associated with LINQ to XML and provides some guidance for mitigating security exposure.| -|[Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md)|Contains the sample XML documents that are used by many examples in this documentation.| - -## See also - -- [Getting Started (LINQ to XML)](getting-started-linq-to-xml.md) -- [LINQ to XML (Visual Basic)](linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/programming-with-nodes.md b/docs/visual-basic/programming-guide/concepts/linq/programming-with-nodes.md deleted file mode 100644 index fd567660e31c6..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/programming-with-nodes.md +++ /dev/null @@ -1,170 +0,0 @@ ---- -title: "Programming with Nodes" -ms.date: 07/20/2015 -ms.assetid: d8422a9b-dd37-44a3-8aac-2237ed9561e0 ---- -# Programming with Nodes (Visual Basic) -[!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] developers who need to write programs such as an XML editor, a transform system, or a report writer often need to write programs that work at a finer level of granularity than elements and attributes. They often need to work at the node level, manipulating text nodes, processing instructions, and comments. This topic provides some details about programming at the node level. - -## Node Details - There are a number of details of programming that a programmer working at the node level should know. - -### Parent Property of Children Nodes of XDocument is Set to Null - The property contains the parent , not the parent node. Child nodes of have no parent . Their parent is the document, so the property for those nodes is set to null. - - The following example demonstrates this: - -```vb -Dim doc As XDocument = XDocument.Parse("") -Console.WriteLine(doc.Nodes().OfType(Of XComment).First().Parent Is Nothing) -Console.WriteLine(doc.Root.Parent Is Nothing) -``` - - This example produces the following output: - -```console -True -True -``` - -### Adjacent Text Nodes are Possible - In a number of XML programming models, adjacent text nodes are always merged. This is sometimes called normalization of text nodes. [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] does not normalize text nodes. If you add two text nodes to the same element, it will result in adjacent text nodes. However, if you add content specified as a string rather than as an node, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] might merge the string with an adjacent text node. - - The following example demonstrates this: - -```vb -Dim xmlTree As XElement = Content -Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) - -' This does not add a new text node. -xmlTree.Add("new content") -Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) - -'// This does add a new, adjacent text node. -xmlTree.Add(New XText("more text")) -Console.WriteLine(xmlTree.Nodes().OfType(Of XText)().Count()) -``` - - This example produces the following output: - -```console -1 -1 -2 -``` - -### Empty Text Nodes are Possible - In some XML programming models, text nodes are guaranteed to not contain the empty string. The reasoning is that such a text node has no impact on serialization of the XML. However, for the same reason that adjacent text nodes are possible, if you remove the text from a text node by setting its value to the empty string, the text node itself will not be deleted. - -```vb -Dim xmlTree As XElement = Content -Dim textNode As XText = xmlTree.Nodes().OfType(Of XText)().First() - -' The following line does not cause the removal of the text node. -textNode.Value = "" - -Dim textNode2 As XText = xmlTree.Nodes().OfType(Of XText)().First() -Console.WriteLine(">>{0}<<", textNode2) -``` - - This example produces the following output: - -```console ->><< -``` - -### An Empty Text Node Impacts Serialization - If an element contains only a child text node that is empty, it is serialized with the long tag syntax: ``. If an element contains no child nodes whatsoever, it is serialized with the short tag syntax: ``. - -```vb -Dim child1 As XElement = New XElement("Child1", _ - New XText("") _ -) -Dim child2 As XElement = New XElement("Child2") -Console.WriteLine(child1) -Console.WriteLine(child2) -``` - - This example produces the following output: - -```xml - - -``` - -### Namespaces are Attributes in the LINQ to XML Tree - Even though namespace declarations have identical syntax to attributes, in some programming interfaces, such as XSLT and XPath, namespace declarations are not considered to be attributes. However, in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], namespaces are stored as objects in the XML tree. If you iterate through the attributes for an element that contains a namespace declaration, you will see the namespace declaration as one of the items in the returned collection. - - The property indicates whether an attribute is a namespace declaration. - -```vb -Dim root As XElement = _ - -For Each att As XAttribute In root.Attributes() - Console.WriteLine("{0} IsNamespaceDeclaration:{1}", att, _ - att.IsNamespaceDeclaration) -Next -``` - - This example produces the following output: - -```console -xmlns="http://www.adventure-works.com" IsNamespaceDeclaration:True -xmlns:fc="www.fourthcoffee.com" IsNamespaceDeclaration:True -AnAttribute="abc" IsNamespaceDeclaration:False -``` - -### XPath Axis Methods Do Not Return Child White Space of XDocument - [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] allows for child text nodes of an , as long as the text nodes contain only white space. However, the XPath object model does not include white space as child nodes of a document, so when you iterate through the children of an using the axis, white space text nodes will be returned. However, when you iterate through the children of an using the XPath axis methods, white space text nodes will not be returned. - -```vb -' Create a document with some white space child nodes of the document. -Dim root As XDocument = XDocument.Parse( _ -"" & _ -vbNewLine & "" & vbNewLine & "" & vbNewLine, _ -LoadOptions.PreserveWhitespace) - -' Count the white space child nodes using LINQ to XML. -Console.WriteLine(root.Nodes().OfType(Of XText)().Count()) - -' Count the white space child nodes using XPathEvaluate. -Dim nodes As IEnumerable = CType(root.XPathEvaluate("text()"), IEnumerable) -Console.WriteLine(nodes.OfType(Of XText)().Count()) -``` - - This example produces the following output: - -```console -3 -0 -``` - -### XDeclaration Objects are not Nodes - When you iterate through the children nodes of an , you will not see the XML declaration object. It is a property of the document, not a child node of it. - -```vb -Dim doc As XDocument = _ - - - -doc.Save("Temp.xml") -Console.WriteLine(File.ReadAllText("Temp.xml")) - -' This shows that there is only one child node of the document. -Console.WriteLine(doc.Nodes().Count()) -``` - - This example produces the following output: - -```xml - - -1 -``` - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md b/docs/visual-basic/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md deleted file mode 100644 index 5cf22cd7c9943..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/projecting-xml-in-a-different-shape.md +++ /dev/null @@ -1,231 +0,0 @@ ---- -title: "Projecting XML in a Different Shape" -ms.date: 07/20/2015 -ms.assetid: 2da7ec97-34f7-443d-9a48-b162ac58236b ---- -# Projecting XML in a Different Shape (Visual Basic) -This topic shows an example of projecting XML that is in a different shape than the source XML. - - Many typical XML transformations consist of chained queries, as in this example. It is common to start with some form of XML, project intermediate results as collections of anonymous types or named types, and then finally to project the results back into XML that is in an entirely different shape than the source XML. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style and text of each paragraph. Finally, the example projects XML with a different shape. This example builds on the previous examples in this tutorial. The new statement that does the projection is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - Public Function ParagraphText(ByVal e As XElement) As String - Dim w As XNamespace = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ - ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (Not (styleRelation Is Nothing)) Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = ParagraphText(para.ParagraphNode) _ - } - - ' Following is the new code that projects XML in a new shape - Dim root As XElement = _ - - <%= _ - From p In paraWithText _ - Select _ - - <%= p.StyleName %> - <%= p.Text %> - _ - %> - - - Console.WriteLine(root) - End Sub -End Module -``` - - This example produces the following output: - -```xml - - - Heading1 - Parsing WordprocessingML with LINQ to XML - - - Normal - - - - Normal - The following example prints to the console. - - - Normal - - - - Code - Imports System - - - Code - - - - Code - Class Program - - - Code - Public Shared Sub Main(ByVal args() As String) - - - Code - Console.WriteLine("Hello World") - - - Code - End Sub - - - Code - End Class - - - Normal - - - - Normal - This example produces the following output: - - - Normal - - - - Code - Hello World - - -``` - -## Next Steps - In the next example, you'll query to find all the text in a Word document: - -- [Finding Text in Word Documents (Visual Basic)](finding-text-in-word-documents.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md deleted file mode 100644 index 05cee71f250d1..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/projections-and-transformations-linq-to-xml.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: "Projections and Transformations (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 297de224-b625-44cf-8c00-186b6189aa0e ---- -# Projections and Transformations (LINQ to XML) (Visual Basic) -This section provides examples of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] projections and transformations. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[How to: Work with Dictionaries Using LINQ to XML (Visual Basic)](how-to-work-with-dictionaries-using-linq-to-xml.md)|Shows how to transform dictionaries to XML, and how to transform XML into dictionaries.| -|[How to: Transform the Shape of an XML Tree (Visual Basic)](how-to-transform-the-shape-of-an-xml-tree.md)|Shows how to transform the shape of an XML document.| -|[How to: Control the Type of a Projection (Visual Basic)](how-to-control-the-type-of-a-projection.md)|Shows how to control the type of a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.| -|[How to: Project a New Type (LINQ to XML) (Visual Basic)](how-to-project-a-new-type-linq-to-xml.md)|Shows how to project a collection of a user-defined type from a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.| -|[How to: Project an Object Graph (Visual Basic)](how-to-project-an-object-graph.md)|Shows how to project a more complex object graph from a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.| -|[How to: Project an Anonymous Type (Visual Basic)](how-to-project-an-anonymous-type.md)|Shows how to project a collection of anonymous objects from a [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] query.| -|[How to: Generate Text Files from XML (Visual Basic)](how-to-generate-text-files-from-xml.md)|Shows how to transform an XML file to a non-XML text file.| -|[How to: Generate XML from CSV Files (Visual Basic)](how-to-generate-xml-from-csv-files.md)|Shows how to use LINQ to parse a CSV file and generate XML from it.| - -## See also - -- [Querying XML Trees (Visual Basic)](querying-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md b/docs/visual-basic/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md deleted file mode 100644 index 2f1c6b96d5c9e..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/pure-functional-transformations-of-xml.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: "Pure Functional Transformations of XML" -ms.date: 07/20/2015 -ms.assetid: 5e19b74a-7773-4b58-b110-953ffd364c55 ---- -# Pure Functional Transformations of XML (Visual Basic) -This section provides a functional transformation tutorial for XML. This includes explanations of the main concepts and language constructs that you must understand to use functional transformations, and examples of using functional transformations to manipulate an XML document. Although this tutorial provides LINQ to XML code examples, all of the underlying concepts also apply to other LINQ technologies. - - The [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) tutorial provides a series of examples, each building on the previous one. These examples demonstrate the pure functional transformational approach to manipulating XML. - - This tutorial assumes a working knowledge of Visual Basic. Detailed semantics of the language constructs are not provided in this tutorial, but links are provided to the language documentation as appropriate. - - A working knowledge of basic computer science concepts and XML, including XML namespaces, is also assumed. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md)|Describes functional transformations and defines the relevant terminology.| -|[Tutorial: Deferred Execution (Visual Basic)](tutorial-deferred-execution.md)|Describes lazy evaluation and deferred execution in detail.| -|[Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md)|A tutorial that demonstrates a functional transformation.| - -## See also - -- [Querying XML Trees (Visual Basic)](querying-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md b/docs/visual-basic/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md deleted file mode 100644 index f069d55538f1b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/querying-an-xdocument-vs-querying-an-xelement.md +++ /dev/null @@ -1,111 +0,0 @@ ---- -title: "Querying an XDocument vs. Querying an XElement" -ms.date: 07/20/2015 -ms.assetid: 2d111f84-0ded-4cde-8d93-5440557a726d ---- -# Querying an XDocument vs. Querying an XElement (Visual Basic) -When you load a document via , you will notice that you have to write queries slightly differently than when you load via . - -## Comparison of XDocument.Load and XElement.Load - When you load an XML document into an via , the at the root of the XML tree contains the root element of the loaded document. However, when you load the same XML document into an via , the root of the tree is an node, and the root element of the loaded document is the one allowed child node of the . The [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] axes operate relative to the root node. - - This first example loads an XML tree using . It then queries for the child elements of the root of the tree. - -```vb -' Create a simple document and write it to a file -File.WriteAllText("Test.xml", "" + Environment.NewLine + _ - " 1" + Environment.NewLine + _ - " 2" + Environment.NewLine + _ - " 3" + Environment.NewLine + _ - "") - -Console.WriteLine("Querying tree loaded with XElement.Load") -Console.WriteLine("----") -Dim doc As XElement = XElement.Load("Test.xml") -Dim childList As IEnumerable(Of XElement) = _ - From el In doc.Elements() _ - Select el -For Each e As XElement In childList - Console.WriteLine(e) -Next -``` - - As expected, this example produces the following output: - -```console -Querying tree loaded with XElement.Load ----- -1 -2 -3 -``` - - The following example is the same as the one above, with the exception that the XML tree is loaded into an instead of an . - -```vb -' Create a simple document and write it to a file -File.WriteAllText("Test.xml", "" + Environment.NewLine + _ - " 1" + Environment.NewLine + _ - " 2" + Environment.NewLine + _ - " 3" + Environment.NewLine + _ - "") - -Console.WriteLine("Querying tree loaded with XDocument.Load") -Console.WriteLine("----") -Dim doc As XDocument = XDocument.Load("Test.xml") -Dim childList As IEnumerable(Of XElement) = _ - From el In doc.Elements() _ - Select el -For Each e As XElement In childList - Console.WriteLine(e) -Next -``` - - This example produces the following output: - -```console -Querying tree loaded with XDocument.Load ----- - - 1 - 2 - 3 - -``` - - Notice that the same query returned the one `Root` node instead of the three child nodes. - - One approach to dealing with this is to use the property before accessing the axes methods, as follows: - -```vb -' Create a simple document and write it to a file -File.WriteAllText("Test.xml", "" + Environment.NewLine + _ - " 1" + Environment.NewLine + _ - " 2" + Environment.NewLine + _ - " 3" + Environment.NewLine + _ - "") - -Console.WriteLine("Querying tree loaded with XDocument.Load") -Console.WriteLine("----") -Dim doc As XDocument = XDocument.Load("Test.xml") -Dim childList As IEnumerable(Of XElement) = _ - From el In doc.Root.Elements() _ - Select el -For Each e As XElement In childList - Console.WriteLine(e) -Next -``` - - This query now performs in the same way as the query on the tree rooted in . The example produces the following output: - -```console -Querying tree loaded with XDocument.Load ----- -1 -2 -3 -``` - -## See also - -- [Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/querying-xml-trees.md b/docs/visual-basic/programming-guide/concepts/linq/querying-xml-trees.md deleted file mode 100644 index 607cfa9a878f5..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/querying-xml-trees.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: "Querying XML Trees" -ms.date: 07/20/2015 -ms.assetid: 2e35c1ab-08c8-4378-9ca8-8ff344756eda ---- -# Querying XML Trees (Visual Basic) -This section provides examples of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] queries. - - For more information about writing LINQ queries, see [Getting Started with LINQ in Visual Basic](getting-started-with-linq.md). - - After you have instantiated an XML tree, writing queries is the most effective way to extract data from the tree. Also, querying combined with functional construction enables you to generate a new XML document that has a different shape from the original document. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Basic Queries (LINQ to XML) (Visual Basic)](basic-queries-linq-to-xml.md)|Provides common examples of querying XML trees.| -|[Projections and Transformations (LINQ to XML) (Visual Basic)](projections-and-transformations-linq-to-xml.md)|Provides common examples of projecting from and transforming XML trees.| -|[Advanced Query Techniques (LINQ to XML) (Visual Basic)](advanced-query-techniques-linq-to-xml.md)|Provides query techniques that are useful in more advanced scenarios.| -|[LINQ to XML for XPath Users (Visual Basic)](linq-to-xml-for-xpath-users.md)|Presents a number of XPath expressions and their [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] equivalents.| -|[Pure Functional Transformations of XML (Visual Basic)](pure-functional-transformations-of-xml.md)|Presents a small tutorial on writing queries in the style of functional programming.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) -- [Getting Started with LINQ in Visual Basic](getting-started-with-linq.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/refactoring-into-pure-functions.md b/docs/visual-basic/programming-guide/concepts/linq/refactoring-into-pure-functions.md deleted file mode 100644 index 7c921a32477e9..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/refactoring-into-pure-functions.md +++ /dev/null @@ -1,106 +0,0 @@ ---- -title: "Refactoring Into Pure Functions" -ms.date: 07/20/2015 -ms.assetid: 99e7d27b-a3ff-4577-bdb2-5a8278d6d7af ---- - -# Refactoring Into Pure Functions (Visual Basic) - -An important aspect of pure functional transformations is learning how to refactor code using pure functions. - -As noted previously in this section, a pure function has two useful characteristics: - -- It has no side effects. The function does not change any variables or the data of any type outside of the function. - -- It is consistent. Given the same set of input data, it will always return the same output value. - - One way of transitioning to functional programming is to refactor existing code to eliminate unnecessary side effects and external dependencies. In this way, you can create pure function versions of existing code. - -This topic discusses what a pure function is and what it is not. The [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) tutorial shows how to manipulate a WordprocessingML document, and includes two examples of how to refactor using a pure function. - -## Eliminating Side Effects and External Dependencies - -The following examples contrast two non-pure functions and a pure function. - -### Non-Pure Function that Changes a Class Member - -In the following code, the `HyphenatedConcat` function is not a pure function, because it modifies the `aMember` data member in the class: - -```vb -Module Module1 - Dim aMember As String = "StringOne" - - Public Sub HyphenatedConcat(ByVal appendStr As String) - aMember = aMember & "-" & appendStr - End Sub - - Sub Main() - HyphenatedConcat("StringTwo") - Console.WriteLine(aMember) - End Sub -End Module -``` - -This code produces the following output: - -```console -StringOne-StringTwo -``` - -Note that it is irrelevant whether the data being modified has `public` or `private` access, or is a `shared` member or an instance member. A pure function does not change any data outside of the function. - -### Non-Pure Function that Changes an Argument - -Furthermore, the following version of this same function is not pure because it modifies the contents of its parameter, `sb`. - -```vb -Module Module1 - Public Sub HyphenatedConcat(ByVal sb As StringBuilder, ByVal appendStr As String) - sb.Append("-" & appendStr) - End Sub - - Sub Main() - Dim sb1 As StringBuilder = New StringBuilder("StringOne") - HyphenatedConcat(sb1, "StringTwo") - Console.WriteLine(sb1) - End Sub -End Module -``` - -This version of the program produces the same output as the first version, because the `HyphenatedConcat` function has changed the value (state) of its first parameter by invoking the member function. Note that this alteration occurs despite that fact that `HyphenatedConcat` uses call-by-value parameter passing. - -> [!IMPORTANT] -> For reference types, if you pass a parameter by value, it results in a copy of the reference to an object being passed. This copy is still associated with the same instance data as the original reference (until the reference variable is assigned to a new object). Call-by-reference is not necessarily required for a function to modify a parameter. - -### Pure Function - -This next version of the program hows how to implement the `HyphenatedConcat` function as a pure function. - -```vb -Module Module1 - Public Function HyphenatedConcat(ByVal s As String, ByVal appendStr As String) As String - Return (s & "-" & appendStr) - End Function - - Sub Main() - Dim s1 As String = "StringOne" - Dim s2 As String = HyphenatedConcat(s1, "StringTwo") - Console.WriteLine(s2) - End Sub -End Module -``` - -Again, this version produces the same line of output: `StringOne-StringTwo`. Note that to retain the concatenated value, it is stored in the intermediate variable `s2`. - -One approach that can be very useful is to write functions that are locally impure (that is, they declare and modify local variables) but are globally pure. Such functions have many of the desirable composability characteristics, but avoid some of the more convoluted functional programming idioms, such as having to use recursion when a simple loop would accomplish the same thing. - -## Standard Query Operators - -An important characteristic of the standard query operators is that they are implemented as pure functions. - -For more information, see [Standard Query Operators Overview (Visual Basic)](standard-query-operators-overview.md). - -## See also - -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) -- [Functional Programming vs. Imperative Programming (Visual Basic)](functional-programming-vs-imperative-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-a-pure-function.md b/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-a-pure-function.md deleted file mode 100644 index fcbb6450275ca..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-a-pure-function.md +++ /dev/null @@ -1,173 +0,0 @@ ---- -title: "Refactoring Using a Pure Function" -ms.date: 07/20/2015 -ms.assetid: af0ea62f-4f57-4868-b624-a85524055935 ---- -# Refactoring Using a Pure Function (Visual Basic) -The following example refactors the previous example, [Refactoring Using an Extension Method (Visual Basic)](refactoring-using-an-extension-method.md), to use a pure function In this example, the code to find the text of a paragraph is moved to the pure static method `ParagraphText`. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The refactored code is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb = New StringBuilder() - For Each s In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - ' This is a new method that assembles the paragraph text. - Public Function ParagraphText(ByVal e As XElement) As String - Dim w = e.Name.Namespace - Return (e..).StringConcatenate(Function(element) CStr(element)) - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ - ByVal defaultStyle As String) As String - If styleNode Is Nothing Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If styleRelation IsNot Nothing Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = ParagraphText(para.ParagraphNode) _ - } - - For Each p In paraWithText - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - End Sub -End Module -``` - - This example produces the same output as before the refactoring: - -```console -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >Imports System< -StyleName:Code >< -StyleName:Code >Class Program< -StyleName:Code > Public Shared Sub Main(ByVal args() As String)< -StyleName:Code > Console.WriteLine("Hello World")< -StyleName:Code > End Sub< -StyleName:Code >End Class< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - -### Next Steps - The next example shows how to project XML into a different shape: - -- [Projecting XML in a Different Shape (Visual Basic)](projecting-xml-in-a-different-shape.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) -- [Refactoring Using an Extension Method (Visual Basic)](refactoring-using-an-extension-method.md) -- [Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-an-extension-method.md b/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-an-extension-method.md deleted file mode 100644 index a577dc02b3d5c..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/refactoring-using-an-extension-method.md +++ /dev/null @@ -1,243 +0,0 @@ ---- -title: "Refactoring Using an Extension Method" -ms.date: 07/20/2015 -ms.assetid: d87ae99a-cfa9-4a31-a5e4-9d6437be6810 ---- -# Refactoring Using an Extension Method (Visual Basic) -This example builds on the previous example, [Retrieving the Text of the Paragraphs (Visual Basic)](retrieving-the-text-of-the-paragraphs.md), by refactoring the concatenation of strings using a pure function that is implemented as an extension method. - - The previous example used the standard query operator to concatenate multiple strings into one string. However, it is more convenient to write an extension method to do this, because the resulting query smaller and more simple. - -## Example - This example processes a WordprocessingML document, retrieving the paragraphs, the style of each paragraph, and the text of each paragraph. This example builds on the previous examples in this tutorial. - - The example contains multiple overloads of the `StringConcatenate` method. - - You can find instructions for creating the source document for this example in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```vb - _ -Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() -End Function - - _ -Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ -ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() -End Function - - _ -Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ -ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() -End Function - - _ -Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ -ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() -End Function -``` - -## Example - There are four overloads of the `StringConcatenate` method. One overload simply takes a collection of strings and returns a single string. Another overload can take a collection of any type, and a delegate that projects from a singleton of the collection to a string. There are two more overloads that allow you to specify a separator string. - - The following code uses all four overloads. - -```vb -Dim numbers As String() = {"one", "two", "three"} - -Console.WriteLine("{0}", numbers.StringConcatenate()) -Console.WriteLine("{0}", numbers.StringConcatenate(":")) - -Dim intNumbers As Integer() = {1, 2, 3} -Console.WriteLine("{0}", intNumbers.StringConcatenate(Function(i) i.ToString())) -Console.WriteLine("{0}", intNumbers.StringConcatenate(Function(i) i.ToString(), ":")) -``` - - This example produces the following output: - -```console -onetwothree -one:two:three: -123 -1:2:3: -``` - -## Example - Now, the example can be modified to take advantage of the new extension method: - -```vb -Imports - -Module Module1 - _ - Public Function StringConcatenate(ByVal source As IEnumerable(Of String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As String In source - sb.Append(s) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String)) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each s As T In source - sb.Append(s).Append(separator) - Next - Return sb.ToString() - End Function - - _ - Public Function StringConcatenate(Of T)(ByVal source As IEnumerable(Of T), _ - ByVal func As Func(Of T, String), ByVal separator As String) As String - Dim sb As StringBuilder = New StringBuilder() - For Each item As T In source - sb.Append(func(item)).Append(separator) - Next - Return sb.ToString() - End Function - - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ - ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Retrieve the text of each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = para.ParagraphNode...StringConcatenate(Function(e) CStr(e)) _ - } - - For Each p In paraWithText - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - - End Sub -End Module -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - -```console -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >Imports System< -StyleName:Code >< -StyleName:Code >Class Program< -StyleName:Code > Public Shared Sub Main(ByVal args() As String)< -StyleName:Code > Console.WriteLine("Hello World")< -StyleName:Code > End Sub< -StyleName:Code >End Class< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - - Note that this refactoring is a variant of refactoring into a pure function. The next topic will introduce the idea of factoring into pure functions in more detail. - -## Next Steps - The next example shows how to refactor this code in another way, by using pure functions: - -- [Refactoring Using a Pure Function (Visual Basic)](refactoring-using-a-pure-function.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) -- [Refactoring Into Pure Functions (Visual Basic)](refactoring-into-pure-functions.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/reference-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/reference-linq-to-xml.md deleted file mode 100644 index 17d1cfeeb7a73..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/reference-linq-to-xml.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: "Reference (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 0f4cc4b9-361d-4de2-b4c3-be7cbd5dd47b ---- -# Reference (LINQ to XML) -This topic contains links to the LINQ to XML reference topics. - -## In This Section - For reference documentation for the LINQ to XML classes, see . - - For reference documentation for the extension methods that help you validate XML trees against an XSD file, see . - - For reference documentation for the extension methods that enable you to evaluate XPath queries on an XML tree, see . - -## See also - -- [LINQ to XML (Visual Basic)](linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md deleted file mode 100644 index 7273d6896f4ff..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/removing-elements-attributes-and-nodes-from-an-xml-tree.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -title: "Removing Elements, Attributes, and Nodes from an XML Tree" -ms.date: 07/20/2015 -ms.assetid: 5cf21919-4360-4b49-b29d-58ea3164ac72 ---- -# Removing Elements, Attributes, and Nodes from an XML Tree (Visual Basic) -You can modify an XML tree, removing elements, attributes, and other types of nodes. - - Removing a single element or a single attribute from an XML document is straightforward. However, when removing collections of elements or attributes, you should first materialize a collection into a list, and then delete the elements or attributes from the list. The best approach is to use the extension method, which will do this for you. - - The main reason for doing this is that most of the collections you retrieve from an XML tree are yielded using deferred execution. If you do not first materialize them into a list, or if you do not use the extension methods, it is possible to encounter a certain class of bugs. For more information, see [Mixed Declarative Code/Imperative Code Bugs (LINQ to XML) (Visual Basic)](mixed-declarative-code-imperative-code-bugs-linq-to-xml.md). - - The following methods remove nodes and attributes from an XML tree. - -|Method|Description| -|------------|-----------------| -||Removes an from its parent.| -||Removes the child nodes from an .| -||Removes content and attributes from an .| -||Removes the attributes of an .| -||If you pass `null` for value, then removes the attribute.| -||If you pass `null` for value, then removes the child element.| -||Removes an from its parent.| -||Removes every attribute or element in the source collection from its parent element.| - -## Example - -### Description - This example demonstrates three approaches to removing elements. First, it removes a single element. Second, it retrieves a collection of elements, materializes them using the operator, and removes the collection. Finally, it retrieves a collection of elements and removes them using the extension method. - - For more information on the operator, see [Converting Data Types (Visual Basic)](converting-data-types.md). - -### Code - -```vb -Dim root As XElement = _ - - - - - - - - - - - - - - - - - -root...Remove() -root..Elements().ToList().Remove() -root..Elements().Remove() -Console.WriteLine(root) -``` - -### Comments - This code produces the following output: - -```xml - - - - - - - - -``` - - Notice that the first grandchild element has been removed from `Child1`. All grandchildren elements have been removed from `Child2` and from `Child3`. - -## See also - -- [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md b/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md deleted file mode 100644 index 7bde00008cdd3..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-paragraphs-and-their-styles.md +++ /dev/null @@ -1,133 +0,0 @@ ---- -title: "Retrieving the Paragraphs and Their Styles" -ms.date: 07/20/2015 -ms.assetid: d9ed2238-d38e-4ad4-b88b-db7859df9bde ---- -# Retrieving the Paragraphs and Their Styles (Visual Basic) -In this example, we write a query that retrieves the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. - - This query builds on the query in the previous example, [Finding the Default Paragraph Style (Visual Basic)](finding-the-default-paragraph-style.md), which retrieves the default style from the list of styles. This information is required so that the query can identify the style of paragraphs that do not have a style explicitly set. Paragraph styles are set through the `w:pPr` element; if a paragraph does not contain this element, it is formatted with the default style. - - This topic explains the significance of some pieces of the query, then shows the query as part of a complete, working example. - -## Example - The source of the query to retrieve all the paragraphs in a document and their styles is as follows: - -```vb -xDoc.Root.... -``` - - This expression is similar to the source of the query in the previous example, [Finding the Default Paragraph Style (Visual Basic)](finding-the-default-paragraph-style.md). The main difference is that it uses the axis instead of the axis. The query uses the axis because in documents that have sections, the paragraphs will not be the direct children of the body element; rather, the paragraphs will be two levels down in the hierarchy. By using the axis, the code will work of whether or not the document uses sections. - -## Example - The query uses a `Let` clause to determine the element that contains the style node. If there is no element, then `styleNode` is set to `Nothing`: - -```vb -Let styleNode As XElement = para...FirstOrDefault() -``` - - The `Let` clause first uses the axis to find all elements named `pPr`, then uses the extension method to find all child elements named `pStyle`, and finally uses the standard query operator to convert the collection to a singleton. If the collection is empty, `styleNode` is set to `Nothing`. This is a useful idiom to look for the `pStyle` descendant node. Note that if the `pPr` child node does not exist, the code does nor fail by throwing an exception; instead, `styleNode` is set to `Nothing`, which is the desired behavior of this `Let` clause. - - The query projects a collection of an anonymous type with two members, `StyleName` and `ParagraphNode`. - -## Example - This example processes a WordprocessingML document, retrieving the paragraph nodes from a WordprocessingML document. It also identifies the style of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - - You can find instructions for creating the source document for this example in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Following is the new query that finds all paragraphs in the - ' document and their styles. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault() _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - For Each p In paragraphs - Console.WriteLine("StyleName:{0}", p.StyleName) - Next - - End Sub -End Module -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - -```console -StyleName:Heading1 -StyleName:Normal -StyleName:Normal -StyleName:Normal -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Code -StyleName:Normal -StyleName:Normal -StyleName:Normal -StyleName:Code -``` - -## Next Steps - In the next topic, [Retrieving the Text of the Paragraphs (Visual Basic)](retrieving-the-text-of-the-paragraphs.md), you'll create a query to retrieve the text of paragraphs. - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md b/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md deleted file mode 100644 index eabcccb057670..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/retrieving-the-text-of-the-paragraphs.md +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: "Retrieving the Text of the Paragraphs" -ms.date: 07/20/2015 -ms.assetid: 095fa0d9-7b1b-4cbb-9c13-e2c9d8923d31 ---- -# Retrieving the Text of the Paragraphs (Visual Basic) -This example builds on the previous example, [Retrieving the Paragraphs and Their Styles (Visual Basic)](retrieving-the-paragraphs-and-their-styles.md). This new example retrieves the text of each paragraph as a string. - - To retrieve the text, this example adds an additional query that iterates through the collection of anonymous types and projects a new collection of an anonymous type with the addition of a new member, `Text`. It uses the standard query operator to concatenate multiple strings into one string. - - This technique (that is, first projecting to a collection of an anonymous type, then using this collection to project to a new collection of an anonymous type) is a common and useful idiom. This query could have been written without projecting to the first anonymous type. However, because of lazy evaluation, doing so does not use much additional processing power. The idiom creates more short lived objects on the heap, but this does not substantially degrade performance. - - Of course, it would be possible to write a single query that contains the functionality to retrieve the paragraphs, the style of each paragraph, and the text of each paragraph. However, it often is useful to break up a more complicated query into multiple queries because the resulting code is more modular and easier to maintain. Furthermore, if you need to reuse a portion of the query, it is easier to refactor if the queries are written in this manner. - - These queries, which are chained together, use the processing model that is examined in detail in the topic [Tutorial: Deferred Execution (Visual Basic)](tutorial-deferred-execution.md). - -## Example - This example processes a WordprocessingML document, determining the element node, the style name, and the text of each paragraph. This example builds on the previous examples in this tutorial. The new query is called out in comments in the code below. - - For instructions for creating the source document for this example, see [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - - This example uses classes from the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - ' Following function is required because Visual Basic does not support short circuit evaluation - Private Function GetStyleOfParagraph(ByVal styleNode As XElement, _ - ByVal defaultStyle As String) As String - If (styleNode Is Nothing) Then - Return defaultStyle - Else - Return styleNode.@w:val - End If - End Function - - Sub Main() - Dim fileName = "SampleDoc.docx" - - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - Dim stylesRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" - Dim wordmlNamespace = _ - "http://schemas.openxmlformats.org/wordprocessingml/2006/main" - - Dim xDoc As XDocument = Nothing - Dim styleDoc As XDocument = Nothing - Using wdPackage As Package = Package.Open(fileName, FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = _ - wdPackage.GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri(New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Load the document XML in the part into an XDocument instance. - xDoc = XDocument.Load(XmlReader.Create(documentPart.GetStream())) - - ' Find the styles part. There will only be one. - Dim styleRelation As PackageRelationship = _ - documentPart.GetRelationshipsByType(stylesRelationshipType).FirstOrDefault() - If (styleRelation IsNot Nothing) Then - Dim styleUri As Uri = _ - PackUriHelper.ResolvePartUri(documentUri, styleRelation.TargetUri) - Dim stylePart As PackagePart = wdPackage.GetPart(styleUri) - - ' Load the style XML in the part into an XDocument instance. - styleDoc = XDocument.Load(XmlReader.Create(stylePart.GetStream())) - End If - End If - End Using - - Dim defaultStyle As String = _ - ( _ - From style In styleDoc.Root. _ - Where style.@w:type = "paragraph" And _ - style.@w:default = "1" _ - Select style _ - ).First().@w:styleId - - ' Find all paragraphs in the document. - Dim paragraphs = _ - From para In xDoc.Root.... _ - Let styleNode As XElement = para...FirstOrDefault _ - Select New With { _ - .ParagraphNode = para, _ - .StyleName = GetStyleOfParagraph(styleNode, defaultStyle) _ - } - - ' Following is the new query that retrieves the text of - ' each paragraph. - Dim paraWithText = _ - From para In paragraphs _ - Select New With { _ - .ParagraphNode = para.ParagraphNode, _ - .StyleName = para.StyleName, _ - .Text = para.ParagraphNode.. _ - .Aggregate(New StringBuilder(), _ - Function(s As StringBuilder, i As String) s.Append(CStr(i)), _ - Function(s As StringBuilder) s.ToString) _ - } - - For Each p In paraWithText - Console.WriteLine("StyleName:{0} >{1}<", p.StyleName, p.Text) - Next - - End Sub -End Module -``` - - This example produces the following output when applied to the document described in [Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md). - -```console -StyleName:Heading1 >Parsing WordprocessingML with LINQ to XML< -StyleName:Normal >< -StyleName:Normal >The following example prints to the console.< -StyleName:Normal >< -StyleName:Code >Imports System< -StyleName:Code >< -StyleName:Code >Class Program< -StyleName:Code > Public Shared Sub Main(ByVal args() As String)< -StyleName:Code > Console.WriteLine("Hello World")< -StyleName:Code > End Sub< -StyleName:Code >End Class< -StyleName:Normal >< -StyleName:Normal >This example produces the following output:< -StyleName:Normal >< -StyleName:Code >Hello World< -``` - -## Next Steps - The next example shows how to use an extension method, instead of , to concatenate multiple strings into a single string. - -- [Refactoring Using an Extension Method (Visual Basic)](refactoring-using-an-extension-method.md) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) -- [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md deleted file mode 100644 index 80498862e37bd..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-documents-linq-to-xml.md +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: "Sample XML Documents (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: a734cc4e-d95d-4631-91a2-81618c8ad894 ---- -# Sample XML Documents (LINQ to XML) -The following example files are used in the code samples and code snippets throughout the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. - -> [!NOTE] -> The example companies, organizations, products, domain names, email addresses, logos, people, places, and events depicted herein are fictitious. No association with any real company, organization, product, domain name, email address, logo, person, places, or events is intended or should be inferred. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Sample XML File: Typical Purchase Order (LINQ to XML)](sample-xml-file-typical-purchase-order-linq-to-xml.md)|An XML document that contains a typical purchase order.| -|[Sample XML File: Typical Purchase Order in a Namespace](sample-xml-file-typical-purchase-order-in-a-namespace.md)|An XML document in a namespace that contains a typical purchase order.| -|[Sample XML File: Multiple Purchase Orders (LINQ to XML)](sample-xml-file-multiple-purchase-orders-linq-to-xml.md)|An XML document that contains multiple purchase orders.| -|[Sample XML File: Multiple Purchase Orders in a Namespace](sample-xml-file-multiple-purchase-orders-in-a-namespace.md)|An XML document in a namespace that contains multiple purchase orders.| -|[Sample XML File: Test Configuration (LINQ to XML)](sample-xml-file-test-configuration-linq-to-xml.md)|An XML document that contains some pseudo test configuration data.| -|[Sample XML File: Test Configuration in a Namespace](sample-xml-file-test-configuration-in-a-namespace.md)|An XML document in a namespace that contains some pseudo test configuration data.| -|[Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md)|An XML document that contains customers and orders.| -|[Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md)|An Xml Schema Definition (XSD) that validates the [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md).| -|[Sample XML File: Customers and Orders in a Namespace](sample-xml-file-customers-and-orders-in-a-namespace.md)|An XML document in a namespace that contains customers and orders.| -|[Sample XML File: Numerical Data (LINQ to XML)](sample-xml-file-numerical-data-linq-to-xml.md)|An XML document that contains data suitable for summing and grouping.| -|[Sample XML File: Numerical Data in a Namespace](sample-xml-file-numerical-data-in-a-namespace.md)|An XML document in a namespace that contains data suitable for summing and grouping.| -|[Sample XML File: Books (LINQ to XML)](sample-xml-file-books-linq-to-xml.md)|An XML document that contains a catalog of books.| -|[Sample XML File: Consolidated Purchase Orders](sample-xml-file-consolidated-purchase-orders.md)|Presents an XML document that contains purchase orders that are in different namespaces.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md deleted file mode 100644 index a5f3b3ae84b0d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-consolidated-purchase-orders.md +++ /dev/null @@ -1,143 +0,0 @@ ---- -title: "Sample XML File: Consolidated Purchase Orders3" -ms.date: 07/20/2015 -ms.assetid: 7203da90-a514-415a-b978-6980e89f3e9c ---- -# Sample XML File: Consolidated Purchase Orders -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a set of purchase orders with different shapes from multiple companies. Purchase orders from each company are in separate namespaces. - -## ConsolidatedPurchaseOrders.xml - -```xml - - - -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - -
- -
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
- Please notify by email before shipping. - - - Power Supply - 1 - 45.99 - - -
- -
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA -
- Please do not deliver on Saturday. - - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - -
- - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - - Chris Preston - 123 Main St. - Seattle - WA - 98113 - USA - - Ship only complete order. - - Litware Networking Card - 1 - 20.99 - - - Litware 17in LCD Monitor - 1 - 199.99 - - -
-``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md deleted file mode 100644 index 40ff7bfd85792..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-in-a-namespace.md +++ /dev/null @@ -1,429 +0,0 @@ ---- -title: "Sample XML File: Customers and Orders in a Namespace" -ms.date: 07/20/2015 -ms.assetid: 9fe81dbb-e51f-4e80-a49b-e34ac0b1f980 ---- -# Sample XML File: Customers and Orders in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains customers and orders. The XML is in a namespace. - -## CustomersOrdersInNamespace.xml - -```xml - - - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - (509) 555-6221 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
- - - GREAL - 6 - 1997-05-06T00:00:00 - 1997-05-20T00:00:00 - - 2 - 3.35 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 8 - 1997-07-04T00:00:00 - 1997-08-01T00:00:00 - - 2 - 4.42 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 1 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 116.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 18.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 6 - 1997-09-04T00:00:00 - 1997-10-02T00:00:00 - - 1 - 57.15 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1997-09-25T00:00:00 - 1997-10-23T00:00:00 - - 3 - 76.13 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-01-06T00:00:00 - 1998-02-03T00:00:00 - - 2 - 719.78 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-03-09T00:00:00 - 1998-04-06T00:00:00 - - 2 - 33.68 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-04-07T00:00:00 - 1998-05-05T00:00:00 - - 2 - 25.19 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-22T00:00:00 - 1998-05-20T00:00:00 - - 3 - 18.84 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-30T00:00:00 - 1998-06-11T00:00:00 - - 3 - 14.01 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - HUNGC - 3 - 1996-12-06T00:00:00 - 1997-01-03T00:00:00 - - 2 - 20.12 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 1 - 1996-12-25T00:00:00 - 1997-01-22T00:00:00 - - 3 - 30.34 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 3 - 1997-01-15T00:00:00 - 1997-02-12T00:00:00 - - 1 - 0.2 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 4 - 1997-07-16T00:00:00 - 1997-08-13T00:00:00 - - 1 - 45.13 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 8 - 1997-09-08T00:00:00 - 1997-10-06T00:00:00 - - 1 - 111.29 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - LAZYK - 1 - 1997-03-21T00:00:00 - 1997-04-18T00:00:00 - - 3 - 7.48 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LAZYK - 8 - 1997-05-22T00:00:00 - 1997-06-19T00:00:00 - - 2 - 11.92 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LETSS - 1 - 1997-06-25T00:00:00 - 1997-07-23T00:00:00 - - 2 - 13.73 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 8 - 1997-10-27T00:00:00 - 1997-11-24T00:00:00 - - 2 - 51.44 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 6 - 1997-11-10T00:00:00 - 1997-12-08T00:00:00 - - 2 - 45.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 4 - 1998-02-12T00:00:00 - 1998-03-12T00:00:00 - - 2 - 90.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - -
-``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml.md deleted file mode 100644 index 97baafe59d7a0..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-customers-and-orders-linq-to-xml.md +++ /dev/null @@ -1,433 +0,0 @@ ---- -title: "Sample XML File: Customers and Orders (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: ed319807-c432-4f8e-9694-dad4c7648310 ---- -# Sample XML File: Customers and Orders (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains customers and orders. - - The topic [Sample XSD File: Customers and Orders](sample-xsd-file-customers-and-orders.md) contains an XSD that can be used to validate this document. It uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - - For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to: Join Two Collections (LINQ to XML) (Visual Basic)](how-to-join-two-collections-linq-to-xml.md). - -## CustomersOrders.xml - -```xml - - - - - Great Lakes Food Market - Howard Snyder - Marketing Manager - (503) 555-7555 - -
2732 Baker Blvd.
- Eugene - OR - 97403 - USA -
-
- - Hungry Coyote Import Store - Yoshi Latimer - Sales Representative - (503) 555-6874 - (503) 555-2376 - -
City Center Plaza 516 Main St.
- Elgin - OR - 97827 - USA -
-
- - Lazy K Kountry Store - John Steel - Marketing Manager - (509) 555-7969 - (509) 555-6221 - -
12 Orchestra Terrace
- Walla Walla - WA - 99362 - USA -
-
- - Let's Stop N Shop - Jaime Yorres - Owner - (415) 555-5938 - -
87 Polk St. Suite 5
- San Francisco - CA - 94117 - USA -
-
-
- - - GREAL - 6 - 1997-05-06T00:00:00 - 1997-05-20T00:00:00 - - 2 - 3.35 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 8 - 1997-07-04T00:00:00 - 1997-08-01T00:00:00 - - 2 - 4.42 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 1 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 116.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1997-07-31T00:00:00 - 1997-08-28T00:00:00 - - 2 - 18.53 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 6 - 1997-09-04T00:00:00 - 1997-10-02T00:00:00 - - 1 - 57.15 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1997-09-25T00:00:00 - 1997-10-23T00:00:00 - - 3 - 76.13 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-01-06T00:00:00 - 1998-02-03T00:00:00 - - 2 - 719.78 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-03-09T00:00:00 - 1998-04-06T00:00:00 - - 2 - 33.68 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 3 - 1998-04-07T00:00:00 - 1998-05-05T00:00:00 - - 2 - 25.19 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-22T00:00:00 - 1998-05-20T00:00:00 - - 3 - 18.84 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - GREAL - 4 - 1998-04-30T00:00:00 - 1998-06-11T00:00:00 - - 3 - 14.01 - Great Lakes Food Market - 2732 Baker Blvd. - Eugene - OR - 97403 - USA - - - - HUNGC - 3 - 1996-12-06T00:00:00 - 1997-01-03T00:00:00 - - 2 - 20.12 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 1 - 1996-12-25T00:00:00 - 1997-01-22T00:00:00 - - 3 - 30.34 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 3 - 1997-01-15T00:00:00 - 1997-02-12T00:00:00 - - 1 - 0.2 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 4 - 1997-07-16T00:00:00 - 1997-08-13T00:00:00 - - 1 - 45.13 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - HUNGC - 8 - 1997-09-08T00:00:00 - 1997-10-06T00:00:00 - - 1 - 111.29 - Hungry Coyote Import Store - City Center Plaza 516 Main St. - Elgin - OR - 97827 - USA - - - - LAZYK - 1 - 1997-03-21T00:00:00 - 1997-04-18T00:00:00 - - 3 - 7.48 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LAZYK - 8 - 1997-05-22T00:00:00 - 1997-06-19T00:00:00 - - 2 - 11.92 - Lazy K Kountry Store - 12 Orchestra Terrace - Walla Walla - WA - 99362 - USA - - - - LETSS - 1 - 1997-06-25T00:00:00 - 1997-07-23T00:00:00 - - 2 - 13.73 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 8 - 1997-10-27T00:00:00 - 1997-11-24T00:00:00 - - 2 - 51.44 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 6 - 1997-11-10T00:00:00 - 1997-12-08T00:00:00 - - 2 - 45.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - - LETSS - 4 - 1998-02-12T00:00:00 - 1998-03-12T00:00:00 - - 2 - 90.97 - Let's Stop N Shop - 87 Polk St. Suite 5 - San Francisco - CA - 94117 - USA - - - -
-``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md deleted file mode 100644 index af902f7f4afae..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-in-a-namespace.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: "Sample XML File: Multiple Purchase Orders in a Namespace3" -ms.date: 07/20/2015 -ms.assetid: 03f754c6-89f7-4143-8456-4963044be7e5 ---- -# Sample XML File: Multiple Purchase Orders in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains several purchase orders. The XML is in a namespace. - -## PurchaseOrdersInNamespace.xml - -```xml - - - - - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - - Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - - - - - Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA - - - Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA - - Please notify me before shipping. - - - Power Supply - 1 - 45.99 - - - - - - Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA - - - Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA - - - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md deleted file mode 100644 index 3a3956e076bc4..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-multiple-purchase-orders-linq-to-xml.md +++ /dev/null @@ -1,108 +0,0 @@ ---- -title: "Sample XML File: Multiple Purchase Orders (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 08e148ff-4070-4bb4-b089-306f4a9a7641 ---- -# Sample XML File: Multiple Purchase Orders (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains several purchase orders. - -## PurchaseOrders.xml - -```xml - - - -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - -
- -
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
-
- Cristian Osorio - 456 Main Street - Buffalo - NY - 98112 - USA -
- Please notify me before shipping. - - - Power Supply - 1 - 45.99 - - -
- -
- Jessica Arnold - 4055 Madison Ave - Seattle - WA - 98112 - USA -
-
- Jessica Arnold - 4055 Madison Ave - Buffalo - NY - 98112 - USA -
- - - Computer Keyboard - 1 - 29.99 - - - Wireless Mouse - 1 - 14.99 - - -
-
-``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md deleted file mode 100644 index 46fd86ce4e852..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-in-a-namespace.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "Sample XML File: Numerical Data in a Namespace" -ms.date: 07/20/2015 -ms.assetid: f01cc0a1-fb55-4b42-8380-16f4be47d6f4 ---- -# Sample XML File: Numerical Data in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains numerical data for summing, averaging, and grouping. The XML is in a namespace. - -## Data - -```xml - - 7.25 - - A - 3 - 24.50 - - - B - 1 - 89.99 - - - A - 5 - 4.95 - - - A - 3 - 66.00 - - - B - 10 - .99 - - - A - 15 - 29.00 - - - B - 8 - 6.99 - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md deleted file mode 100644 index 95b14aa32df2d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-numerical-data-linq-to-xml.md +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: "Sample XML File: Numerical Data (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 5faef812-0006-4d84-9cf2-5746070e7fbf ---- -# Sample XML File: Numerical Data (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains numerical data for summing, averaging, and grouping. - -## Data.xml - -```xml - - 7.25 - - A - 3 - 24.50 - - - B - 1 - 89.99 - - - A - 5 - 4.95 - - - A - 3 - 66.00 - - - B - 10 - .99 - - - A - 15 - 29.00 - - - B - 8 - 6.99 - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace.md deleted file mode 100644 index 870bfb3f7b2f4..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-in-a-namespace.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Sample XML File: Test Configuration in a Namespace3" -ms.date: 07/20/2015 -ms.assetid: aff02614-30ee-45e1-bc0f-d64b193d20b8 ---- -# Sample XML File: Test Configuration in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This is a test configuration file. The XML is in a namespace. - -## TestConfigInNamespace.xml - -```xml - - - - Convert number to string - Examp1.EXE - 1 - One - - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - - - Count characters - FinalExamp.EXE - This is a test - 14 - - - Another Test - Examp2.EXE - Test Input - 10 - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md deleted file mode 100644 index e5e7e99dc2162..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-test-configuration-linq-to-xml.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -title: "Sample XML File: Test Configuration (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 2e0e19f2-83e4-42ad-958a-6b3e34c9bf17 ---- -# Sample XML File: Test Configuration (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This is a test configuration file. - -## TestConfig.xml - -```xml - - - - Convert number to string - Examp1.EXE - 1 - One - - - Find succeeding characters - Examp2.EXE - abc - def - - - Convert multiple numbers to strings - Examp2.EXE /Verbose - 123 - One Two Three - - - Find correlated key - Examp3.EXE - a1 - b1 - - - Count characters - FinalExamp.EXE - This is a test - 14 - - - Another Test - Examp2.EXE - Test Input - 10 - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md deleted file mode 100644 index fe4336bb7227f..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-in-a-namespace.md +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: "Sample XML File: Typical Purchase Order in a Namespace3" -ms.date: 07/20/2015 -ms.assetid: 38260901-c9f9-4240-9cbf-652c8b05021d ---- -# Sample XML File: Typical Purchase Order in a Namespace -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a typical purchase order. The XML is in a namespace. - -## PurchaseOrderInNamespace.xml - -```xml - - - - Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA - - - Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA - - Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml.md deleted file mode 100644 index a8ff286f90c27..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xml-file-typical-purchase-order-linq-to-xml.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: "Sample XML File: Typical Purchase Order (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 65321b9c-1239-45e4-af40-eb86cedf7abd ---- -# Sample XML File: Typical Purchase Order (LINQ to XML) -The following XML file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file is a typical purchase order. - -## PurchaseOrder.xml - -```xml - - -
- Ellen Adams - 123 Maple Street - Mill Valley - CA - 10999 - USA -
-
- Tai Yee - 8 Oak Avenue - Old Town - PA - 95819 - USA -
- Please leave packages in shed by driveway. - - - Lawnmower - 1 - 148.95 - Confirm this is electric - - - Baby Monitor - 2 - 39.98 - 1999-05-21 - - -
-``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders.md b/docs/visual-basic/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders.md deleted file mode 100644 index 3e827f8965305..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/sample-xsd-file-customers-and-orders.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -title: "Sample XSD File: Customers and Orders2" -ms.date: 07/20/2015 -ms.assetid: a0c0b414-c8e1-45e4-bb67-b5e650c97130 ---- -# Sample XSD File: Customers and Orders -The following XSD file is used in various examples in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] documentation. This file contains a schema definition for the [Sample XML File: Customers and Orders (LINQ to XML)](sample-xml-file-customers-and-orders-linq-to-xml.md). The schema uses the `xs:key` and `xs:keyref` features of XSD to establish that the `CustomerID` attribute of the `Customer` element is a key, and to establish a relationship between the `CustomerID` element in each `Order` element and the `CustomerID` attribute in each `Customer` element. - - For an example of writing LINQ queries that take advantage of this relationship using the `Join` clause, see [How to: Join Two Collections (LINQ to XML) (Visual Basic)](how-to-join-two-collections-linq-to-xml.md). - -## CustomersOrders.xsd - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## See also - -- [Sample XML Documents (LINQ to XML)](sample-xml-documents-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/scope-of-default-namespaces.md b/docs/visual-basic/programming-guide/concepts/linq/scope-of-default-namespaces.md deleted file mode 100644 index 6ad8b01718a42..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/scope-of-default-namespaces.md +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: "Scope of Default Namespaces" -ms.date: 07/20/2015 -ms.assetid: d4cce80c-342f-4097-be8b-40ab0bfa90ba ---- -# Scope of Default Namespaces in Visual Basic -Default namespaces as represented in the XML tree are not in scope for queries. If you have XML that is in a default namespace, you still must declare an variable, and combine it with the local name to make a qualified name to be used in the query. - - One of the most common problems when querying XML trees is that if the XML tree has a default namespace, the developer sometimes writes the query as though the XML were not in a namespace. - - The first set of examples in this topic shows a typical way that XML in a default namespace is loaded, but is queried improperly. - - The second set of examples show the necessary corrections so that you can query XML in a namespace. - -## Example - This example shows the creation of XML in a namespace, and a query that returns an empty result set. - -### Code - -```vb -Module Module1 - Sub Main() - Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el - Console.WriteLine("Result set follows:") - For Each el As XElement In c1 - Console.WriteLine(CInt(el)) - Next - Console.WriteLine("End of result set") - End Sub -End Module -``` - -### Comments - This example produces the following result: - -```console -Result set follows: -End of result set -``` - -## Example - This example shows the creation of XML in a namespace, and a query that is coded properly. - - In contrast to the incorrectly coded example above, the correct approach when using Visual Basic is to declare and initialize a global default namespace. This places all XML properties in the default namespace. No other modifications are required to the example to make it work properly. - -### Code - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - 1 - 2 - 3 - 4 - 5 - 6 - - Dim c1 As IEnumerable(Of XElement) = _ - From el In root. _ - Select el - Console.WriteLine("Result set follows:") - For Each el As XElement In c1 - Console.WriteLine(el.Value) - Next - Console.WriteLine("End of result set") - End Sub -End Module -``` - -### Comments - This example produces the following result: - -```console -Result set follows: -1 -2 -3 -End of result set -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/serializing-object-graphs-that-contain-xelement-objects.md b/docs/visual-basic/programming-guide/concepts/linq/serializing-object-graphs-that-contain-xelement-objects.md deleted file mode 100644 index 2720c458fce00..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/serializing-object-graphs-that-contain-xelement-objects.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -title: "Serializing Object Graphs that Contain XElement Objects" -ms.date: 07/20/2015 -ms.assetid: c0cc5c92-5ca3-44b1-98dd-371601df721b ---- -# Serializing Object Graphs that Contain XElement Objects (Visual Basic) -This topic introduces the capability of serializing object graphs that contain references to objects of type . To facility this type of serializing, implements the interface. - - Note that only the class implements serialization. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[How to: Serialize Using XmlSerializer (Visual Basic)](how-to-serialize-using-xmlserializer.md)|Demonstrates how to serialize using .| -|[How to: Serialize Using DataContractSerializer (Visual Basic)](how-to-serialize-using-datacontractserializer.md)|Demonstrates how to serialize using .| - -## See also - -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md b/docs/visual-basic/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md deleted file mode 100644 index 092edda2ccb4d..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/serializing-to-an-xmlreader-invoking-xslt.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -title: "Serializing to an XmlReader (Invoking XSLT)" -ms.date: 07/20/2015 -ms.assetid: 8b64f95a-e8f6-40f7-99f9-a8002c63af96 ---- -# Serializing to an XmlReader (Invoking XSLT) (Visual Basic) -When you use the interoperability capabilities of [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)], you can use to create an . The module that reads from this reads the nodes from the XML tree and processes them accordingly. - -## Invoking an XSLT Transformation - One possible use for this method is when invoking an XSLT transformation. You can create an XML tree, create an from the XML tree, create a new document, and then create an to write into the new document. Then, you can invoke the XSLT transformation, passing in and . After the transformation successfully completes, the new XML tree is populated with the results of the transformation. - -```vb -Dim xslMarkup As XDocument = _ - - - - - - - - - - - - - - -Dim xmlTree As XDocument = _ - - - Child1 data - Child2 data - - -Dim newTree As XDocument = New XDocument() -Using writer As XmlWriter = newTree.CreateWriter() - ' Load the style sheet. - Dim xslt As XslCompiledTransform = New XslCompiledTransform() - xslt.Load(xslMarkup.CreateReader()) - - ' Execute the transformation and output the results to a writer. - xslt.Transform(xmlTree.CreateReader(), writer) -End Using - -Console.WriteLine(newTree) -``` - - This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- [Serializing XML Trees (Visual Basic)](serializing-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md b/docs/visual-basic/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md deleted file mode 100644 index 6850444790548..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/serializing-to-files-textwriters-and-xmlwriters.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: "Serializing to Files, TextWriters, and XmlWriters3" -ms.date: 07/20/2015 -ms.assetid: 7a0c24df-79ef-41a0-87f5-e6cf79382da9 ---- - -# Serializing to Files, TextWriters, and XmlWriters - -You can serialize XML trees to a , a , or an . - -You can serialize any XML component, including and , to a string by using the `ToString` method. - -If you want to suppress formatting when serializing to a string, you can use the method. - -The default behavior when serializing to a file is to format (indent) the resulting XML document. When you indent, the insignificant white space in the XML tree is not preserved. To serialize with formatting, use one of the overloads of the following methods that do not take as an argument: - -- - -- - -If you want the option not to indent and to preserve the insignificant white space in the XML tree, use one of the overloads of the following methods that takes as an argument: - -- - -- - -For examples, see the appropriate reference topic. - -## See also - -- [Serializing XML Trees (Visual Basic)](serializing-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md b/docs/visual-basic/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md deleted file mode 100644 index 2906d89c29463..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/serializing-with-an-xml-declaration.md +++ /dev/null @@ -1,60 +0,0 @@ ---- -title: "Serializing with an XML Declaration" -ms.date: 07/20/2015 -ms.assetid: 8726f79e-2bb0-4ba0-969d-197cca591647 ---- -# Serializing with an XML Declaration (Visual Basic) -This topic describes how to control whether serialization generates an XML declaration. - -## XML Declaration Generation - Serializing to a or a using the method or the method generates an XML declaration. When you serialize to an , the writer settings (specified in an object) determine whether an XML declaration is generated or not. - - If you are serializing to a string using the `ToString` method, the resulting XML will not include an XML declaration. - -### Serializing with an XML Declaration - The following example creates an , saves the document to a file, and then prints the file to the console: - -```vb -Dim root As XElement = - child content - -root.Save("Root.xml") -Dim str As String = File.ReadAllText("Root.xml") -Console.WriteLine(str) -``` - - This example produces the following output: - -```xml - - - child content - -``` - -### Serializing without an XML Declaration - The following example shows how to save an to an . - -```vb -Dim sb As StringBuilder = New StringBuilder() -Dim xws As XmlWriterSettings = New XmlWriterSettings() -xws.OmitXmlDeclaration = True - -Using xw As XmlWriter = XmlWriter.Create(sb, xws) - Dim root = - child content - - root.Save(xw) -End Using -Console.WriteLine(sb.ToString()) -``` - - This example produces the following output: - -```xml -child content -``` - -## See also - -- [Serializing XML Trees (Visual Basic)](serializing-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/serializing-xml-trees.md b/docs/visual-basic/programming-guide/concepts/linq/serializing-xml-trees.md deleted file mode 100644 index efb43c8bd3bab..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/serializing-xml-trees.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Serializing XML Trees" -ms.date: 07/20/2015 -ms.assetid: 2c340695-a726-4030-85be-6975d8a149cf ---- -# Serializing XML Trees (Visual Basic) -Serializing an XML tree means generating XML from the XML tree. You can serialize to a file, to a concrete implementation of the class, or to a concrete implementation of an . - - You can control various aspects of serialization. For example, you can control whether to indent the serialized XML, and whether to write an XML declaration. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Preserving White Space While Serializing](preserving-white-space-while-serializing.md)|Describes how to control white space behavior when you serialize XML trees.| -|[Serializing with an XML Declaration (Visual Basic)](serializing-with-an-xml-declaration.md)|Describes how to serialize an XML tree that includes an XML declaration.| -|[Serializing to Files, TextWriters, and XmlWriters](serializing-to-files-textwriters-and-xmlwriters.md)|Describes how to serialize a document to a , a , or an .| -|[Serializing to an XmlReader (Invoking XSLT) (Visual Basic)](serializing-to-an-xmlreader-invoking-xslt.md)|Describes how to create a that enables another module to read the contents of an XML tree.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md b/docs/visual-basic/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md deleted file mode 100644 index 557c2d05251cb..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/shape-of-wordprocessingml-documents.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "Shape of WordprocessingML Documents" -ms.date: 07/20/2015 -ms.assetid: 2dfb446b-5a07-4c00-9ab3-a74ba734ff3a ---- -# Shape of WordprocessingML Documents (Visual Basic) -This topic introduces the XML shape of a WordprocessingML document. - -## Microsoft Office Formats - The native file format for the 2007 Microsoft Office system is Office Open XML (commonly called Open XML). Open XML is an XML-based format that an Ecma standard and is currently going through the ISO-IEC standards process. The markup language for word processing files within Open XML is called WordprocessingML. This tutorial uses WordprocessingML source files as input for the examples. - - If you are using Microsoft Office 2003, you can save documents in the Office Open XML format if you have installed the Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats. - -## The Shape of WordprocessingML Documents - The first thing to understand is the shape of WordprocessingML documents. A WordprocessingML document contains a body element (named `w:body`) that contains the paragraphs of the document. Each paragraph contains one or more text runs (named `w:r`). Each text run contains one or more text pieces (named `w:t`). - - The following is a very simple WordprocessingML document: - -```xml - - - - - - This is a paragraph. - - - - - This is another paragraph. - - - - -``` - - This document contains two paragraphs. They both contain a single text run, and each text run contains a single text piece. - - The easiest way to see the contents of a WordprocessingML document in XML form is to create one using Microsoft Word, save it, and then run the following program that prints the XML to the console. - - This example uses classes found in the WindowsBase assembly. It uses types in the namespace. - -```vb -Imports - -Module Module1 - Sub Main() - Dim documentRelationshipType = _ - "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" - - Using wdPackage As Package = _ - Package.Open("SampleDoc.docx", _ - FileMode.Open, FileAccess.Read) - Dim docPackageRelationship As PackageRelationship = wdPackage _ - .GetRelationshipsByType(documentRelationshipType).FirstOrDefault() - If (docPackageRelationship IsNot Nothing) Then - Dim documentUri As Uri = PackUriHelper.ResolvePartUri( _ - New Uri("/", UriKind.Relative), _ - docPackageRelationship.TargetUri) - Dim documentPart As PackagePart = wdPackage.GetPart(documentUri) - - ' Get the officeDocument part from the package. - ' Load the XML in the part into an XDocument instance. - Dim xDoc As XDocument = _ - XDocument.Load(XmlReader.Create(documentPart.GetStream())) - Console.WriteLine(xDoc.Root) - End If - End Using - End Sub -End Module -``` - -## External resources - -- [Introducing the Office (2007) Open XML File Formats](https://docs.microsoft.com/previous-versions/office/developer/office-2007/aa338205(v=office.12)) -- [Overview of WordprocessingML](https://docs.microsoft.com/previous-versions/office/developer/office-2003/aa212812(v=office.11)) - -## See also - -- [Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic)](tutorial-manipulating-content-in-a-wordprocessingml-document.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md deleted file mode 100644 index a1b763a7883c5..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/statically-compiled-queries-linq-to-xml.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -title: "Statically Compiled Queries (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 3f4825c7-c3b0-48da-ba4e-8e97fb2a2f34 ---- -# Statically Compiled Queries (LINQ to XML) (Visual Basic) - -One of the most important performance benefits LINQ to XML, as opposed to , is that queries in LINQ to XML are statically compiled, whereas XPath queries must be interpreted at run time. This feature is built in to LINQ to XML, so you do not have to perform extra steps to take advantage of it, but it is helpful to understand the distinction when choosing between the two technologies. This topic explains the difference. - -## Statically Compiled Queries vs. XPath - -The following example shows how to get the descendant elements with a specified name, and with an attribute with a specified value. - -The following is the equivalent XPath expression: - -```vb -//Address[@Type='Shipping'] -``` - -```vb -Dim po = XDocument.Load("PurchaseOrders.xml") - -Dim list1 = From el In po.Descendants("Address") - Where el.@Type = "Shipping" - -For Each el In list1 - Console.WriteLine(el) -Next -``` - -The query expression in this example is re-written by the compiler to method-based query syntax. The following example, which is written in method-based query syntax, produces the same results as the previous one: - -```vb -Dim po = XDocument.Load("PurchaseOrders.xml") - -Dim list1 As IEnumerable(Of XElement) = po.Descendants("Address").Where(Function(el) el.@Type = "Shipping") - -For Each el In list1 - Console.WriteLine(el) -Next -``` - -The method is an extension method. For more information, see [Extension Methods](../../../../csharp/programming-guide/classes-and-structs/extension-methods.md). Because is an extension method, the query above is compiled as though it were written as follows: - -```vb -Dim po = XDocument.Load("PurchaseOrders.xml") - -Dim list1 = Enumerable.Where(po.Descendants("Address"), Function(el) el.@Type = "Shipping") - -For Each el In list1 - Console.WriteLine(el) -Next -``` - -This example produces exactly the same results as the previous two examples. This illustrates the fact that queries are effectively compiled into statically linked method calls. This, combined with the deferred execution semantics of iterators, improves performance. For more information about the deferred execution semantics of iterators, see [Deferred Execution and Lazy Evaluation in LINQ to XML (Visual Basic)](deferred-execution-and-lazy-evaluation-in-linq-to-xml.md). - -> [!NOTE] -> These examples are representative of the code that the compiler might write. The actual implementation might differ slightly from these examples, but the performance will be the same or similar to these examples. - -## Executing XPath Expressions with XmlDocument - -The following example uses to accomplish the same results as the previous examples: - -```vb -Dim reader = Xml.XmlReader.Create("PurchaseOrders.xml") -Dim doc As New Xml.XmlDocument() -doc.Load(reader) -Dim nl As Xml.XmlNodeList = doc.SelectNodes(".//Address[@Type='Shipping']") -For Each n As Xml.XmlNode In nl - Console.WriteLine(n.OuterXml) -Next -reader.Close() -``` - -This query returns the same output as the examples that use LINQ to XML; the only difference is that LINQ to XML indents the printed XML, whereas does not. - -However, the approach generally does not perform as well as LINQ to XML, because the method must do the following internally every time it is called: - -- It parses the string that contains the XPath expression, breaking the string into tokens. - -- It validates the tokens to make sure that the XPath expression is valid. - -- It translates the expression into an internal expression tree. - -- It iterates through the nodes, appropriately selecting the nodes for the result set based on the evaluation of the expression. - -This is significantly more than the work done by the corresponding LINQ to XML query. The specific performance difference varies for different types of queries, but in general LINQ to XML queries do less work, and therefore perform better, than evaluating XPath expressions using . - -## See also - -- [Performance (LINQ to XML) (Visual Basic)](performance-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md b/docs/visual-basic/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md deleted file mode 100644 index 9c2d94ce440a1..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/style-part-of-a-wordprocessingml-document.md +++ /dev/null @@ -1,139 +0,0 @@ ---- -title: "Style Part of a WordprocessingML Document2" -ms.date: 07/20/2015 -ms.assetid: 292cc094-9483-4192-ac3b-a5dc51fbac12 ---- -# Style Part of a WordprocessingML Document -This topic shows an example of the style part of the Office Open XML WordprocessingML document. - -## Example - The following example is the XML that makes up the style part of an Office Open XML WordprocessingML document. - - The default paragraph style has an element with the following opening tag: - -```xml - -``` - - You need to know this information when you write the query to find the default style identifier, so that the query can identify the style of paragraphs that have the default style. - - Note that these documents are very simple when compared to typical documents that Microsoft Word generates. In many cases, Word saves a great deal of additional information, additional formatting and metadata. Furthermore, Word does not format the lines to be easily readable as in this example; instead, the XML is saved without indentation. However, all WordprocessingML documents share the same basic XML shape. Because of this, the queries presented in this tutorial will work with more complicated documents. - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - -## See also - -- [Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/toc.yml b/docs/visual-basic/programming-guide/concepts/linq/toc.yml index f03a5971730c8..0ef1b5b5c1070 100644 --- a/docs/visual-basic/programming-guide/concepts/linq/toc.yml +++ b/docs/visual-basic/programming-guide/concepts/linq/toc.yml @@ -109,361 +109,6 @@ href: how-to-query-an-arraylist-with-linq.md - name: "How to: Add Custom Methods for LINQ Queries" href: how-to-add-custom-methods-for-linq-queries.md -- name: LINQ to XML - href: linq-to-xml.md - items: - - name: Getting Started (LINQ to XML) - href: getting-started-linq-to-xml.md - items: - - name: LINQ to XML Overview - href: linq-to-xml-overview.md - - name: LINQ to XML vs. DOM - href: linq-to-xml-vs-dom.md - - name: LINQ to XML vs. Other XML Technologies - href: linq-to-xml-vs-other-xml-technologies.md - - name: Programming Guide (LINQ to XML) - href: programming-guide-linq-to-xml.md - items: - - name: LINQ to XML Programming Overview - href: linq-to-xml-programming-overview.md - - name: Functional vs. Procedural Programming (LINQ to XML) - href: functional-vs-procedural-programming-linq-to-xml.md - - name: LINQ to XML Classes Overview - href: linq-to-xml-classes-overview.md - - name: XElement Class Overview - href: xelement-class-overview.md - - name: XAttribute Class Overview - href: xattribute-class-overview.md - items: - - name: XDocument Class Overview - href: xdocument-class-overview.md - - name: "How to: Build LINQ to XML Examples" - href: how-to-build-linq-to-xml-examples.md - - name: Creating XML Trees - href: creating-xml-trees.md - items: - - name: Functional Construction (LINQ to XML) - href: functional-construction-linq-to-xml.md - - name: Introduction to XML Literals - href: introduction-to-xml-literals.md - - name: Cloning vs. Attaching - href: cloning-vs-attaching.md - - name: Parsing XML - href: parsing-xml.md - items: - - name: "How to: Parse a String" - href: how-to-parse-a-string.md - - name: "How to: Load XML from a File" - href: how-to-load-xml-from-a-file.md - - name: Preserving White Space while Loading or Parsing XML - href: preserving-white-space-while-loading-or-parsing-xml.md - - name: "How to: Catch Parsing Errors" - href: how-to-catch-parsing-errors.md - - name: "How to: Create a Tree from an XmlReader" - href: how-to-create-a-tree-from-an-xmlreader.md - - name: "How to: Stream XML Fragments from an XmlReader" - href: how-to-stream-xml-fragments-from-an-xmlreader.md - - name: "How to: Populate an XML Tree with an XmlWriter (LINQ to XML)" - href: how-to-populate-an-xml-tree-with-an-xmlwriter-linq-to-xml.md - - name: "How to: Validate Using XSD (LINQ to XML)" - href: how-to-validate-using-xsd-linq-to-xml.md - - name: Valid Content of XElement and XDocument Objects - href: valid-content-of-xelement-and-xdocument-objects.md - - name: Working with XML Namespaces - href: working-with-xml-namespaces.md - items: - - name: Namespaces Overview (LINQ to XML) - href: namespaces-overview-linq-to-xml.md - - name: "How to: Create a Document with Namespaces (LINQ to XML)" - href: how-to-create-a-document-with-namespaces.md - - name: "How to: Control Namespace Prefixes (LINQ to XML)" - href: how-to-control-namespace-prefixes-linq-to-xml.md - - name: Scope of Default Namespaces - href: scope-of-default-namespaces.md - - name: Working with Global Namespaces (LINQ to XML) - href: working-with-global-namespaces-linq-to-xml.md - - name: "How to: Write Queries on XML in Namespaces" - href: how-to-write-queries-on-xml-in-namespaces.md - - name: Serializing XML Trees - href: serializing-xml-trees.md - items: - - name: Preserving White Space While Serializing - href: preserving-white-space-while-serializing.md - - name: Serializing with an XML Declaration - href: serializing-with-an-xml-declaration.md - - name: Serializing to Files, TextWriters, and XmlWriters - href: serializing-to-files-textwriters-and-xmlwriters.md - - name: Serializing to an XmlReader (Invoking XSLT) - href: serializing-to-an-xmlreader-invoking-xslt.md - - name: LINQ to XML Axes - href: linq-to-xml-axes.md - items: - - name: LINQ to XML Axes Overview - href: linq-to-xml-axes-overview.md - - name: "How to: Retrieve a Collection of Elements (LINQ to XML)" - href: how-to-retrieve-a-collection-of-elements-linq-to-xml.md - - name: "How to: Retrieve the Value of an Element (LINQ to XML)" - href: how-to-retrieve-the-value-of-an-element-linq-to-xml.md - - name: "How to: Filter on Element Names (LINQ to XML)" - href: how-to-filter-on-element-names-linq-to-xml.md - - name: "How to: Chain Axis Method Calls (LINQ to XML)" - href: how-to-chain-axis-method-calls-linq-to-xml.md - - name: "How to: Retrieve a Single Child Element (LINQ to XML)" - href: how-to-retrieve-a-single-child-element-linq-to-xml.md - - name: "How to: Retrieve a Collection of Attributes (LINQ to XML)" - href: how-to-retrieve-a-collection-of-attributes-linq-to-xml.md - - name: "How to: Retrieve a Single Attribute (LINQ to XML)" - href: how-to-retrieve-a-single-attribute-linq-to-xml.md - - name: "How to: Retrieve the Value of an Attribute (LINQ to XML)" - href: how-to-retrieve-the-value-of-an-attribute-linq-to-xml.md - - name: "How to: Retrieve the Shallow Value of an Element" - href: how-to-retrieve-the-shallow-value-of-an-element.md - - name: Language-Integrated Axes (LINQ to XML) - href: language-integrated-axes.md - - name: Querying XML Trees - href: querying-xml-trees.md - items: - - name: Basic Queries (LINQ to XML) - href: basic-queries-linq-to-xml.md - items: - - name: "How to: Find an Element with a Specific Attribute" - href: how-to-find-an-element-with-a-specific-attribute.md - - name: "How to: Find an Element with a Specific Child Element" - href: how-to-find-an-element-with-a-specific-child-element.md - - name: Querying an XDocument vs. Querying an XElement - href: querying-an-xdocument-vs-querying-an-xelement.md - - name: "How to: Find Descendants with a Specific Element Name" - href: how-to-find-descendants-with-a-specific-element-name.md - - name: "How to: Find a Single Descendant Using the Descendants Method" - href: how-to-find-a-single-descendant-using-the-descendants-method.md - - name: "How to: Write Queries with Complex Filtering" - href: how-to-write-queries-with-complex-filtering.md - - name: "How to: Filter on an Optional Element" - href: how-to-filter-on-an-optional-element.md - - name: "How to: Find All Nodes in a Namespace" - href: how-to-find-all-nodes-in-a-namespace.md - - name: "How to: Sort Elements" - href: how-to-sort-elements.md - - name: "How to: Sort Elements on Multiple Keys" - href: how-to-sort-elements-on-multiple-keys.md - - name: "How to: Calculate Intermediate Values" - href: how-to-calculate-intermediate-values.md - - name: "How to: Write a Query that Finds Elements Based on Context" - href: how-to-write-a-query-that-finds-elements-based-on-context.md - - name: "How to: Debug Empty Query Results Sets" - href: how-to-debug-empty-query-results-sets.md - - name: Projections and Transformations (LINQ to XML) - href: projections-and-transformations-linq-to-xml.md - - name: "How to: Work with Dictionaries Using LINQ to XML" - href: how-to-work-with-dictionaries-using-linq-to-xml.md - items: - - name: "How to: Transform the Shape of an XML Tree" - href: how-to-transform-the-shape-of-an-xml-tree.md - - name: "How to: Control the Type of a Projection" - href: how-to-control-the-type-of-a-projection.md - - name: "How to: Project a New Type (LINQ to XML)" - href: how-to-project-a-new-type-linq-to-xml.md - - name: "How to: Project an Object Graph" - href: how-to-project-an-object-graph.md - - name: "How to: Project an Anonymous Type" - href: how-to-project-an-anonymous-type.md - - name: "How to: Generate Text Files from XML" - href: how-to-generate-text-files-from-xml.md - - name: "How to: Generate XML from CSV Files" - href: how-to-generate-xml-from-csv-files.md - - name: Advanced Query Techniques (LINQ to XML) - href: advanced-query-techniques-linq-to-xml.md - items: - - name: "How to: Join Two Collections (LINQ to XML)" - href: how-to-join-two-collections-linq-to-xml.md - items: - - name: "How to: Create Hierarchy Using Grouping" - href: how-to-create-hierarchy-using-grouping.md - - name: "How to: Query LINQ to XML Using XPath" - href: how-to-query-linq-to-xml-using-xpath.md - - name: "How to: Write a LINQ to XML Axis Method" - href: how-to-write-a-linq-to-xml-axis-method.md - - name: "How to: List All Nodes in a Tree" - href: how-to-list-all-nodes-in-a-tree.md - - name: "How to: Retrieve Paragraphs from an Office Open XML Document" - href: how-to-retrieve-paragraphs-from-an-office-open-xml-document.md - - name: "How to: Modify an Office Open XML Document" - href: how-to-modify-an-office-open-xml-document.md - - name: "How to: Populate an XML Tree from the File System" - href: how-to-populate-an-xml-tree-from-the-file-system.md - - name: LINQ to XML for XPath Users - href: linq-to-xml-for-xpath-users.md - items: - - name: Comparison of XPath and LINQ to XML - href: ../../../../csharp/programming-guide/concepts/linq/comparison-of-xpath-and-linq-to-xml.md - - name: "How to: Find a Child Element (XPath-LINQ to XML)" - href: how-to-find-a-child-element-xpath-linq-to-xml.md - - name: "How to: Find a List of Child Elements (XPath-LINQ to XML)" - href: how-to-find-a-list-of-child-elements-xpath-linq-to-xml.md - - name: "How to: Find the Root Element (XPath-LINQ to XML)" - href: how-to-find-the-root-element-xpath-linq-to-xml.md - - name: "How to: Find Descendant Elements (XPath-LINQ to XML)" - href: how-to-find-descendant-elements-xpath-linq-to-xml.md - - name: "How to: Filter on an Attribute (XPath-LINQ to XML)" - href: how-to-filter-on-an-attribute-xpath-linq-to-xml.md - - name: "How to: Find Related Elements (XPath-LINQ to XML)" - href: how-to-find-related-elements-xpath-linq-to-xml.md - - name: "How to: Find Elements in a Namespace (XPath-LINQ to XML)" - href: how-to-find-elements-in-a-namespace.md - - name: "How to: Find Preceding Siblings (XPath-LINQ to XML)" - href: how-to-find-preceding-siblings-xpath-linq-to-xml.md - - name: "How to: Find Descendants of a Child Element (XPath-LINQ to XML)" - href: how-to-find-descendants-of-a-child-element-xpath-linq-to-xml.md - - name: "How to: Find a Union of Two Location Paths (XPath-LINQ to XML)" - href: how-to-find-a-union-of-two-location-paths-xpath.md - - name: "How to: Find Sibling Nodes (XPath-LINQ to XML)" - href: how-to-find-sibling-nodes-xpath-linq-to-xml.md - - name: "How to: Find an Attribute of the Parent (XPath-LINQ to XML)" - href: how-to-find-an-attribute-of-the-parent-xpath-linq-to-xml.md - - name: "How to: Find Attributes of Siblings with a Specific Name (XPath-LINQ to XML)" - href: how-to-find-attributes-of-siblings-with-a-specific-name.md - - name: "How to: Find Elements with a Specific Attribute (XPath-LINQ to XML)" - href: how-to-find-elements-with-a-specific-attribute.md - - name: "How to: Find Child Elements Based on Position (XPath-LINQ to XML)" - href: how-to-find-child-elements-based-on-position.md - - name: "How to: Find the Immediate Preceding Sibling (XPath-LINQ to XML)" - href: how-to-find-the-immediate-preceding-sibling-xpath-linq-to-xml.md - - name: Pure Functional Transformations of XML - href: pure-functional-transformations-of-xml.md - items: - - name: Introduction to Pure Functional Transformations - href: introduction-to-pure-functional-transformations.md - - name: Concepts and Terminology (Functional Transformation) - href: concepts-and-terminology-functional-transformation.md - - name: Functional Programming vs. Imperative Programming - href: functional-programming-vs-imperative-programming.md - - name: Refactoring Into Pure Functions - href: refactoring-into-pure-functions.md - - name: Applicability of Functional Transformation - href: applicability-of-functional-transformation.md - - name: Functional Transformation of XML - href: functional-transformation-of-xml.md - - name: "Tutorial: Deferred Execution" - href: tutorial-deferred-execution.md - - name: Deferred Execution and Lazy Evaluation in LINQ to XML - href: deferred-execution-and-lazy-evaluation-in-linq-to-xml.md - - name: Deferred Execution Example - href: deferred-execution-example.md - - name: "Tutorial: Manipulating Content in a WordprocessingML Document" - href: tutorial-manipulating-content-in-a-wordprocessingml-document.md - - name: Shape of WordprocessingML Documents - href: shape-of-wordprocessingml-documents.md - - name: Creating the Source Office Open XML Document - href: creating-the-source-office-open-xml-document.md - - name: Finding the Default Paragraph Style - href: finding-the-default-paragraph-style.md - - name: Retrieving the Paragraphs and Their Styles - href: retrieving-the-paragraphs-and-their-styles.md - - name: Retrieving the Text of the Paragraphs - href: retrieving-the-text-of-the-paragraphs.md - - name: Refactoring Using an Extension Method - href: refactoring-using-an-extension-method.md - - name: Refactoring Using a Pure Function - href: refactoring-using-a-pure-function.md - - name: Projecting XML in a Different Shape - href: projecting-xml-in-a-different-shape.md - - name: Finding Text in Word Documents - href: finding-text-in-word-documents.md - - name: Details of Office Open XML WordprocessingML Documents - href: details-of-office-open-xml-wordprocessingml-documents.md - - name: WordprocessingML Document with Styles - href: wordprocessingml-document-with-styles.md - - name: Style Part of a WordprocessingML Document - href: style-part-of-a-wordprocessingml-document.md - - name: Example that Outputs Office Open XML Document Parts - href: example-that-outputs-office-open-xml-document-parts.md - - name: Modifying XML Trees (LINQ to XML) - href: modifying-xml-trees-linq-to-xml.md - items: - - name: In-Memory XML Tree Modification vs. Functional Construction (LINQ to XML) - href: in-memory-xml-tree-modification-vs-functional-construction.md - - name: Adding Elements, Attributes, and Nodes to an XML Tree - href: adding-elements-attributes-and-nodes-to-an-xml-tree.md - - name: Modifying Elements, Attributes, and Nodes in an XML Tree - href: modifying-elements-attributes-and-nodes-in-an-xml-tree.md - - name: Removing Elements, Attributes, and Nodes from an XML Tree - href: removing-elements-attributes-and-nodes-from-an-xml-tree.md - - name: Maintaining Name-Value Pairs - href: maintaining-name-value-pairs.md - - name: "How to: Change the Namespace for an Entire XML Tree" - href: how-to-change-the-namespace-for-an-entire-xml-tree.md - - name: Performance (LINQ to XML) - href: performance-linq-to-xml.md - items: - - name: Performance of Chained Queries (LINQ to XML) - href: performance-of-chained-queries-linq-to-xml.md - - name: Atomized XName and XNamespace Objects (LINQ to XML) - href: atomized-xname-and-xnamespace-objects-linq-to-xml.md - - name: Pre-Atomization of XName Objects (LINQ to XML) - href: pre-atomization-of-xname-objects-linq-to-xml.md - - name: Statically Compiled Queries (LINQ to XML) - href: statically-compiled-queries-linq-to-xml.md - - name: Advanced LINQ to XML Programming - href: advanced-linq-to-xml-programming.md - items: - - name: LINQ to XML Annotations - href: linq-to-xml-annotations.md - - name: LINQ to XML Events - href: linq-to-xml-events.md - - name: Programming with Nodes - href: programming-with-nodes.md - - name: Mixed Declarative Code-Imperative Code Bugs (LINQ to XML) - href: mixed-declarative-code-imperative-code-bugs-linq-to-xml.md - - name: "How to: Stream XML Fragments with Access to Header Information" - href: how-to-stream-xml-fragments-with-access-to-header-information.md - - name: "How to: Perform Streaming Transform of Large XML Documents" - href: how-to-perform-streaming-transform-of-large-xml-documents.md - - name: "How to: Read and Write an Encoded Document" - href: how-to-read-and-write-an-encoded-document.md - - name: Using XSLT to Transform an XML Tree - href: using-xslt-to-transform-an-xml-tree.md - - name: "How to: Use Annotations to Transform LINQ to XML Trees in an XSLT Style" - href: how-to-use-annotation-trees-to-transform-linq-to-xml-trees-in-an-xslt-style.md - - name: Serializing Object Graphs that Contain XElement Objects - href: serializing-object-graphs-that-contain-xelement-objects.md - items: - - name: "How to: Serialize Using XmlSerializer" - href: how-to-serialize-using-xmlserializer.md - - name: "How to: Serialize Using DataContractSerializer" - href: how-to-serialize-using-datacontractserializer.md - - name: LINQ to XML Security - href: linq-to-xml-security.md - - name: Sample XML Documents (LINQ to XML) - href: sample-xml-documents-linq-to-xml.md - items: - - name: "Sample XML File: Typical Purchase Order (LINQ to XML)" - href: sample-xml-file-typical-purchase-order-linq-to-xml.md - - name: "Sample XML File: Typical Purchase Order in a Namespace" - href: sample-xml-file-typical-purchase-order-in-a-namespace.md - - name: "Sample XML File: Multiple Purchase Orders (LINQ to XML)" - href: sample-xml-file-multiple-purchase-orders-linq-to-xml.md - - name: "Sample XML File: Multiple Purchase Orders in a Namespace" - href: sample-xml-file-multiple-purchase-orders-in-a-namespace.md - - name: "Sample XML File: Test Configuration (LINQ to XML)" - href: sample-xml-file-test-configuration-linq-to-xml.md - - name: "Sample XML File: Test Configuration in a Namespace" - href: sample-xml-file-test-configuration-in-a-namespace.md - - name: "Sample XML File: Customers and Orders (LINQ to XML)" - href: sample-xml-file-customers-and-orders-linq-to-xml.md - - name: "Sample XSD File: Customers and Orders" - href: sample-xsd-file-customers-and-orders.md - - name: "Sample XML File: Customers and Orders in a Namespace" - href: sample-xml-file-customers-and-orders-in-a-namespace.md - - name: "Sample XML File: Numerical Data (LINQ to XML)" - href: sample-xml-file-numerical-data-linq-to-xml.md - - name: "Sample XML File: Numerical Data in a Namespace" - href: sample-xml-file-numerical-data-in-a-namespace.md - - name: "Sample XML File: Books (LINQ to XML)" - href: sample-xml-file-books-linq-to-xml.md - - name: "Sample XML File: Consolidated Purchase Orders" - href: sample-xml-file-consolidated-purchase-orders.md - - name: Reference (LINQ to XML) - href: reference-linq-to-xml.md - name: LINQ to ADO.NET (Portal Page) href: linq-to-adonet-portal-page.md - name: Enabling a Data Source for LINQ Querying diff --git a/docs/visual-basic/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md b/docs/visual-basic/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md deleted file mode 100644 index 8bc62db096a43..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/tutorial-manipulating-content-in-a-wordprocessingml-document.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -title: "Tutorial: Manipulating Content in a WordprocessingML Document" -ms.date: 07/20/2015 -ms.assetid: f8028ba8-2dd1-4425-930c-8cc23176ebbc ---- -# Tutorial: Manipulating Content in a WordprocessingML Document (Visual Basic) -This tutorial shows how to apply the functional transformational approach and LINQ to XML to manipulate XML documents. The Visual Basic examples query and manipulate information in Office Open XML WordprocessingML documents that are saved by Microsoft Word. - - For more information, see the [Eric White's Blog](http://www.ericwhite.com). - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Shape of WordprocessingML Documents (Visual Basic)](shape-of-wordprocessingml-documents.md)|Provides a quick explanation of details of a WordprocessingML document.| -|[Creating the Source Office Open XML Document (Visual Basic)](creating-the-source-office-open-xml-document.md)|Provides step-by-step instructions to create the source document for queries in this tutorial.| -|[Finding the Default Paragraph Style (Visual Basic)](finding-the-default-paragraph-style.md)|Shows a query to find the name of the default style for a document.| -|[Retrieving the Paragraphs and Their Styles (Visual Basic)](retrieving-the-paragraphs-and-their-styles.md)|Shows a query that retrieves a collection of the paragraphs of a document.| -|[Retrieving the Text of the Paragraphs (Visual Basic)](retrieving-the-text-of-the-paragraphs.md)|Augments the previous query to retrieve the text of each paragraph.| -|[Refactoring Using an Extension Method (Visual Basic)](refactoring-using-an-extension-method.md)|Simplifies the code by refactoring using an extension method.| -|[Refactoring Using a Pure Function (Visual Basic)](refactoring-using-a-pure-function.md)|Further simplifies the code by refactoring using a pure function.| -|[Projecting XML in a Different Shape (Visual Basic)](projecting-xml-in-a-different-shape.md)|Completes an XML transformation by projecting XML in a different shape than the original document.| -|[Finding Text in Word Documents (Visual Basic)](finding-text-in-word-documents.md)|Uses the previous queries to find a specified text string in a document.| -|[Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md)|Provides some details of Office Open XML WordprocessingML documents.| - -## See also - -- [Pure Functional Transformations of XML (Visual Basic)](pure-functional-transformations-of-xml.md) -- [Introduction to Pure Functional Transformations (Visual Basic)](introduction-to-pure-functional-transformations.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md b/docs/visual-basic/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md deleted file mode 100644 index d8cc7b1e7ac51..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/using-xslt-to-transform-an-xml-tree.md +++ /dev/null @@ -1,62 +0,0 @@ ---- -title: "Using XSLT to Transform an XML Tree" -ms.date: 07/20/2015 -ms.assetid: 3390ca68-c270-4e1d-b64b-6a063a77017c ---- -# Using XSLT to Transform an XML Tree (Visual Basic) - -You can create an XML tree, create an from the XML tree, create a new document, and create an that will write into the new document. Then, you can invoke the XSLT transformation, passing the and to the transformation. After the transformation successfully completes, the new XML tree is populated with the results of the transform. - -## Example - -```vb -Dim xslMarkup As XDocument = _ - - - - - - - - - - - - - - -Dim xmlTree As XElement = _ - - Child1 data - Child2 data - - -Dim newTree As XDocument = New XDocument() - -Using writer As XmlWriter = newTree.CreateWriter() - ' Load the style sheet. - Dim xslt As XslCompiledTransform = _ - New XslCompiledTransform() - xslt.Load(xslMarkup.CreateReader()) - - ' Execute the transform and output the results to a writer. - xslt.Transform(xmlTree.CreateReader(), writer) -End Using - -Console.WriteLine(newTree) -``` - -This example produces the following output: - -```xml - - Child1 data - Child2 data - -``` - -## See also - -- -- -- [Advanced LINQ to XML Programming (Visual Basic)](advanced-linq-to-xml-programming.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects.md b/docs/visual-basic/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects.md deleted file mode 100644 index d36a6c45ce53e..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/valid-content-of-xelement-and-xdocument-objects.md +++ /dev/null @@ -1,87 +0,0 @@ ---- -title: "Valid Content of XElement and XDocument Objects2" -ms.date: 07/20/2015 -ms.assetid: 400bb692-478a-40b6-ac1b-4ccbb4cbbd02 ---- -# Valid Content of XElement and XDocument Objects -This topic describes the valid arguments that can be passed to constructors and methods that you use to add content to elements and documents. - -## Valid Content - Queries often evaluate to of or of . You can pass collections of or objects to the constructor. Therefore, it is convenient to pass the results of a query as content into methods and constructors that you use to populate XML trees. - - When adding simple content, various types can be passed to this method. Valid types include the following: - -- - -- - -- - -- - -- - -- - -- - -- - -- Any type that implements `Object.ToString`. - -- Any type that implements . - - When adding complex content, various types can be passed to this method: - -- - -- - -- - -- Any type that implements - - If an object implements , the collection in the object is enumerated, and all items in the collection are added. If the collection contains or objects, each item in the collection is added separately. If the collection contains text (or objects that are converted to text), the text in the collection is concatenated and added as a single text node. - - If content is `null`, nothing is added. When passing a collection items in the collection can be `null`. A `null` item in the collection has no effect on the tree. - - An added attribute must have a unique name within its containing element. - - When adding or objects, if the new content has no parent, then the objects are simply attached to the XML tree. If the new content already is parented and is part of another XML tree, then the new content is cloned, and the newly cloned content is attached to the XML tree. - -## Valid Content for Documents - Attributes and simple content cannot be added to a document. - - There are not many scenarios that require you to create an . Instead, you can usually create your XML trees with an root node. Unless you have a specific requirement to create a document (for example, because you have to create processing instructions and comments at the top level, or you have to support document types), it is often more convenient to use as your root node. - - Valid content for a document includes the following: - -- Zero or one objects. The document types must come before the element. - -- Zero or one element. - -- Zero or more comments. - -- Zero or more processing instructions. - -- Zero or more text nodes that contain only white space. - -## Constructors and Functions that Allow Adding Content - The following methods allow you to add child content to an or an : - -|Method|Description| -|------------|-----------------| -||Constructs an .| -||Constructs a .| -||Adds to the end of the child content of the or .| -||Adds content after the .| -||Adds content before the .| -||Adds content at the beginning of the child content of the .| -||Replaces all content (child nodes and attributes) of an .| -||Replaces the attributes of an .| -||Replaces the children nodes with new content.| -||Replaces a node with new content.| - -## See also - -- [Creating XML Trees (Visual Basic)](creating-xml-trees.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md b/docs/visual-basic/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md deleted file mode 100644 index ed4b4dbb95dff..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/wordprocessingml-document-with-styles.md +++ /dev/null @@ -1,136 +0,0 @@ ---- -title: "WordprocessingML Document with Styles2" -ms.date: 07/20/2015 -ms.assetid: a9136e4d-c368-4661-8049-7d45c679a236 ---- -# WordprocessingML Document with Styles -More complicated WordprocessingML documents have paragraphs that are formatted with styles. - - A few notes about the makeup of WordprocessingML documents are helpful. WordprocessingML documents are stored in packages. Packages have multiple parts (parts have an explicit meaning when used in the context of packages; essentially, parts are files that are zipped together to comprise a package). If a document contains paragraphs that are formatted with styles, there will be a document part that contains paragraphs that have styles applied to them. There will also be a style part that contains the styles that are referred to by the document. - - When accessing packages, it is important that you do so through the relationships between parts, rather than using an arbitrary path. This issue is beyond the scope of the Manipulating Content in a WordprocessingML Document tutorial, but the example programs that are included in this tutorial demonstrate the correct approach. - -## A Document that Uses Styles - The WordML example presented in the [Shape of WordprocessingML Documents (Visual Basic)](shape-of-wordprocessingml-documents.md) topic is a very simple one. The following document is more complicated: It has paragraphs that are formatted with styles. The easiest way to see the XML that makes up an Office Open XML document is to run the [Example that Outputs Office Open XML Document Parts (Visual Basic)](example-that-outputs-office-open-xml-document-parts.md). - - In the following document, the first paragraph has the style `Heading1`. There are a number of paragraphs that have the default style. There are also a number of paragraphs that have the style `Code`. Because of this relative complexity, this is a more interesting document to parse with LINQ to XML. - - In those paragraphs with non-default styles, the paragraph elements have a child element named `w:pPr`, which in turn has a child element `w:pStyle`. That element has an attribute, `w:val`, which contains the style name. If the paragraph has the default style, it means that the paragraph element does not have a `w:p.Pr` child element. - -```xml - - - - - - - - - Parsing WordprocessingML with LINQ to XML - - - - - - The following example prints to the console. - - - - - - - - - using System; - - - - - - - - - - - - - class Program { - - - - - - - - public static void - - - - Main - - - - (string[] args) { - - - - - - - - Console.WriteLine("Hello World"); - - - - - - - - } - - - - - - - - } - - - - - - This example produces the following output: - - - - - - - - - Hello World - - - - - - - - - - -``` - -## See also - -- [Details of Office Open XML WordprocessingML Documents (Visual Basic)](details-of-office-open-xml-wordprocessingml-documents.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/working-with-global-namespaces-linq-to-xml.md b/docs/visual-basic/programming-guide/concepts/linq/working-with-global-namespaces-linq-to-xml.md deleted file mode 100644 index 08037cd47f27b..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/working-with-global-namespaces-linq-to-xml.md +++ /dev/null @@ -1,196 +0,0 @@ ---- -title: "Working with Global Namespaces (LINQ to XML)" -ms.date: 07/20/2015 -ms.assetid: 0a8064d5-e02f-4315-ad48-6deaa443a2f0 ---- -# Working with Global Namespaces (Visual Basic) (LINQ to XML) -One of the key features of XML literals in Visual Basic is the capability to declare XML namespaces by using the `Imports` statement. Using this feature, you can declare an XML namespace that uses a prefix, or you can declare a default XML namespace. - - This capability is useful in two situations. First, namespaces declared in XML literals do not carry over into embedded expressions. Declaring global namespaces reduces the amount of work that you have to do to use embedded expressions with namespaces. Second, you must declare global namespaces in order to use namespaces with XML properties. - - You can declare global namespaces at the project level. You can also declare global namespaces at the module level, which overrides the project-level global namespaces. Finally, you can override global namespaces in an XML literal. - - When using XML literals or XML properties that are in globally-declared namespaces, you can see the expanded name of XML literals or properties by hovering over them in Visual Studio. You will see the expanded name in a tooltip. - - You can get an object that corresponds to a global namespace using the `GetXmlNamespace` method. - -## Examples of Global Namespaces - The following example declares a default global namespace by using the `Imports` statement, and then uses an XML literal to initialize an object in that namespace: - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = - Console.WriteLine(root) - End Sub -End Module -``` - - This example produces the following output: - -```xml - -``` - - The following example declares a global namespace with a prefix, and then uses an XML literal to initialize an element: - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = - Console.WriteLine(root) - End Sub -End Module -``` - - This example produces the following output: - -```xml - -``` - -## Global Namespaces and Embedded Expressions - Namespaces that are declared in XML literals do not carry over into embedded expressions. The following example declares a default namespace. It then uses an embedded expression for the `Child` element. - -```vb -Dim root As XElement = _ - - <%= %> - -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - - - -``` - - As you can see, the resulting XML includes a declaration of a default namespace so that the `Child` element is in no namespace. - - You could re-declare the namespace in the embedded expression, as follows: - -```vb -Dim root As XElement = _ - - <%= %> - -Console.WriteLine(root) -``` - - This example produces the following output: - -```xml - - - -``` - - However, this is more cumbersome to use than the global default namespace, which is a better approach. With the global default namespace, you can use XML literals without declaring namespaces. The resulting XML will be in the globally-declared default namespace. - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = - <%= %> - - Console.WriteLine(root) - End Sub -End Module -``` - - This example produces the following output: - -```xml - - - -``` - -## Using Namespaces with XML Properties - If you are working with an XML tree that is in a namespace, and you use XML properties, then you must use a global namespace so that the XML properties will also be in the correct namespace. The following example declares an XML tree in a namespace. It then prints the count of `Child` elements. - -```vb -Dim root As XElement = _ - - content - -Console.WriteLine(root..Count()) -``` - - This example indicates that there are no `Child` elements. It produces the following output: - -```console -0 -``` - - If, however, you declare a default global namespace, then both the XML literal and the XML property are in the default global namespace: - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - content - - Console.WriteLine(root..Count()) - End Sub -End Module -``` - - This example indicates that there is one `Child` element. It produces the following output: - -```console -1 -``` - - If you declare a global namespace that has a prefix, you can use the prefix for both XML literals and XML properties: - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = _ - - content - - Console.WriteLine(root..Count()) - End Sub -End Module -``` - -## XNamespace and Global Namespaces - You can get an object by using the `GetXmlNamespace` method: - -```vb -Imports - -Module Module1 - Sub Main() - Dim root As XElement = - Dim xn As XNamespace = GetXmlNamespace(aw) - Console.WriteLine(xn) - End Sub -End Module -``` - - This example produces the following output: - -```console -http://www.adventure-works.com -``` - -## See also - -- [Namespaces Overview (LINQ to XML) (Visual Basic)](namespaces-overview-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/working-with-xml-namespaces.md b/docs/visual-basic/programming-guide/concepts/linq/working-with-xml-namespaces.md deleted file mode 100644 index 42948f20b1a37..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/working-with-xml-namespaces.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -title: "Working with XML Namespaces" -ms.date: 07/20/2015 -ms.assetid: 428bf4b0-e348-4ffd-986b-d905d5a0e7fa ---- -# Working with XML Namespaces (Visual Basic) -The topics in this section describe how [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] supports namespaces. - -## In This Section - -|Topic|Description| -|-----------|-----------------| -|[Namespaces Overview (LINQ to XML)](namespaces-overview-linq-to-xml.md)|This topic introduces namespaces, the class, and the class.| -|[How to: Create a Document with Namespaces (LINQ to XML) (Visual Basic)](how-to-create-a-document-with-namespaces.md)|Shows how to create documents with namespaces.| -|[How to: Control Namespace Prefixes (Visual Basic) (LINQ to XML)](how-to-control-namespace-prefixes-linq-to-xml.md)|Shows how to control namespace prefixes by declaring global namespaces.| -|[Scope of Default Namespaces in Visual Basic](scope-of-default-namespaces.md)|Demonstrates the appropriate way to write queries for XML in the default namespace.| -|[Working with Global Namespaces (Visual Basic) (LINQ to XML)](working-with-global-namespaces-linq-to-xml.md)|Explains the semantics of global namespaces in Visual Basic, and reasons for using them.| -|[How to: Write Queries on XML in Namespaces (Visual Basic)](how-to-write-queries-on-xml-in-namespaces.md)|Demonstrates how to specify XML namespaces in Visual Basic LINQ to XML queries.| - -## See also - -- [Programming Guide (LINQ to XML) (Visual Basic)](programming-guide-linq-to-xml.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/xattribute-class-overview.md b/docs/visual-basic/programming-guide/concepts/linq/xattribute-class-overview.md deleted file mode 100644 index a6864aa3222b3..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/xattribute-class-overview.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -title: "XAttribute Class Overview" -ms.date: 07/20/2015 -ms.assetid: 7781580a-9583-4a1b-ae1e-91c5936eb0b1 ---- -# XAttribute Class Overview (Visual Basic) -Attributes are name/value pairs that are associated with an element. The class represents XML attributes. - -## Overview - Working with attributes in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] is similar to working with elements. Their constructors are similar. The methods that you use to retrieve collections of them are similar. A LINQ query expression for a collection of attributes looks very similar to a LINQ query expression for a collection of elements. - - The order in which attributes were added to an element is preserved. That is, when you iterate through the attributes, you see them in the same order that they were added. - -## The XAttribute Constructor - The following constructor of the class is the one that you will most commonly use: - -|Constructor|Description| -|-----------------|-----------------| -|`XAttribute(XName name, object content)`|Creates an object. The `name` argument specifies the name of the attribute; `content` specifies the content of the attribute.| - -### Creating an Element with an Attribute - The following code shows an element that contains an attribute using XML literals in Visual Basic: - -```vb -Dim phone As XElement = 555-555-5555 -Console.WriteLine(phone) -``` - - This example produces the following output: - -```xml -555-555-5555 -``` - -### Functional Construction of Attributes - You can construct objects in-line with the construction of objects, as follows: - -```vb -Dim c As XElement = _ - - - John Doe - - 555-555-5555 - 666-666-6666 - - - -Console.WriteLine(c) -``` - - This example produces the following output: - -```xml - - - John Doe - - 555-555-5555 - 666-666-6666 - - - -``` - -### Attributes Are Not Nodes - There are some differences between attributes and elements. objects are not nodes in the XML tree. They are name/value pairs associated with an XML element. In contrast to the Document Object Model (DOM), this more closely reflects the structure of XML. Although objects are not actually nodes in the XML tree, working with objects is very similar to working with objects. - - This distinction is primarily important only to developers who are writing code that works with XML trees at the node level. Many developers will not be concerned with this distinction. - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md b/docs/visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md deleted file mode 100644 index ae18d5f847c36..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/xdocument-class-overview.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: "XDocument Class Overview" -ms.date: 07/20/2015 -ms.assetid: 45cb7e71-196a-47da-bfe9-7a5589db1eed ---- -# XDocument Class Overview (Visual Basic) -This topic introduces the class. - -## Overview of the XDocument class - The class contains the information necessary for a valid XML document. This includes an XML declaration, processing instructions, and comments. - - Note that you only have to create objects if you require the specific functionality provided by the class. In many circumstances, you can work directly with . Working directly with is a simpler programming model. - - derives from . Therefore, it can contain child nodes. However, objects can have only one child node. This reflects the XML standard that there can be only one root element in an XML document. - -## Components of XDocument - An can contain the following elements: - -- One object. enables you to specify the pertinent parts of an XML declaration: the XML version, the encoding of the document, and whether the XML document is stand-alone. - -- One object. This is the root node of the XML document. - -- Any number of objects. A processing instruction communicates information to an application that processes the XML. - -- Any number of objects. The comments will be siblings to the root element. The object cannot be the first argument in the list, because it is not valid for an XML document to start with a comment. - -- One for the DTD. - - When you serialize an , even if `XDocument.Declaration` is `null`, the output will have an XML declaration if the writer has `Writer.Settings.OmitXmlDeclaration` set to `false` (the default). - - By default, [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] sets the version to "1.0", and sets the encoding to "utf-8". - -## Using XElement without XDocument - As previously mentioned, the class is the main class in the [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)] programming interface. In many cases, your application will not require that you create a document. By using the class, you can create an XML tree, add other XML trees to it, modify the XML tree, and save it. - -## Using XDocument - To construct an , use functional construction, just like you do to construct objects. - - The following code creates an object and its associated contained objects. - -```vb -Dim doc As XDocument = - - - - - Artifacts of Roman Civilization - Moreno, Jordao - - - Midieval Tools and Implements - Gazit, Inbar - - - -doc.Save("test.xml") -``` - - When you examine the file test.xml, you get the following output: - -```xml - - - - - - Artifacts of Roman Civilization - Moreno, Jordao - - - Midieval Tools and Implements - Gazit, Inbar - - - -``` - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md) diff --git a/docs/visual-basic/programming-guide/concepts/linq/xelement-class-overview.md b/docs/visual-basic/programming-guide/concepts/linq/xelement-class-overview.md deleted file mode 100644 index 3976f07be27bd..0000000000000 --- a/docs/visual-basic/programming-guide/concepts/linq/xelement-class-overview.md +++ /dev/null @@ -1,97 +0,0 @@ ---- -title: "XElement Class Overview" -ms.date: 07/20/2015 -ms.assetid: 52331fcd-6023-4d19-b423-7b24f2d86ded ---- -# XElement Class Overview (Visual Basic) -The class is one of the fundamental classes in [!INCLUDE[sqltecxlinq](~/includes/sqltecxlinq-md.md)]. It represents an XML element. You can use this class to create elements; change the content of the element; add, change, or delete child elements; add attributes to an element; or serialize the contents of an element in text form. You can also interoperate with other classes in , such as , , and . - -## XElement Functionality - This topic describes the functionality provided by the class. - -### Constructing XML Trees - You can construct XML trees in a variety of ways, including the following: - -- You can construct an XML tree in code. For more information, see [Creating XML Trees (Visual Basic)](creating-xml-trees.md). - -- You can parse XML from various sources, including a , text files, or a Web address (URL). For more information, see [Parsing XML (Visual Basic)](parsing-xml.md). - -- You can use an to populate the tree. For more information, see . - -- If you have a module that can write content to an , you can use the method to create a writer, pass the writer to the module, and then use the content that is written to the to populate the XML tree. - - However, the most common way to create an XML tree is as follows: - -```vb -Dim contacts As XElement = _ - - - Patrick Hines - 206-555-0144 -
- 123 Main St - Mercer Island - WA - 68042 -
-
-
-``` - - Another very common technique for creating an XML tree involves using the results of a LINQ query to populate an XML tree, as shown in the following example: - -```vb -Dim srcTree As XElement = _ - - 1 - 2 - 3 - 4 - 5 - -Dim xmlTree As XElement = _ - - 1 - 2 - <%= From el In srcTree.Elements() _ - Where el.Value > 2 _ - Select el %> - -Console.WriteLine(xmlTree) -``` - - This example produces the following output: - -```xml - - 1 - 2 - 3 - 4 - 5 - -``` - -### Serializing XML Trees - You can serialize the XML tree to a , a , or an . - - For more information, see [Serializing XML Trees (Visual Basic)](serializing-xml-trees.md). - -### Retrieving XML Data via Axis Methods - You can use axis methods to retrieve attributes, child elements, descendant elements, and ancestor elements. LINQ queries operate on axis methods, and provide several flexible and powerful ways to navigate through and process an XML tree. - - For more information, see [LINQ to XML Axes (Visual Basic)](linq-to-xml-axes.md). - -### Querying XML Trees - You can write LINQ queries that extract data from an XML tree. - - For more information, see [Querying XML Trees (Visual Basic)](querying-xml-trees.md). - -### Modifying XML Trees - You can modify an element in a variety of ways, including changing its content or attributes. You can also remove an element from its parent. - - For more information, see [Modifying XML Trees (LINQ to XML) (Visual Basic)](modifying-xml-trees-linq-to-xml.md). - -## See also - -- [LINQ to XML Programming Overview (Visual Basic)](linq-to-xml-programming-overview.md)