721 instantiations of XElement
aspire (44)
Commands\AddCommand.cs (3)
345new System.Xml.Linq.XElement("configuration", 346new System.Xml.Linq.XElement("packageSources", 348new System.Xml.Linq.XElement("add",
Packaging\NuGetConfigMerger.cs (16)
181var configuration = doc.Root ?? new XElement("configuration"); 190packageSources = new XElement("packageSources"); 240var add = new XElement("add"); 409targetSourceElement = new XElement("packageSource"); 424var packageElement = new XElement("package"); 472targetSourceElement = new XElement("packageSource"); 487var packageElement = new XElement("package"); 602var packageSourceElement = new XElement("packageSource"); 605var wildcardPackage = new XElement("package"); 727var packageSourceMapping = new XElement("packageSourceMapping"); 739var packageSource = new XElement("packageSource"); 744var packageElement = new XElement("package"); 787var packageSourceElement = new XElement("packageSource"); 790var wildcardPackage = new XElement("package"); 976config = new XElement("config"); 990var globalPackagesFolderAdd = new XElement("add");
Packaging\TemporaryNuGetConfig.cs (1)
136var configuration = document.Root ?? new XElement("configuration");
Projects\CSharpProjectFile.cs (11)
191var root = new XElement("Project", new XAttribute("Sdk", Sdk)); 195root.Add(new XElement("PropertyGroup", 196Properties.Select(property => new XElement(property.Name, property.Value)))); 201root.Add(new XElement("ItemGroup", 207root.Add(new XElement("ItemGroup", 213root.Add(new XElement("ItemGroup", 217root.Add(Imports.Select(import => new XElement("Import", new XAttribute("Project", import.ProjectPath)))); 228var element = new XElement("PackageReference", new XAttribute("Include", packageReference.Name)); 243var element = new XElement("ProjectReference", new XAttribute("Include", projectReference.ProjectPath)); 254var element = new XElement("None", new XAttribute("Update", noneItem.Update)); 271element.Add(new XElement(name, value.Value ? "true" : "false"));
Projects\DotNetBasedAppHostServerProject.cs (2)
204projectFile.Targets.Add(new XElement("Target", new XAttribute("Name", "_CSharpWriteHostProjectMetadataSources"))); 205projectFile.Targets.Add(new XElement("Target", new XAttribute("Name", "_CSharpWriteProjectMetadataSources")));
Projects\IntegrationClosureBuilder.cs (11)
80new XElement("Target", 84new XElement("WriteLinesToFile", 91new XElement("Target", 96new XElement("WriteLinesToFile", 101new XElement("WriteLinesToFile", 106new XElement("WriteLinesToFile", 123var propertyGroup = new XElement("PropertyGroup", 124new XElement("BaseOutputPath", CliPathHelper.EnsureTrailingSlash(Path.Combine(restoreDir, "bin"))), 125new XElement("BaseIntermediateOutputPath", CliPathHelper.EnsureTrailingSlash(Path.Combine(restoreDir, "obj"))), 126new XElement("MSBuildProjectExtensionsPath", "$(BaseIntermediateOutputPath)")); 128return new XDocument(new XElement("Project", propertyGroup));
aspire-tray (9)
src\Aspire.Tray\Common\MacTrayStartupSettings.cs (9)
29new XElement("plist", new XAttribute("version", "1.0"), 30new XElement("dict", 31new XElement("key", "Label"), new XElement("string", Label), 32new XElement("key", "ProgramArguments"), 33new XElement("array", new[] { cliPath, "tray", "start", "--non-interactive", "--nologo" } 34.Select(argument => new XElement("string", argument))), 35new XElement("key", "RunAtLoad"), new XElement("true"))));
Aspire.Cli.EndToEnd.Tests (3)
EntityFrameworkCoreDeploymentTests.cs (1)
267propertyGroup.Add(new XElement(propertyGroup.Name.Namespace + "RuntimeIdentifiers", targetRuntime));
Helpers\KubernetesDeployTestHelpers.cs (2)
372var references = new System.Xml.Linq.XElement("ItemGroup"); 377references.Add(new System.Xml.Linq.XElement("ProjectReference",
Aspire.Cli.Tests (1)
Projects\ProjectUpdaterTests.cs (1)
77document.Root!.Add(new System.Xml.Linq.XElement("Import",
Aspire.Hosting.Azure.Provisioning.Generators (6)
AspireProvisioningProxyGenerator.cs (6)
1145new XElement("returns", $"The result of {method.Name}."), 2076new XElement("summary", summary), 2134?? new XElement( 2159new XElement( 2185new XElement( 2221var rewritten = new XElement(
Aspire.Hosting.Dotnet (12)
DotnetProjectBuildResource.cs (12)
234new XElement( 237new XElement( 240new XElement( 245new XElement( 247new XElement("RestoreGraphProjectInput", "@(ProjectFile->'%(FullPath)')"), 248restoreProjectsIndividually ? null : new XElement( 253restoreProjectsIndividually ? null : new XElement( 290target.AddFirst(new XElement( 299new XElement( 304new XElement( 318new( 321new XElement(
Aspire.Hosting.Maui (17)
Utilities\MauiEnvironmentHelper.cs (17)
76var projectElement = new XElement("Project"); 79projectElement.Add(new XElement( 86var itemGroup = new XElement("ItemGroup"); 90itemGroup.Add(new XElement("_GeneratedAndroidEnvironment", new XAttribute("Include", $"{key}={encodedValue}"))); 95var targetElement = new XElement( 103targetElement.Add(new XElement( 112targetElement.Add(new XElement( 114new XElement("AndroidEnvironment", new XAttribute("Include", "$(IntermediateOutputPath)__aspire_environment__.txt")) 118targetElement.Add(new XElement( 120new XElement("FileWrites", new XAttribute("Include", "$(IntermediateOutputPath)__aspire_environment__.txt")) 124targetElement.Add(new XElement( 217var projectElement = new XElement("Project"); 220projectElement.Add(new XElement( 228var itemGroup = new XElement("ItemGroup"); 235itemGroup.Add(new XElement("MlaunchEnvironmentVariables", 242projectElement.Add(new XElement( 247new XElement(
Aspire.Templates.Tests (4)
BuildAndRunTemplateTests.cs (4)
102versions.Add(new XElement("PackageVersion", 158document.Root!.AddFirst(new XElement("Sdk", 160document.Root.AddFirst(new XElement("PropertyGroup", 161new XElement("SuppressAspireAppHostSdkObsoleteWarning", "true")));
Aspire.Tray.Tests (9)
src\Aspire.Tray\Common\MacTrayStartupSettings.cs (9)
29new XElement("plist", new XAttribute("version", "1.0"), 30new XElement("dict", 31new XElement("key", "Label"), new XElement("string", Label), 32new XElement("key", "ProgramArguments"), 33new XElement("array", new[] { cliPath, "tray", "start", "--non-interactive", "--nologo" } 34.Select(argument => new XElement("string", argument))), 35new XElement("key", "RunAtLoad"), new XElement("true"))));
dotnet-svcutil-lib (13)
Shared\MSBuildProj.cs (12)
84_projectReferenceGroup = new XElement("ItemGroup"); 107_referenceGroup = new XElement("ItemGroup"); 131_packageReferenceGroup = new XElement("ItemGroup"); 450XElement propertyGroup = new XElement(group); 538this.ProjectReferceGroup.Add(new XElement("ProjectReference", new XAttribute("Include", dependency.FullPath))); 541this.ReferenceGroup.Add(new XElement("Reference", new XAttribute("Include", dependency.AssemblyName), new XElement("HintPath", dependency.FullPath))); 544this.PacakgeReferenceGroup.Add(new XElement("PackageReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version))); 547this.ReferenceGroup.Add(new XElement("DotNetCliToolReference", new XAttribute("Include", dependency.Name), new XAttribute("Version", dependency.Version))); 561this.ReferenceGroup.Add(new XElement("Content", 571this.PacakgeReferenceGroup.Add(new XElement("Content", 598XElement element = new XElement(propertyName, null);
Shared\Utilities\RuntimeEnvironmentHelper.cs (1)
100var addElement = new XElement("add");
dotnet-user-jwts (2)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
dotnet-user-secrets (2)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (2)
57propertyGroup = new XElement("PropertyGroup"); 63propertyGroup.Add(new XElement("UserSecretsId", newSecretsId));
GenerateDocumentationAndConfigFiles (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
GenerateTemplateManifest (24)
Program.cs (6)
157sources.Add(new XElement("add", new XAttribute("key", cacheSource), new XAttribute("value", sharedCache))); 162mappings.Add(new XElement("packageSource", new XAttribute("key", cacheSource), 163cachePatterns.Select(pattern => new XElement("package", new XAttribute("pattern", pattern))))); 168sources.Add(new XElement("add", 171mappings.Add(new XElement("packageSource", 173builtIds.Order(StringComparer.OrdinalIgnoreCase).Select(id => new XElement("package", new XAttribute("pattern", id)))));
TemplateRestorePlan.cs (18)
147var project = new XElement("Project", new XAttribute("Sdk", "Microsoft.NET.Sdk"), 148new XElement("PropertyGroup", 149new XElement("TargetFramework", parameters["Framework"]), 150new XElement("OutputType", "Exe"), 151new XElement("FileBasedProgram", "true"))); 168project.Add(new XElement("ItemGroup", new XElement("PackageReference", new XAttribute("Include", name), new XAttribute("Version", value)))); 171project.Element("PropertyGroup")!.Add(new XElement(name, value)); 237var project = new XElement(source); 282project.Add(new XElement(groupName, elements)); 292var root = new XElement(project.Project); 293root.AddFirst(new XElement("PropertyGroup", 294project.Frameworks.Count > 0 ? new XElement("TargetFrameworks", string.Join(";", project.Frameworks)) : null, 295new XElement("EnableDefaultItems", "false"), 296new XElement("ManagePackageVersionsCentrally", "false"), 297new XElement("NuGetAudit", "false"))); 303new XDocument(new XElement("Solution", Projects.Select(project => 304new XElement("Project", new XAttribute("Path", $"{project.Name}/{project.Name}.csproj"))))).Save(solutionPath);
illink (7)
ILLink.Tasks (1)
CombineLinkerXmlFiles.cs (1)
30var combined = new XElement("linker");
Infrastructure.Tests (92)
Hex1bNativePublishingTests.cs (37)
400var nativeItems = new XElement("ItemGroup"); 406nativeItems.Add(new XElement(rid.Length == 0 ? "RuntimeTargetsCopyLocalItems" : "NativeCopyLocalItems", 408new XElement("NuGetPackageId", "Hex1b"), 409new XElement("PathInPackage", pathInPackage), 410new XElement("DestinationSubPath", rid.Length == 0 ? pathInPackage : Path.GetFileName(pathInPackage)), 411new XElement("DestinationSubDirectory", rid.Length == 0 ? pathInPackage[..(pathInPackage.LastIndexOf('/') + 1)] : ""))); 416var unrelatedItem = new XElement("ResolvedFileToPublish", 418new XElement("NuGetPackageId", "OtherPackage"), 419new XElement("PathInPackage", "native/OpenConsole.exe"), 420new XElement("RelativePath", "other/OpenConsole.exe")); 421var publishItems = new XElement("ItemGroup", 422new XElement("ResolvedFileToPublish", 424new XElement("RelativePath", "%(DestinationSubDirectory)%(Filename)%(Extension)")), 428publishItems.Add(new XElement("ResolvedFileToPublish", 430new XElement("RelativePath", "other/OpenConsole.exe"))); 436var project = new XDocument(new XElement("Project", 437new XElement("PropertyGroup", 438new XElement("ImportDirectoryBuildProps", "false"), 439new XElement("ImportDirectoryBuildTargets", "false")), 440new XElement("Import", new XAttribute("Project", "Sdk.props"), new XAttribute("Sdk", "Microsoft.NET.Sdk")), 441new XElement("PropertyGroup", 442new XElement("TargetFramework", "net11.0"), 443new XElement("RuntimeIdentifier", rid), 444new XElement("PublishSingleFile", singleFile), 445new XElement("IncludeNativeLibrariesForSelfExtract", "true")), 446new XElement("Import", new XAttribute("Project", "Sdk.targets"), new XAttribute("Sdk", "Microsoft.NET.Sdk")), 447new XElement("Import", new XAttribute("Project", Path.Combine(RepoRoot.Path, "src", "Aspire.Hosting", "buildTransitive", "Aspire.Hosting.targets"))), 448new XElement("Target", new XAttribute("Name", "ResolvePackageAssets"), nativeItems), 449new XElement("Target", new XAttribute("Name", "_ResolveCopyLocalAssetsForPublish"), 451new XElement("ItemGroup", new XElement("_ResolvedCopyLocalPublishAssets", 453new XElement("DestinationSubPath", "%(Filename)%(Extension)"), 454new XElement("DestinationSubDirectory", "")))), 455new XElement("Target", new XAttribute("Name", "ComputeResolvedFilesToPublishList"), 457new XElement("Target", new XAttribute("Name", "ComputeFilesToPublish"), 459new XElement("Target", new XAttribute("Name", "CopyTestFiles"), 461new XElement("Copy", new XAttribute("SourceFiles", "@(ResolvedFileToPublish)"),
ResourceGeneratorMetadataTests.cs (15)
66var project = new XDocument(new XElement("Project", 67new XElement("PropertyGroup", configuration.Root!.Elements("PropertyGroup").Elements("ResxCodeGenerator").Select(property => new XElement(property))), 68new XElement("PropertyGroup", source.Root!.Elements("PropertyGroup").Elements("ResxCodeGenerator").Select(property => new XElement(property))), 69new XElement("ItemGroup", 70neutralResources.Concat(otherResources).Select(path => new XElement("EmbeddedResource", new XAttribute("Include", path))), 71designers.Concat(otherSources).Select(path => new XElement("Compile", new XAttribute("Include", path)))), 72new XElement("ItemGroup", source.Root.Elements("ItemGroup").Elements() 74.Select(item => new XElement(item))))); 77settingsDesigner.Add(new XElement("DependentUpon", "Settings.settings")); 78settingsDesigner.Add(new XElement("DesignTime", "True")); 79settingsDesigner.Add(new XElement("AutoGen", "True")); 82linkedResource.Add(new XElement("Link", Path.Combine(resourceDirectory, "Linked.resx"))); 83linkedResource.Add(new XElement("LogicalName", "Shared.Linked.resources"));
Shared\TestTrxBuilder.cs (14)
27new XElement( 29new XElement( 32new XElement( 35new XElement( 37new XElement( 94return new XElement( 98new XElement( 106return new XElement( 116new XElement( 119string.IsNullOrEmpty(testCase.StdOut) ? null : new XElement(s_namespace + "StdOut", testCase.StdOut), 120string.IsNullOrEmpty(testCase.StdErr) ? null : new XElement(s_namespace + "StdErr", testCase.StdErr))); 130return new XElement( 132string.IsNullOrEmpty(testCase.ErrorMessage) ? null : new XElement(s_namespace + "Message", testCase.ErrorMessage), 133string.IsNullOrEmpty(testCase.StackTrace) ? null : new XElement(s_namespace + "StackTrace", testCase.StackTrace));
TemplateManifest\TemplateManifestBuildTargetTests.cs (8)
34new XDocument(new XElement("Project", 35new XElement("PropertyGroup", 36new XElement("RepoRoot", root + Path.DirectorySeparatorChar), 37new XElement("IntermediateOutputPath", Path.Combine(intermediate, "unused", "..")), 38new XElement("ArtifactsShippingPackagesDir", Path.Combine(root, "artifacts", "packages") + Path.DirectorySeparatorChar)), 39new XElement("Target", new XAttribute("Name", "RefreshTemplatePackageInputsForCgManifest")), 40new XElement("Target", new XAttribute("Name", "ReplacePackageVersionOnTemplates")), 45var copy = new XElement(target);
TemplateManifest\TemplateManifestTestEnvironment.cs (18)
50new XDocument(new XElement("configuration", 51new XElement("packageSources", 52new XElement("clear"), 53new XElement("add", new XAttribute("key", "external"), new XAttribute("value", ExternalFeed))), 54new XElement("packageSourceMapping", 55new XElement("clear"), 56new XElement("packageSource", new XAttribute("key", "external"), 57new XElement("package", new XAttribute("pattern", "*")))), 58new XElement("fallbackPackageFolders", new XElement("clear")))).Save(ConfigPath); 118new XDocument(new XElement("package", 119new XElement("metadata", 120new XElement("id", name), 121new XElement("version", version), 122new XElement("authors", "Test"), 123new XElement("description", "Hermetic template manifest fixture"), 125new XElement("dependencies", dependencies.Select(dependency => 126new XElement("dependency", new XAttribute("id", dependency.Name),
Microsoft.AspNetCore.DataProtection (45)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (3)
43var encryptionElement = new XElement("encryption", 48: (object)new XElement("validation", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (2)
38var masterKeyElement = new XElement("masterKey", 40new XElement("value", unprotectedSecretAsBase64String));
KeyManagement\XmlKeyManager.cs (12)
387var revocationElement = new XElement(RevocationElementName, 389new XElement(RevocationDateElementName, revocationDate), 391new XElement(KeyElementName, 393new XElement(ReasonElementName, reason)); 524var keyElement = new XElement(KeyElementName, 527new XElement(CreationDateElementName, creationDate), 528new XElement(ActivationDateElementName, activationDate), 529new XElement(ExpirationDateElementName, expirationDate), 632var revocationElement = new XElement(RevocationElementName, 634new XElement(RevocationDateElementName, revocationDate), 635new XElement(KeyElementName, 637new XElement(ReasonElementName, reason));
Repositories\EphemeralXmlRepository.cs (3)
41yield return new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 70deletableElements.Add(new DeletableElement(storedElement, new XElement(storedElement)));
XmlEncryption\CertificateXmlEncryptor.cs (1)
89xmlDocument.Load(new XElement("root", plaintextElement).CreateReader());
XmlEncryption\DpapiNGXmlEncryptor.cs (2)
85var element = new XElement("encryptedKey", 88new XElement("value",
XmlEncryption\DpapiXmlEncryptor.cs (2)
82var element = new XElement("encryptedKey", 84new XElement("value",
XmlEncryption\EncryptedXmlDecryptor.cs (1)
69xmlDocument.Load(new XElement("root", encryptedElement).CreateReader());
XmlEncryption\NullXmlDecryptor.cs (1)
31return new XElement(encryptedElement.Elements().Single());
XmlEncryption\NullXmlEncryptor.cs (2)
56var newElement = new XElement("unencryptedKey", 58new XElement(plaintextElement) /* copy ctor */);
XmlEncryption\XmlEncryptionExtensions.cs (7)
29var doc = new XDocument(new XElement(element)); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 56var newPlaceholder = new XElement("placeholder"); 111var doc = new XDocument(new XElement(element)); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 150new XElement(XmlConstants.EncryptedSecretElementName,
XmlExtensions.cs (1)
21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.OpenApi.SourceGenerators (2)
XmlComments\XmlComment.InheritDoc.cs (2)
247var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 385XContainer temp = new XElement("temp");
Microsoft.AspNetCore.Rewrite (1)
IISUrlRewrite\UrlRewriteFileParser.cs (1)
28throw new InvalidUrlRewriteFormatException(new XElement(RewriteTags.Rewrite), "The root element '<rewrite>' is missing");
Microsoft.AspNetCore.Server.IntegrationTesting (2)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (2)
169environmentVariablesSection = new XElement("environmentVariables"); 175var environmentVariable = new XElement("environmentVariable");
Microsoft.Build.Tasks.Core (14)
AssemblyDependency\GenerateBindingRedirects.cs (6)
84runtimeNode = new XElement("runtime"); 95select new XElement( 97new XElement( 99new XElement( 104new XElement( 340new XElement("configuration"));
AssemblyDependency\ResolveAssemblyReference.cs (4)
1409var node = new XElement( 1411new XElement( 1413new XElement( 1416new XElement(
CombineTargetFrameworkInfoProperties.cs (3)
50new("TargetFramework", new XAttribute("Name", EscapingUtilities.Escape(RootElementName))) : 51new(RootElementName); 55root.Add(new XElement(item.ItemSpec, item.GetMetadata("Value")));
CombineXmlElements.cs (1)
37XElement root = new XElement(RootElementName);
Microsoft.CodeAnalysis (1)
InternalUtilities\XmlUtilities.cs (1)
28XContainer temp = new XElement("temp");
Microsoft.CodeAnalysis.Analyzers (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.AnalyzerUtilities (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.CodeStyle (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.ResxSourceGenerator (18)
AbstractResxGenerator.cs (1)
798var escapedTrimmedValue = new XElement("summary", value).ToString();
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.CodeAnalysis.Workspaces (43)
Log\WorkspaceStructureLogger.cs (24)
40var workspaceElement = new XElement("workspace"); 71var workspaceAnalyzerReferencesElement = new XElement("workspaceAnalyzerReferences"); 80projectElement.Add(new XElement("workspaceDocuments", await CreateElementsForDocumentCollectionAsync(project.Documents, "document", cancellationToken).ConfigureAwait(false))); 81projectElement.Add(new XElement("workspaceAdditionalDocuments", await CreateElementsForDocumentCollectionAsync(project.AdditionalDocuments, "additionalDocuments", cancellationToken).ConfigureAwait(false))); 82projectElement.Add(new XElement("workspaceAnalyzerConfigDocuments", await CreateElementsForDocumentCollectionAsync(project.AnalyzerConfigDocuments, "analyzerConfigDocument", cancellationToken).ConfigureAwait(false))); 86projectElement.Add(new XElement("workspaceSourceGeneratedDocuments", CreateElementsForSourceGeneratedDocuments(sourceGeneratedDocuments))); 89var generatorDiagnosticsElement = new XElement("generatorDiagnostics"); 114var projectElement = new XElement("project"); 137var msbuildReferencesElement = new XElement("msbuildReferences"); 148var workspaceReferencesElement = new XElement("workspaceReferences"); 155var referenceElement = new XElement("projectReference", new XAttribute("id", SanitizePath(projectReference.ProjectId.ToString()))); 172var compilationReferencesElement = new XElement("compilationReferences"); 180var diagnosticsElement = new XElement("diagnostics"); 190=> new("diagnostic", 203var element = new XElement("sourceGeneratedDocument", 246return new XElement("compilationReference", 252return new XElement("peReference", 259return new XElement("metadataReference", new XAttribute("display", SanitizePath(reference.Display))); 264=> new("analyzerReference", 274var typesElement = new XElement("types"); 283typesElement.Add(new XElement("type", new XAttribute("name", type.ToDisplayString()))); 289return new XElement("compilation", 301var documentElement = new XElement(elementName, new XAttribute("path", SanitizePath(document.FilePath))); 310documentElement.Add(new XElement("loadDiagnostic", loadDiagnostic));
Shared\Extensions\ISymbolExtensions.cs (2)
439var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 574XContainer temp = new XElement("temp");
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Microsoft.DotNet.Arcade.Sdk (1)
src\GenerateResxSource.cs (1)
431string escapedTrimmedValue = new XElement("summary", value).ToString();
Microsoft.DotNet.Build.Manifest (5)
BlobArtifactModel.cs (1)
17public override XElement ToXml() => new XElement(
BuildIdentity.cs (1)
259public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes());
BuildModel.cs (1)
26public XElement ToXml() => new XElement(
PackageArtifactModel.cs (1)
60public override XElement ToXml() => new XElement(
PdbArtifactModel.cs (1)
29public override XElement ToXml() => new XElement(
Microsoft.DotNet.Build.Tasks.Installers (10)
src\GenerateMacOSDistributionFile.cs (10)
44var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 65var scriptElement = new XElement("script", new XCData(archScriptContent)); 68.Select(component => new XElement("choice", 73new XElement("pkg-ref", new XAttribute("id", component.GetMetadata("FileNameWithExtension"))))); 80choiceElements.Select(c => new XElement(c) 83choiceElements.Select(c => new XElement(c) 90.Select(c => new XElement("line", new XAttribute("choice", c.Attribute("id").Value))); 93.Select(component => new XElement("pkg-ref", 101optionsElement = new XElement("options"); 119document.Root.Add(new XElement("choices-outline", choiceLineElements));
Microsoft.DotNet.Build.Tasks.Workloads (9)
Msi\WixDocument.cs (5)
105Package.Add(new XElement(s_wixNamespace + "Property", 114Package.Add(new XElement(s_wixNamespace + "PropertyRef", 122Package.Add(new XElement(s_wixNamespace + "CustomActionRef", 140new XElement(s_wixNamespace + "Directory", 151new XElement(s_wixNamespace + "RegistryKey",
Msi\WixXmlExtensions.cs (4)
53var registryValue = new XElement(s_wixNamespace + "RegistryValue", 87var registryKey = new XElement(s_wixNamespace + "RegistryKey", 115var componentGroupRef = new XElement(s_wixNamespace + "ComponentGroupRef", 135var directory = new XElement(s_wixNamespace + "Directory",
Microsoft.DotNet.HotReload.Watch (2)
HotReload\HotReloadDotNetWatcher.cs (2)
1147var solutionElement = new XElement("Solution"); 1151solutionElement.Add(new XElement("Project", new XAttribute("Path", projectPath)));
Microsoft.DotNet.PackageTesting (9)
VerifyClosure.cs (9)
350var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 351var nodesElement = new XElement(s_dgmlns + "Nodes"); 352var linksElement = new XElement(s_dgmlns + "Links"); 364linksElement.Add(new XElement(s_dgmlns + "Link", 373linksElement.Add(new XElement(s_dgmlns + "Link", 381var categoriesElement = new XElement(s_dgmlns + "Categories"); 384categoriesElement.Add(new XElement(s_dgmlns + "Category", 389categoriesElement.Add(new XElement(s_dgmlns + "Category", 404parent.Add(new XElement(s_dgmlns + "Node",
Microsoft.DotNet.SharedFramework.Sdk (11)
parent\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (9)
350var doc = new XDocument(new XElement(s_dgmlns + "DirectedGraph")); 351var nodesElement = new XElement(s_dgmlns + "Nodes"); 352var linksElement = new XElement(s_dgmlns + "Links"); 364linksElement.Add(new XElement(s_dgmlns + "Link", 373linksElement.Add(new XElement(s_dgmlns + "Link", 381var categoriesElement = new XElement(s_dgmlns + "Categories"); 384categoriesElement.Add(new XElement(s_dgmlns + "Category", 389categoriesElement.Add(new XElement(s_dgmlns + "Category", 404parent.Add(new XElement(s_dgmlns + "Node",
src\CreateFrameworkListFile.cs (2)
71var frameworkManifest = new XElement("FileList", rootAttributes); 167var element = new XElement(
Microsoft.DotNet.SourceBuild.Tasks (12)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (1)
30public XElement ToXml() => new XElement(
src\UsageReport\UsageData.cs (7)
18public XElement ToXml() => new XElement( 20CreatedByRid == null ? null : new XElement( 23ProjectDirectories?.Any() != true ? null : new XElement( 26.Select(dir => new XElement("Dir", dir))), 27NeverRestoredTarballPrebuilts?.Any() != true ? null : new XElement( 32IgnorePatterns?.Any() != true ? null : new XElement( 36Usages?.Any() != true ? null : new XElement(
src\UsageReport\UsagePattern.cs (1)
15public XElement ToXml() => new XElement(
src\UsageReport\WriteUsageReports.cs (1)
119var report = new XElement("AnnotatedUsages");
src\UsageReport\XmlParsingHelpers.cs (1)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement(
Microsoft.DotNet.XliffTasks (10)
Model\XElementExtensions.cs (3)
35targetElement = new XElement(Target, new XAttribute("state", "new")); 69targetElement = new XElement(Target); 122noteElement = new XElement(Note);
Model\XlfDocument.cs (7)
50new XElement(Xliff, 55new XElement(File, 60new XElement(Body)))); 189new(TransUnit, 191new XElement(Source, sourceNode.Source), 192new XElement(Target, new XAttribute("state", "new"), sourceNode.Source), 193new XElement(Note, sourceNode.Note == "" ? null : sourceNode.Note));
Microsoft.Extensions.AI.Evaluation.Safety (3)
ContentSafetyServicePayloadUtilities.cs (3)
112item.Add(new XElement(questionElementName, question.Text)); 117item.Add(new XElement(answerElementName, answer.Text)); 122item.Add(new XElement(contextElementName, normalizedPerTurnContext[index]));
Microsoft.Extensions.FileProviders.Embedded.Manifest.Task (6)
Manifest.cs (6)
46var root = new XElement(ElementNames.Root, 47new XElement(ElementNames.ManifestVersion, "1.0"), 48new XElement(ElementNames.FileSystem, 60return new XElement(ElementNames.File, 62new XElement(ElementNames.ResourcePath, entry.AssemblyResourceName)); 66var directory = new XElement(ElementNames.Directory, new XAttribute(ElementNames.Name, entry.Name));
Microsoft.Maui.Resizetizer (13)
GeneratePackageAppxManifest.cs (10)
84 identity = new XElement(xidentity); 128 properties = new XElement(xproperties); 174 applications = new XElement(xapplications); 183 application = new XElement(xapplication); 192 visual = new XElement(xvisual); 255 tile = new XElement(xtile); 312 showname = new XElement(xshowname); 320 showname.Add(new XElement(xshowon, new XAttribute("Tile", "square150x150Logo"))); 322 showname.Add(new XElement(xshowon, new XAttribute("Tile", "wide310x150Logo"))); 331 splash = new XElement(xsplash);
GenerateTizenManifest.cs (3)
125 label = new XElement(xmlns + LabelName); 165 splashscreensElement = new XElement(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName);
Microsoft.ML.Maml (3)
HelpCommand.cs (3)
466select new XElement("Component", 481select new XElement("Argument", 509return new XElement("DefaultValue", a.DefaultValue);
Microsoft.NET.Build.Tasks (9)
GenerateToolsSettingsFile.cs (5)
68XElement commandNode = new XElement("Command", 75runtimeIdentifierPackagesNode = new XElement("RuntimeIdentifierPackages"); 80var packageNode = new XElement("RuntimeIdentifierPackage"); 97var dotnetCliToolNode = new XElement("DotNetCliTool", 99new XElement("Commands", commandNode));
WriteAppConfigWithSupportedRuntime.cs (4)
77startupNode = new XElement("startup"); 128new XElement( 138new XElement( 160new XElement("configuration"));
Microsoft.NET.HostModel (5)
ComHost\RegFreeComManifest.cs (5)
30XElement manifest = new XElement(ns + "assembly", new XAttribute("manifestVersion", "1.0")); 31manifest.Add(new XElement(ns + "assemblyIdentity", 56XElement fileElement = new XElement(ns + "file", new XAttribute("name", comHostName)); 67XElement comClassElement = new XElement(ns + "comClass", new XAttribute("clsid", guid.ToString("B")), new XAttribute("threadingModel", "Both")); 90XElement typeLibElement = new XElement(ns + "typelib",
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (5)
BlazorWriteSatelliteAssemblyFile.cs (2)
28var root = new XElement("SatelliteAssembly"); 34root.Add(new XElement("Assembly",
CreateBlazorTrimmerRootDescriptorFile.cs (3)
41var roots = new XElement("linker"); 61roots.Add(new XElement("assembly", 63new XElement("type", attributes)));
Microsoft.NET.Sdk.Publish.Tasks (4)
Tasks\GenerateEnvTransform.cs (1)
77new XElement("environmentVariable", new XAttribute("name", envVariable.Key),
WebConfigTransform.cs (3)
72aspNetCoreElement = new XElement("add"); 202envVariableElement = new XElement("environmentVariable"); 215childElement = new XElement(childName);
Microsoft.NET.Sdk.StaticWebAssets.Tasks (55)
GeneratePackageAssetsTargetsFile.cs (6)
32var itemGroup = new XElement("ItemGroup"); 33var manifestItem = new XElement("StaticWebAssetPackageManifest", 35new XElement("SourceId", PackageId), 36new XElement("ContentRoot", $@"$(MSBuildThisFileDirectory)..\{normalizedPrefix}\"), 37new XElement("PackageRoot", @"$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..'))")); 42var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetEndpointsPropsFile.cs (7)
47var itemGroup = new XElement("ItemGroup"); 57itemGroup.Add(new XElement(nameof(StaticWebAssetEndpoint), 59new XElement(nameof(StaticWebAssetEndpoint.AssetFile), fullPathExpression), 60new XElement(nameof(StaticWebAssetEndpoint.Selectors), new XCData(StaticWebAssetEndpointSelector.ToMetadataValue(element.Selectors))), 61new XElement(nameof(StaticWebAssetEndpoint.EndpointProperties), new XCData(StaticWebAssetEndpointProperty.ToMetadataValue(element.EndpointProperties))), 62new XElement(nameof(StaticWebAssetEndpoint.ResponseHeaders), new XCData(StaticWebAssetEndpointResponseHeader.ToMetadataValue(element.ResponseHeaders))))); 66var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetsPropsFile.cs (21)
83var itemGroup = new XElement("ItemGroup"); 109itemGroup.Add(new XElement("StaticWebAsset", 111new XElement(SourceType, emittedSourceType), 112new XElement(SourceId, element.GetMetadata(SourceId)), 113new XElement(ContentRoot, @$"$(MSBuildThisFileDirectory)..\{Normalize(PackagePathPrefix)}\"), 114new XElement(BasePath, element.GetMetadata(BasePath)), 115new XElement(RelativePath, relativePath), 116new XElement(AssetKind, element.GetMetadata(AssetKind)), 117new XElement(AssetMode, element.GetMetadata(AssetMode)), 118new XElement(AssetRole, element.GetMetadata(AssetRole)), 119new XElement(RelatedAsset, element.GetMetadata(RelatedAsset)), 120new XElement(AssetTraitName, element.GetMetadata(AssetTraitName)), 121new XElement(AssetTraitValue, element.GetMetadata(AssetTraitValue)), 122new XElement(Fingerprint, element.GetMetadata(Fingerprint)), 123new XElement(Integrity, element.GetMetadata(Integrity)), 124new XElement(CopyToOutputDirectory, element.GetMetadata(CopyToOutputDirectory)), 125new XElement(CopyToPublishDirectory, element.GetMetadata(CopyToPublishDirectory)), 126new XElement(FileLength, element.GetMetadata(FileLength)), 127new XElement(LastWriteTime, element.GetMetadata(LastWriteTime)), 128new XElement(OriginalItemSpec, fullPathExpression))); 132var root = new XElement("Project", itemGroup);
Legacy\GenerateStaticWebAssetsPropsFile50.cs (17)
56var itemGroup = new XElement("ItemGroup"); 62itemGroup.Add(new XElement("StaticWebAsset", 64new XElement(SourceType, "Package"), 65new XElement(SourceId, element.GetMetadata(SourceId)), 66new XElement(ContentRoot, @$"$(MSBuildThisFileDirectory)..\{Normalize(PackagePathPrefix)}\"), 67new XElement(BasePath, element.GetMetadata(BasePath)), 68new XElement(RelativePath, element.GetMetadata(RelativePath)), 69new XElement(AssetKind, element.GetMetadata(AssetKind)), 70new XElement(AssetMode, element.GetMetadata(AssetMode)), 71new XElement(AssetRole, element.GetMetadata(AssetRole)), 72new XElement(RelatedAsset, element.GetMetadata(RelatedAsset)), 73new XElement(AssetTraitName, element.GetMetadata(AssetTraitName)), 74new XElement(AssetTraitValue, element.GetMetadata(AssetTraitValue)), 75new XElement(CopyToOutputDirectory, element.GetMetadata(CopyToOutputDirectory)), 76new XElement(CopyToPublishDirectory, element.GetMetadata(CopyToPublishDirectory)), 77new XElement(OriginalItemSpec, fullPathExpression))); 81var root = new XElement("Project", itemGroup);
Legacy\GenerateV1StaticWebAssetsManifest.cs (2)
38var root = new XElement( 123nodes.Add(new XElement("ContentRoot",
StaticWebAssetsGeneratePackagePropsFile.cs (2)
32var root = new XElement("Project"); 35root.Add(new XElement("Import", new XAttribute("Project", element)));
NuGet.Commands (19)
RestoreCommand\Utility\BuildAssetsUtils.cs (19)
134doc.Root.Add(new XElement(Namespace + "Target", 138new XElement(Namespace + "Warning", 213new XElement(Namespace + "PropertyGroup", 222new XElement(Namespace + "ItemGroup", 235new XElement(Namespace + "Project", 244return new XElement(Namespace + propertyName, 251return new XElement(Namespace + itemName, new XAttribute("Include", path)); 256return new XElement(Namespace + "Import", 263var entry = new XElement(Namespace + item.BuildAction.Value, 266new XElement(Namespace + "NuGetPackageId", packageId), 267new XElement(Namespace + "NuGetPackageVersion", packageVersion), 268new XElement(Namespace + "NuGetItemType", item.BuildAction), 269new XElement(Namespace + "Pack", false)); 283entry.Add(new XElement(Namespace + "CopyToOutputDirectory", "PreserveNewest")); 285entry.Add(new XElement(Namespace + "TargetPath", outputPath)); 291entry.Add(new XElement(Namespace + "DestinationSubDirectory", destinationSubDirectory + Path.DirectorySeparatorChar)); 296entry.Add(new XElement(Namespace + "Private", privateFlag.ToString(CultureInfo.CurrentCulture))); 306entry.Add(new XElement(Namespace + "Link", linkPath)); 331var itemGroup = new XElement(Namespace + group.RootName, group.Items);
NuGet.Configuration (10)
Settings\Items\AuthorItem.cs (1)
47var element = new XElement(ElementName);
Settings\Items\CredentialsItem.cs (1)
223var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName),
Settings\Items\FileClientCertItem.cs (1)
147var element = new XElement(ElementName);
Settings\Items\OwnersItem.cs (1)
76var element = new XElement(ElementName, _content.AsXNode());
Settings\Items\PackageSourceMappingSourceItem.cs (1)
132var element = new XElement(ElementName);
Settings\Items\RepositoryItem.cs (1)
111var element = new XElement(ElementName);
Settings\Items\StoreClientCertItem.cs (1)
222var element = new XElement(ElementName);
Settings\Items\UnknownItem.cs (1)
155var element = new XElement(ElementName, Children.Select(c => c.AsXNode()));
Settings\SettingElement.cs (1)
120var element = new XElement(ElementName);
Settings\SettingsGroup.cs (1)
62var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), Children.Select(c => c.AsXNode()));
NuGet.PackageManagement (3)
FileModifiers\XmlTransformer.cs (1)
135new XElement(xmlFragment.Name),
Utility\MSBuildNuGetProjectSystemUtility.cs (1)
36var document = new XDocument(new XElement(rootName));
Utility\XmlUtility.cs (1)
29var document = new XDocument(new XElement(rootName));
NuGet.Packaging (42)
PackageCreation\Authoring\Manifest.cs (3)
101new XElement(schemaNamespace + "package", 104new XElement(schemaNamespace + "files", 105Files.Select(file => new XElement(schemaNamespace + "file",
PackageCreation\Authoring\PackageBuilder.cs (15)
1163new XElement(relationships + "Relationships", 1164new XElement(relationships + "Relationship", 1168new XElement(relationships + "Relationship", 1188XElement element = new XElement(content + "Types", 1189new XElement(content + "Default", 1192new XElement(content + "Default", 1199new XElement(content + "Default", 1208new XElement(content + "Override", 1236new XElement(core + "coreProperties", 1240new XElement(dc + "creator", string.Join(", ", Authors)), 1241new XElement(dc + "description", Description), 1242new XElement(dc + "identifier", Id), 1243new XElement(core + "version", Version!.ToString()), 1245new XElement(core + "keywords", ((IPackageMetadata)this).Tags), 1247new XElement(core + "lastModifiedBy", CreatorInfo())
PackageCreation\Xml\PackageMetadataXmlExtensions.cs (21)
34var elem = new XElement(ns + "metadata"); 40elem.Add(new XElement(ns + "id", metadata.Id)); 50elem.Add(new XElement(ns + "developmentDependency", metadata.DevelopmentDependency)); 56elem.Add(new XElement(ns + "requireLicenseAcceptance", metadata.RequireLicenseAcceptance)); 85elem.Add(new XElement(ns + "serviceable", metadata.Serviceable)); 180var groupElem = new XElement( 197return new XElement(ns + parentName, childElements.ToArray()); 202return new XElement(ns + NuspecUtility.FrameworkReference, new XAttribute(NuspecUtility.Name, frameworkReference.Name)); 207return new XElement(ns + Reference, new XAttribute(File, reference)); 231return new XElement(ns + "dependency", attributes); 241return new XElement( 244new XElement(ns + FrameworkAssembly, 258return new XElement(ns + "contentFiles", 273return new XElement(ns + Files, attributes.Where(xAtt => xAtt != null)); 286return new XElement(ns + NuspecUtility.License, metadata.License, attributes.Where(xAtt => xAtt != null)); 314return new XElement(ns + NuspecUtility.Repository, attributeList); 321var packageTypesElement = new XElement(ns + NuspecUtility.PackageTypes); 342return new XElement(ns + NuspecUtility.PackageType, attributes.Where(xAtt => xAtt != null)); 360parent.Add(new XElement(ns + name, value)); 372parent.Add(new XElement(ns + name, processed)); 384parent.Add(new XElement(ns + name, processed));
PackagesConfigWriter.cs (3)
363var node = new XElement(XName.Get(PackagesConfig.PackageNodeName)); 402var packagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName)); 495var newPackagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName),
PresentationFramework-SystemXmlLinq (1)
SystemXmlLinqExtension.cs (1)
20XElement xelement = new XElement("Dummy");
Roslyn.Diagnostics.Analyzers (17)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (1)
108=> new(XmlElement_CodeStyleOption, // Ensure that we use "CodeStyleOption" as the name for back compat.
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (1)
465=> new(nameof(NamingStyle),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (5)
343return new XElement("NamingPreferencesInfo", 345new XElement("SymbolSpecifications", SymbolSpecifications.Select(s => s.CreateXElement())), 346new XElement("NamingStyles", NamingStyles.Select(n => n.CreateXElement())), 347new XElement("NamingRules", SerializableNamingRules.Select(n => n.CreateXElement()))); 403UpgradeSerialization_4To5(rootElement = new XElement(rootElement));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (1)
26var element = new XElement(nameof(SerializableNamingRule),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (9)
214return new XElement(nameof(SymbolSpecification), 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 259accessibilitiesElement.Add(new XElement("AccessibilityKind", accessibility)); 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 370SymbolCategory.Other => new XElement(nameof(SymbolKind), (SymbolKind)_kind), 371SymbolCategory.Type => new XElement(nameof(TypeKind), GetTypeKindString((TypeKind)_kind)), 372SymbolCategory.Method => new XElement(nameof(MethodKind), GetMethodKindString((MethodKind)_kind)), 533=> new(nameof(ModifierKind), ModifierKindWrapper);
Stress.ApiService (2)
Program.cs (2)
398var xmlWithUrl = new XElement(new XElement("url", "http://localhost:8080")).ToString();
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
373o = new System.Xml.Linq.XElement("default");
System.Private.Xml.Linq (14)
System\Xml\Linq\XContainer.cs (6)
164AddNode(new XElement(x)); 491AddNodeSkipNotify(new XElement(x)); 979XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1038XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1107XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1229XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName));
System\Xml\Linq\XElement.cs (5)
164XElement xe = new XElement(default(AsyncConstructionSentry)); 812XElement e = new XElement(reader, options); 848XElement e = new XElement(default(AsyncConstructionSentry)); 1270AddNode(new XElement(name, GetStringValue(value))); 1955return new XElement(this);
System\Xml\Linq\XLinq.cs (1)
95AddNode(new XElement(x));
System\Xml\Linq\XNode.cs (1)
441return new XElement(reader);
System\Xml\Linq\XNodeBuilder.cs (1)
183AddNode(new XElement(XNamespace.Get(namespaceName!).GetName(localName)));
2231 references to XElement
aspire (94)
Packaging\NuGetConfigMerger.cs (56)
15public required XElement Configuration { get; init; } 16public required XElement PackageSources { get; init; } 17public XElement? PackageSourceMapping { get; init; } 20public required XElement[] ExistingAdds { get; init; } 181var configuration = doc.Root ?? new XElement("configuration"); 187var packageSources = configuration.Element("packageSources"); 210private static Dictionary<string, string> BuildExistingSourceMappings(XElement[] existingAdds) 213foreach (var addElement in existingAdds) 240var add = new XElement("add"); 249var packageSourceMapping = context.PackageSourceMapping!; 301foreach (var orphan in orphanedSources) 308XElement packageSourceMapping, 317foreach (var packageSourceElement in packageSourceElements) 326var elementsToRemove = new List<XElement>(); 328foreach (var packageElement in packageElements) 371foreach (var element in elementsToRemove) 387XElement packageSourceMapping, 403var targetSourceElement = packageSourceMapping.Elements("packageSource") 418var existingPattern = targetSourceElement.Elements("package") 424var packageElement = new XElement("package"); 435XElement packageSourceMapping, 441foreach (var packageSourceElement in packageSourceMapping.Elements("packageSource")) 443foreach (var packageElement in packageSourceElement.Elements("package")) 466var targetSourceElement = packageSourceMapping.Elements("packageSource") 481var existingPattern = targetSourceElement.Elements("package") 487var packageElement = new XElement("package"); 498XElement packageSourceMapping, 512foreach (var elementToFix in packageSourceElementsToFix) 518var existingProperElement = packageSourceMapping.Elements("packageSource") 525foreach (var packageToMove in packagesToMove) 529var existingPattern = existingProperElement.Elements("package") 556XElement packageSourceMapping, 588var sourceElement = context.ExistingAdds 602var packageSourceElement = new XElement("packageSource"); 605var wildcardPackage = new XElement("package"); 688XElement packageSourceMapping, 689XElement packageSources, 698foreach (var emptyElement in emptyPackageSourceElements) 715var sourceToRemove = packageSources.Elements("add") 727var packageSourceMapping = new XElement("packageSourceMapping"); 739var packageSource = new XElement("packageSource"); 744var packageElement = new XElement("package"); 755private static void PreserveOriginalSourceFunctionality(XElement packageSourceMapping, NuGetConfigContext context) 780var sourceElement = context.ExistingAdds 787var packageSourceElement = new XElement("packageSource"); 790var wildcardPackage = new XElement("package"); 840var packageSources = doc.Root?.Element("packageSources"); 854foreach (var addElement in existingAdds) 875var packageSourceMapping = doc.Root?.Element("packageSourceMapping"); 883foreach (var packageSourceElement in packageSourceElements) 892foreach (var packageElement in packageElements) 950var configuration = doc.Root ?? throw new InvalidOperationException("Invalid NuGet config structure"); 970internal static void AddGlobalPackagesFolderConfiguration(XElement configuration, string? globalPackagesFolderValue = null) 973var config = configuration.Element("config"); 981var existingGlobalPackagesFolder = config.Elements("add") 990var globalPackagesFolderAdd = new XElement("add");
Packaging\TemporaryNuGetConfig.cs (1)
136var configuration = document.Root ?? new XElement("configuration");
Projects\CSharpProjectFile.cs (9)
48public List<XElement> Targets { get; } = []; 191var root = new XElement("Project", new XAttribute("Sdk", Sdk)); 226internal static XElement CreatePackageReferenceElement(CSharpPackageReference packageReference) 228var element = new XElement("PackageReference", new XAttribute("Include", packageReference.Name)); 241internal static XElement CreateProjectReferenceElement(CSharpProjectReference projectReference) 243var element = new XElement("ProjectReference", new XAttribute("Include", projectReference.ProjectPath)); 252private static XElement CreateNoneElement(CSharpNoneItem noneItem) 254var element = new XElement("None", new XAttribute("Update", noneItem.Update)); 267internal static void AddBooleanElement(XElement element, string name, bool? value)
Projects\DotNetAppHostProject.cs (12)
194if (!TryLoadProjectRoot(projectFile.FullName, out var root) || root is null) 251private static bool TryLoadProjectRoot(string path, out XElement? root) 303if (!TryLoadProjectRoot(filePath, out var root) || root is null) 363private static DirectoryBuildChaining ClassifyDirectoryBuildChaining(XElement root, string chainFileName) 373foreach (var import in root.Descendants().Where(e => e.Name.LocalName.Equals("Import", StringComparison.Ordinal))) 707if (TryLoadProjectRoot(projectFile.FullName, out var projectRoot) && projectRoot is not null) 731if (!TryLoadProjectRoot(filePath, out var root) || root is null || ContainsAppHostMarker(root)) 753XElement root, 759foreach (var import in root.Descendants().Where(e => e.Name.LocalName.Equals("Import", StringComparison.Ordinal))) 971private static bool ContainsDynamicWalkUpImport(XElement root) 996foreach (var import in root.Descendants().Where(e => e.Name.LocalName.Equals("Import", StringComparison.Ordinal))) 1247private static bool ContainsAppHostMarker(XElement root)
Projects\FallbackProjectParser.cs (7)
130var root = doc.Root; 226private static string? ExtractAspireHostingSdkVersion(XElement projectRoot) 241var sdkElement = projectRoot 279private static PackageReferenceInfo[] ExtractPackageReferences(XElement projectRoot) 288foreach (var element in packageRefElements) 312private static ProjectReferenceInfo[] ExtractProjectReferences(XElement projectRoot, FileInfo projectFile) 321foreach (var element in projectRefElements)
Projects\IntegrationClosureBuilder.cs (1)
123var propertyGroup = new XElement("PropertyGroup",
Projects\JavaAppHostToolchainResolver.cs (1)
610foreach (var module in modules)
Projects\PrebuiltAppHostServer.cs (1)
537foreach (var element in document.Descendants().Where(static e => e.Name.LocalName == "ProjectReference"))
Projects\ProjectUpdater.cs (6)
544private static IEnumerable<XElement> GetSdkDeclarations(XDocument document) 552private static bool IsUnconditionalSdkDeclaration(XElement element) 555private static IEnumerable<XElement> GetUnconditionalSdkDeclarations(XDocument document) 561foreach (var element in GetUnconditionalSdkDeclarations(document)) 1427var reference = references[0]; 1428var versionElement = reference.Elements().FirstOrDefault(element => element.Name.LocalName == "Version");
Aspire.Cli.EndToEnd.Tests (5)
CentralPackageManagementTests.cs (1)
320static IEnumerable<XElement> FindRedisProperties(XDocument document, string propertyName)
EntityFrameworkCoreDeploymentTests.cs (3)
254var targetFrameworkProperty = apiProject 259var propertyGroup = targetFrameworkProperty.Parent; 262var runtimeIdentifiersProperty = propertyGroup
Helpers\KubernetesDeployTestHelpers.cs (1)
372var references = new System.Xml.Linq.XElement("ItemGroup");
Aspire.Cli.Tests (54)
AssemblyMetadataChannelTests.cs (1)
46var defaultElement = doc.Descendants()
Commands\InitCommandTests.cs (4)
2342var root = XDocument.Load(nugetConfigPath).Root ?? throw new InvalidOperationException("Empty NuGet.config."); 2344var packageSources = root.Element("packageSources"); 2349var packageSourceMapping = root.Element("packageSourceMapping"); 2351var aspirePatternSource = packageSourceMapping!.Elements("packageSource")
Commands\NewCommandTests.cs (2)
728var packageSources = doc.Root!.Element("packageSources")!; 739var packageSourceMapping = doc.Root!.Element("packageSourceMapping");
Packaging\NuGetConfigMergerTests.cs (33)
74var packageSources = xml.Root!.Element("packageSources")!; 78var psm = xml.Root!.Element("packageSourceMapping"); 115var packageSources = xml.Root!.Element("packageSources")!; 119var psm = xml.Root!.Element("packageSourceMapping")!; 154var packageSources = xml.Root!.Element("packageSources")!; 160var psm = xml.Root!.Element("packageSourceMapping")!; 198var packageSources = xml.Root!.Element("packageSources")!; 202var packageSourceMapping = xml.Root!.Element("packageSourceMapping")!; 205var stableMapping = Assert.Single(packageSourceMapping.Elements("packageSource")); 238var psm = xml.Root!.Element("packageSourceMapping"); 348var packageSources = xml.Root!.Element("packageSources")!; 358var psm = xml.Root!.Element("packageSourceMapping")!; 359var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget"); 364var urlMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://api.nuget.org/v3/index.json"); 398var packageSources = xml.Root!.Element("packageSources")!; 414var psm = xml.Root!.Element("packageSourceMapping")!; 417var aspireMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://example.com/aspire-daily"); 422var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget.org"); 426var customMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "custom"); 467var packageSources = xml.Root!.Element("packageSources")!; 480var psm = xml.Root!.Element("packageSourceMapping")!; 483var nugetMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "nuget.org"); 488var aspireMapping = psm.Elements("packageSource").FirstOrDefault(ps => (string?)ps.Attribute("key") == "https://example.com/aspire-daily"); 531var psm = xml.Root!.Element("packageSourceMapping")!; 534var nugetMapping = psm.Elements("packageSource") 540var githubMapping = psm.Elements("packageSource") 587var packageSources = xml.Root!.Element("packageSources")!; 601var psm = xml.Root!.Element("packageSourceMapping")!; 608var validExampleMapping = psm.Elements("packageSource") 615var nugetMapping = psm.Elements("packageSource") 669var packageSources = xml.Root!.Element("packageSources")!; 676var psm = xml.Root!.Element("packageSourceMapping")!; 719var packageSources = xml.Root!.Element("packageSources")!;
Packaging\PackagingServiceTests.cs (2)
1130var configSection = doc.Root?.Element("config"); 1133var globalPackagesFolderAdd = configSection.Elements("add")
Projects\AppHostServerProjectTests.cs (4)
263var noneElement = doc.Descendants("None") 282var skipAnalyzersElement = doc.Descendants("SkipAspireIntegrationAnalyzersReference").SingleOrDefault(); 304var packageReference = Assert.Single( 332var projectReference = Assert.Single(
Projects\PrebuiltAppHostServerTests.cs (6)
567var target = doc.Descendants("Target") 641var restoreSources = doc.Descendants(ns + "RestoreAdditionalProjectSources").FirstOrDefault(); 653var restoreSources = doc.Descendants(ns + "RestoreAdditionalProjectSources").FirstOrDefault(); 915var gpf = doc.Descendants("config") 974var gpf = doc.Descendants("config") 1095var gpf = doc.Descendants("config")
Projects\ProjectUpdaterTests.cs (1)
260var reference = props.Descendants("PackageReference").Single();
Templating\TemplateNuGetConfigServiceTests.cs (1)
1078var packageSourceMapping = doc.Root!.Element("packageSourceMapping");
Aspire.Dashboard (2)
Model\ResourceGraph\ResourceGraphMapper.cs (2)
97var iconContent = XElement.Parse($"<svg>{icon.Content}</svg>");
Aspire.Dashboard.Tests (3)
Model\ResourceGraphMapperTests.cs (3)
183var expectedPathData = XElement.Parse(icon.Content).Attribute("d")!.Value; 194var iconContent = XElement.Parse($"<svg>{icon.Content}</svg>");
Aspire.Hosting.Azure.Provisioning.Generators (10)
AspireProvisioningProxyGenerator.cs (10)
2094XElement root; 2097root = XElement.Parse("<root>" + xml + "</root>"); 2132var parameterElement = root.Elements("param").FirstOrDefault(element => 2195XElement? element, 2206var rewritten = RewriteDocumentationElement(element, parameterNames, replacementName); 2216private static XElement RewriteDocumentationElement( 2217XElement element, 2221var rewritten = new XElement( 2233XElement element => RewriteDocumentationElement(element, parameterNames, replacementName: null), 2241XElement element,
Aspire.Hosting.Dotnet (3)
DotnetProjectBuildResource.cs (3)
285private static XElement CreateRestoreTarget(bool restoreProjectsIndividually) 287var target = CreateTraversalTarget("Restore", buildInParallel: false); 317private static XElement CreateTraversalTarget(string name, bool buildInParallel) =>
Aspire.Hosting.Java (10)
JavaVersionDetector.cs (10)
149IEnumerable<XElement>[] candidateGroups = 158foreach (var element in candidateElements.Where(e => string.Equals(e.Name.LocalName, name, StringComparison.Ordinal))) 179private static IEnumerable<XElement> GetProfiles(XDocument document) => 189private static string? GetProfileId(XElement profile) => 276private static bool IsActiveByDefaultProfile(XElement profile) 278var activation = profile.Elements().FirstOrDefault(e => 287private static bool IsInProfile(XElement element) => element.Ancestors().Any(IsProfile); 289private static bool IsProfile(XElement element) => 315private static bool IsCompilerPluginConfiguration(XElement? configuration) 322for (var ancestor = configuration!.Parent; ancestor is not null; ancestor = ancestor.Parent)
Aspire.Hosting.Maui (5)
Utilities\MauiEnvironmentHelper.cs (5)
76var projectElement = new XElement("Project"); 86var itemGroup = new XElement("ItemGroup"); 95var targetElement = new XElement( 217var projectElement = new XElement("Project"); 228var itemGroup = new XElement("ItemGroup");
Aspire.Hosting.Maui.Tests (3)
MauiEnvironmentHelperTests.cs (3)
63var target = doc.Descendants("Target") 80var writeLines = doc.Descendants("WriteLinesToFile").FirstOrDefault(); 156var target = doc.Descendants("Target")
Aspire.Hosting.RemoteHost (15)
AtsCapabilityScanner.cs (15)
3526var memberElement = FindXmlDocumentationMember(xmlDoc, memberName); 3548var memberElement = FindXmlDocumentationMember(xmlDoc, memberName); 3558private static XElement? FindXmlDocumentationMember(XDocument? xmlDoc, string memberName) 3569private static AtsDocumentationInfo? CreateDocumentation(XElement? memberElement, string? fallbackSummary) 3619private static XElement? GetDocumentationElement(XElement memberElement, string tagName, out bool hasAtsOverride) 3621var atsElement = memberElement.Element($"ats-{tagName}"); 3626private static List<AtsParameterDocumentationInfo> CreateParameterDocumentation(IEnumerable<XElement> parameters) 3657private static string? FormatXmlDocumentationElement(XElement? element, bool preserveLineBreaks = false) 3679case XElement element: 3686private static void AppendXmlDocumentationElement(StringBuilder builder, XElement element) 3738private static void AppendAtsReferenceDocumentationElement(StringBuilder builder, XElement element) 3822private static void AppendSeeDocumentationElement(StringBuilder builder, XElement element) 3845private static void AppendListDocumentationElement(StringBuilder builder, XElement element) 3847foreach (var item in element.Elements("item"))
Aspire.Hosting.Tasks (4)
GetNonExecutableReferences.cs (4)
42var additionalPropertiesXml = XElement.Parse(additionalProperties); 43foreach (var targetFrameworkElement in additionalPropertiesXml.Elements()) 45var isExe = targetFrameworkElement.Element("_IsExecutable");
Aspire.Templates.Tests (2)
BuildAndRunTemplateTests.cs (2)
97var versions = new List<XElement>(); 98foreach (var reference in document.Descendants("PackageReference"))
ConfigurationSchemaGenerator (6)
ConfigSchemaEmitter.cs (6)
363return XElement.Parse(xml).ToString(SaveOptions.None); 437var memberRoot = doc.Element("member") ?? doc.Element("doc"); 438var summary = memberRoot?.Element("summary"); 469internal static string FormatDescription(XElement element) 508XElement element => GetElementText(element), 539private static string GetElementText(XElement element)
ConfigurationSchemaGenerator.Tests (8)
GeneratorTests.cs (8)
80var summaryElement = ConvertToSummaryElement(input); 97var summaryElement = ConvertToSummaryElement(input); 111var summaryElement = ConvertToSummaryElement(input); 129var summaryElement = ConvertToSummaryElement(input); 140var summaryElement = ConvertToSummaryElement(input); 151var summaryElement = ConvertToSummaryElement(input); 157private static XElement ConvertToSummaryElement(string input) 163return (XElement)XNode.ReadFrom(reader);
dotnet-svcutil-lib (47)
Shared\MSBuildProj.cs (45)
71private XElement ProjectNode { get; set; } 73private XElement _projectReferenceGroup; 74private XElement ProjectReferceGroup 80IEnumerable<XElement> refItems = this.ProjectNode.Elements("ProjectReference"); 96private XElement _referenceGroup; 97private XElement ReferenceGroup 103IEnumerable<XElement> refItems = this.ProjectNode.Elements("Reference"); 120private XElement _packageReferenceGroup; 121private XElement PacakgeReferenceGroup 127IEnumerable<XElement> refItems = this.ProjectNode.Elements("PackageReference"); 189IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFramework"); 211IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "TargetFrameworks"); 245IEnumerable<XElement> runtimeIdentifierElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "PropertyGroup", "RuntimeIdentifier"); 251IEnumerable<XElement> packageReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "PackageReference"); 252foreach (XElement reference in packageReferenceElements) 268IEnumerable<XElement> toolReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "DotNetCliToolReference"); 269foreach (XElement reference in toolReferenceElements) 281IEnumerable<XElement> projectReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "ProjectReference"); 282foreach (XElement reference in projectReferenceElements) 291IEnumerable<XElement> binReferenceElements = GetSubGroupValues(msbuildProj.ProjectNode, msbuildNS, "ItemGroup", "Reference"); 292foreach (XElement reference in binReferenceElements) 302XElement hintPath = reference.Element("HintPath"); 303XElement path = reference.Element("Path"); 429var ele = doc.Root?.Descendants(elementStr).FirstOrDefault(); 442private static IEnumerable<XElement> GetGroupValues(XElement projectElement, string group, bool createOnMissing = false) 445IEnumerable<XElement> groups = projectElement.Elements(group); 450XElement propertyGroup = new XElement(group); 452return new XElement[] { propertyGroup }; 459private static IEnumerable<XElement> GetSubGroupValues(XElement projectElement, XNamespace msbuildNS, string group, string subGroupName) 461IEnumerable<XElement> groups = GetGroupValues(projectElement, group); 462IEnumerable<XElement> subGroupValues = groups.Elements(msbuildNS + subGroupName); 466private static string GetItemValue(XElement reference, string itemName, bool throwIfMissing = false) 475XElement itemNameElement = null; 489public static bool TryGetItemIdentity(XElement itemName, out string itemIdentity) 503private static string GetItemIdentity(XElement itemName) 598XElement element = new XElement(propertyName, null); 600IEnumerable<XElement> existingElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", propertyName); 607IEnumerable<XElement> propertyGroupItems = GetGroupValues(this.ProjectNode, "PropertyGroup", createOnMissing: true); 608XElement propertyGroup = propertyGroupItems.First(); 662IEnumerable<XElement> targetFrameworkElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFramework"); 665var targetFrameworkNode = targetFrameworkElements.Last(); 670IEnumerable<XElement> targetFrameworksElements = GetSubGroupValues(this.ProjectNode, _msbuildNS, "PropertyGroup", "TargetFrameworks"); 673var targetFrameworksNode = targetFrameworksElements.Last();
Shared\Utilities\RuntimeEnvironmentHelper.cs (2)
82var pkgSourcesNode = doc.Element("configuration")?.Element("packageSources"); 100var addElement = new XElement("add");
dotnet-user-jwts (4)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
dotnet-user-secrets (4)
src\aspnetcore\src\Tools\Shared\SecretsHelpers\UserSecretsCreator.cs (4)
31var existingUserSecretsId = projectDocument.XPathSelectElements("//UserSecretsId").FirstOrDefault(); 48var propertyGroup = projectDocument.Root.DescendantNodes() 49.FirstOrDefault(node => node is XElement el 52attr.Name != "Condition")) as XElement;
GenerateDocumentationAndConfigFiles (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
GenerateTemplateManifest (16)
ComponentManifest.cs (1)
116var metadata = document.Root.Element(ns + "metadata")!;
Program.cs (3)
127var configuration = config.Root ?? throw new InvalidDataException($"Invalid NuGet config: {nugetConfigPath}"); 128var sources = configuration.Element("packageSources") 130var mappings = configuration.Element("packageSourceMapping")
TemplateRestorePlan.cs (12)
135var documents = new Dictionary<string, XElement>(StringComparer.OrdinalIgnoreCase); 147var project = new XElement("Project", new XAttribute("Sdk", "Microsoft.NET.Sdk"), 195var project = Normalize(documents[path]); 196foreach (var reference in project.Descendants("ProjectReference")) 235internal static XElement Normalize(XElement source) 237var project = new XElement(source); 249foreach (var group in project.Elements("ItemGroup")) 253foreach (var group in project.Elements().Where(g => g.Name.LocalName is "PropertyGroup" or "ItemGroup").ToArray()) 292var root = new XElement(project.Project); 312internal sealed class RestoreProject(string name, XElement project) 315internal XElement Project { get; } = project;
ilc (10)
RdXmlRootProvider.cs (10)
22private XElement _documentRoot; 28_documentRoot = XElement.Load(rdXmlFileName); 33var libraryOrApplication = _documentRoot.Elements().Single(); 41foreach (var element in libraryOrApplication.Elements()) 55private void ProcessAssemblyDirective(IRootingServiceProvider rootProvider, XElement assemblyElement) 77foreach (var element in assemblyElement.Elements()) 90private static void ProcessTypeDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, XElement typeElement) 126foreach (var element in typeElement.Elements()) 139private static void ProcessMethodDirective(IRootingServiceProvider rootProvider, ModuleDesc containingModule, TypeDesc containingType, XElement methodElement) 147foreach (var element in methodElement.Elements())
illink (2)
ILLink.Tasks (2)
CombineLinkerXmlFiles.cs (2)
30var combined = new XElement("linker"); 35foreach (var element in subFile.Root.Elements())
Infrastructure.Tests (36)
Hex1bNativePublishingTests.cs (4)
356var helperCertificate = Assert.Single(signingProps.Descendants("FileSignInfo"), 400var nativeItems = new XElement("ItemGroup"); 416var unrelatedItem = new XElement("ResolvedFileToPublish", 421var publishItems = new XElement("ItemGroup",
NuGetConfigTests.cs (7)
16var root = document.Root; 36var root = XDocument.Load(Path.Combine(RepoRoot.Path, "NuGet.config")).Root!; 37var auditSources = Assert.Single(root.Elements("auditSources")); 67var root = document.Root; 75var source = Assert.Single( 82var mapping = Assert.Single( 91var publicMapping = Assert.Single(
Pipelines\TrayBundleTests.cs (9)
127var build = Target(project, "Build"); 134var cliPublish = Target(project, "_PublishNativeCli"); 144var restore = Target(project, "RestoreSignedTray"); 155var input = Assert.Single(traySigning.Descendants("_TrayToSign")); 158var notarization = Assert.Single(traySigning.Descendants("_TrayToNotarize")); 162var signTray = Target(traySigning, "SignTray"); 224var verification = Target(project, "_VerifyNativeTrayArchive"); 354var verify = Target(bundle, "_VerifyWindowsTrayArchive"); 469private static XElement Target(XDocument project, string name)
ResourceGeneratorMetadataTests.cs (2)
75var settingsDesigner = project.Root!.Elements("ItemGroup").Elements("Compile") 80var linkedResource = project.Root!.Elements("ItemGroup").Elements("EmbeddedResource")
Shared\TestTrxBuilder.cs (3)
86private static XElement CreateTestDefinitionElement(TestTrxCase testCase, int index) 104private static XElement CreateResultElement(TestTrxCase testCase, int index) 123private static XElement? CreateErrorInfoElement(TestTrxCase testCase)
TemplateManifest\TemplateManifestBuildTargetTests.cs (1)
45var copy = new XElement(target);
TemplateManifest\TemplateManifestCacheTests.cs (1)
75foreach (var project in projects)
TemplateManifest\TemplateRestorePlanTests.cs (9)
124var project = XElement.Parse(""" 131var normalized = TemplateRestorePlan.Normalize(project); 146var source = XElement.Parse($""" 182var source = XElement.Parse(""" 222var source = XElement.Parse($"""
Microsoft.Arcade.Common (3)
NupkgInfoFactory.cs (3)
54XElement metadataElement = GetSingleElement(doc.Root, "metadata"); 58private static XElement GetSingleElement(XElement el, string name)
Microsoft.AspNetCore.DataProtection (168)
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptor.cs (2)
43var encryptionElement = new XElement("encryption", 51var outerElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\AuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 33var encryptionElement = element.Element("encryption")!; 39var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptor.cs (3)
46var encryptionElement = new XElement("encryption", 54var hashElement = new XElement("hash", 61var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngCbcAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 35var encryptionElement = element.Element("encryption")!; 40var hashElement = element.Element("hash")!;
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptor.cs (2)
45var encryptionElement = new XElement("encryption", 53var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\CngGcmAuthenticatedEncryptorDescriptorDeserializer.cs (3)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 22public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!;
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptor.cs (2)
18/// An <see cref="XmlSerializedDescriptorInfo"/> wrapping the <see cref="XElement"/> which represents the serialized 23/// element should be marked via the <see cref="XmlExtensions.MarkAsRequiresEncryption(XElement)" />
AuthenticatedEncryption\ConfigurationModel\IAuthenticatedEncryptorDescriptorDeserializer.cs (1)
19IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element);
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptor.cs (3)
45var encryptionElement = new XElement("encryption", 49var validationElement = new XElement("validation", 52var rootElement = new XElement("descriptor",
AuthenticatedEncryption\ConfigurationModel\ManagedAuthenticatedEncryptorDescriptorDeserializer.cs (4)
13/// A class that can deserialize an <see cref="XElement"/> that represents the serialized version 21public IAuthenticatedEncryptorDescriptor ImportFromXml(XElement element) 34var encryptionElement = element.Element("encryption")!; 38var validationElement = element.Element("validation")!;
AuthenticatedEncryption\ConfigurationModel\SecretExtensions.cs (3)
17/// <returns>The master key <see cref="XElement"/>.</returns> 18public static XElement ToMasterKeyElement(this ISecret secret) 38var masterKeyElement = new XElement("masterKey",
AuthenticatedEncryption\ConfigurationModel\XmlExtensions.cs (4)
11/// Data protection extensions for <see cref="XElement"/>. 15internal static bool IsMarkedAsRequiringEncryption(this XElement element) 21/// Marks the provided <see cref="XElement"/> as requiring encryption before being persisted 24public static void MarkAsRequiresEncryption(this XElement element)
AuthenticatedEncryption\ConfigurationModel\XmlSerializedDescriptorInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains the XML-serialized representation of an 21/// <param name="deserializerType">The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 23public XmlSerializedDescriptorInfo(XElement serializedDescriptorElement, Type deserializerType) 40/// The class whose <see cref="IAuthenticatedEncryptorDescriptorDeserializer.ImportFromXml(XElement)"/> 48public XElement SerializedDescriptorElement { get; }
Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\LoggerMessage.g.cs (9)
329private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __ExceptionWhileProcessingRevocationElementCallback = 330global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Error, new global::Microsoft.Extensions.Logging.EventId(21, "ExceptionWhileProcessingRevocationElement"), "An exception occurred while processing the revocation element '{RevocationElement}'. Cannot continue keyring processing.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 337public static partial void ExceptionWhileProcessingRevocationElement(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement revocationElement, global::System.Exception exception) 377private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __ExceptionWhileProcessingKeyElementCallback = 378global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Error, new global::Microsoft.Extensions.Logging.EventId(24, "ExceptionOccurredWhileProcessingTheKeyElement"), "An exception occurred while processing the key element '{Element}'.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 385public static partial void ExceptionWhileProcessingKeyElement(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement element, global::System.Exception exception) 393private static readonly global::System.Action<global::Microsoft.Extensions.Logging.ILogger, global::System.Xml.Linq.XElement, global::System.Exception?> __AnExceptionOccurredWhileProcessingElementDebugCallback = 394global::Microsoft.Extensions.Logging.LoggerMessage.Define<global::System.Xml.Linq.XElement>(global::Microsoft.Extensions.Logging.LogLevel.Trace, new global::Microsoft.Extensions.Logging.EventId(25, "ExceptionOccurredWhileProcessingTheKeyElementDebug"), "An exception occurred while processing the key element '{Element}'.", new global::Microsoft.Extensions.Logging.LogDefineOptions() { SkipEnabledCheck = true }); 401public static partial void AnExceptionOccurredWhileProcessingElementDebug(this global::Microsoft.Extensions.Logging.ILogger logger, global::System.Xml.Linq.XElement element, global::System.Exception exception)
Internal\KeyManagementOptionsPostSetup.cs (2)
99EncryptedXmlInfo IXmlEncryptor.Encrypt(XElement plaintextElement) 112public override void StoreElement(XElement element, string friendlyName)
KeyManagement\IKeyEscrowSink.cs (1)
25void Store(Guid keyId, XElement element);
KeyManagement\Internal\IInternalXmlKeyManager.cs (1)
27IAuthenticatedEncryptorDescriptor DeserializeDescriptorFromKeyElement(XElement keyElement);
KeyManagement\Key.cs (2)
63XElement keyElement, 223private static Func<IAuthenticatedEncryptorDescriptor> GetLazyDescriptorDelegate(IInternalXmlKeyManager keyManager, XElement keyElement)
KeyManagement\KeyEscrowServiceProviderExtensions.cs (1)
33public void Store(Guid keyId, XElement element)
KeyManagement\XmlKeyManager.cs (13)
178private object?[] ProcessAllElements(IReadOnlyCollection<XElement> allElements, out DateTimeOffset? mostRecentMassRevocationDate) 190foreach (var element in allElements) 288private Key? ProcessKeyElement(XElement keyElement) 344private object ProcessRevocationElement(XElement revocationElement) 387var revocationElement = new XElement(RevocationElementName, 490private void WriteKeyDeserializationErrorToLog(Exception error, XElement keyElement) 524var keyElement = new XElement(KeyElementName, 550var possiblyEncryptedKeyElement = KeyEncryptor?.EncryptIfNecessary(keyElement) ?? keyElement; 571IAuthenticatedEncryptorDescriptor IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement) 576var descriptorElement = keyElement.Element(DescriptorElementName); 580var unencryptedInputToDeserializer = descriptorElement.Elements().Single().DecryptElement(_activator); 632var revocationElement = new XElement(RevocationElementName, 730public void Store(Guid keyId, XElement element)
LoggingExtensions.cs (3)
104public static partial void ExceptionWhileProcessingRevocationElement(this ILogger logger, XElement revocationElement, Exception exception); 113public static partial void ExceptionWhileProcessingKeyElement(this ILogger logger, XElement element, Exception exception); 116public static partial void AnExceptionOccurredWhileProcessingElementDebug(this ILogger logger, XElement element, Exception exception);
Repositories\EphemeralXmlRepository.cs (14)
19private readonly List<XElement> _storedElements = new List<XElement>(); 27public IReadOnlyCollection<XElement> GetAllElements() 36private IEnumerable<XElement> GetAllElementsCore() 39foreach (XElement element in _storedElements) 45public void StoreElement(XElement element, string friendlyName) 49var cloned = new XElement(element); // makes a deep copy so caller doesn't inadvertently modify it 67foreach (var storedElement in _storedElements) 84var storedElement = deletableElement.StoredElement; 100public DeletableElement(XElement storedElement, XElement element) 107public XElement Element { get; } 109/// <summary>The <see cref="XElement"/> from which <see cref="Element"/> was cloned.</summary> 110public XElement StoredElement { get; }
Repositories\FileSystemXmlRepository.cs (9)
69public virtual IReadOnlyCollection<XElement> GetAllElements() 75private IEnumerable<XElement> GetAllElementsCore() 107private XElement ReadElementFromFile(string fullPath) 113return XElement.Load(fileStream); 118public virtual void StoreElement(XElement element, string friendlyName) 132private void StoreElementCore(XElement element, string filename) 189var element = ReadElementFromFile(fullPath); 221public DeletableElement(FileSystemInfo fileSystemInfo, XElement element) 228public XElement Element { get; }
Repositories\IDeletableElement.cs (1)
14public XElement Element { get; }
Repositories\IXmlRepository.cs (2)
20IReadOnlyCollection<XElement> GetAllElements(); 34void StoreElement(XElement element, string friendlyName);
Repositories\RegistryXmlRepository.cs (10)
56public virtual IReadOnlyCollection<XElement> GetAllElements() 62private IEnumerable<XElement> GetAllElementsCore() 72var element = ReadElementFromRegKey(RegistryKey, valueName); 127private XElement? ReadElementFromRegKey(RegistryKey regKey, string valueName) 132return (!string.IsNullOrEmpty(data)) ? XElement.Parse(data) : null; 136public virtual void StoreElement(XElement element, string friendlyName) 150private void StoreElementCore(XElement element, string valueName) 168var element = ReadElementFromRegKey(RegistryKey, valueName); 202public DeletableElement(string valueName, XElement element) 209public XElement Element { get; }
XmlEncryption\CertificateXmlEncryptor.cs (6)
59/// Encrypts the specified <see cref="XElement"/> with an X.509 certificate. 67public EncryptedXmlInfo Encrypt(XElement plaintextElement) 75var encryptedElement = EncryptElement(plaintextElement); 83private XElement EncryptElement(XElement plaintextElement) 98return XElement.Load(xmlDocument.DocumentElement.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\DpapiNGXmlDecryptor.cs (2)
47public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiNGXmlEncryptor.cs (3)
49/// Encrypts the specified <see cref="XElement"/>. 57public EncryptedXmlInfo Encrypt(XElement plaintextElement) 85var element = new XElement("encryptedKey",
XmlEncryption\DpapiXmlDecryptor.cs (2)
44public XElement Decrypt(XElement encryptedElement)
XmlEncryption\DpapiXmlEncryptor.cs (3)
42/// Encrypts the specified <see cref="XElement"/>. 50public EncryptedXmlInfo Encrypt(XElement plaintextElement) 82var element = new XElement("encryptedKey",
XmlEncryption\EncryptedXmlDecryptor.cs (3)
57public XElement Decrypt(XElement encryptedElement) 78return XElement.Load(xmlDocument.DocumentElement!.FirstChild!.CreateNavigator()!.ReadSubtree());
XmlEncryption\EncryptedXmlInfo.cs (5)
11/// Wraps an <see cref="XElement"/> that contains a blob of encrypted XML 20/// <param name="decryptorType">The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> 22public EncryptedXmlInfo(XElement encryptedElement, Type decryptorType) 39/// The class whose <see cref="IXmlDecryptor.Decrypt(XElement)"/> method can be used to 47public XElement EncryptedElement { get; }
XmlEncryption\IXmlDecryptor.cs (3)
19/// Implementations of this method must not mutate the <see cref="XElement"/> 22XElement Decrypt(XElement encryptedElement);
XmlEncryption\IXmlEncryptor.cs (3)
14/// Encrypts the specified <see cref="XElement"/>. 23/// Implementations of this method must not mutate the <see cref="XElement"/> 26EncryptedXmlInfo Encrypt(XElement plaintextElement);
XmlEncryption\NullXmlDecryptor.cs (2)
21public XElement Decrypt(XElement encryptedElement)
XmlEncryption\NullXmlEncryptor.cs (3)
36/// Encrypts the specified <see cref="XElement"/> with a null encryptor, i.e., 45public EncryptedXmlInfo Encrypt(XElement plaintextElement) 56var newElement = new XElement("unencryptedKey",
XmlEncryption\XmlEncryptionExtensions.cs (22)
19public static XElement DecryptElement(this XElement element, IActivator activator) 35var placeholderReplacements = new Dictionary<XElement, XElement>(); 39var elementWhichRequiresDecryption = doc.Descendants(XmlConstants.EncryptedSecretElementName).FirstOrDefault(); 49var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption); 52var decryptedElement = decryptorInstance.Decrypt(clonedElementWhichRequiresDecryption.Elements().Single()); 56var newPlaceholder = new XElement("placeholder"); 101public static XElement? EncryptIfNecessary(this IXmlEncryptor encryptor, XElement element) 117var placeholderReplacements = new Dictionary<XElement, EncryptedXmlInfo>(); 121var elementWhichRequiresEncryption = doc.Descendants().FirstOrDefault(DoesSingleElementRequireEncryption); 130var clonedElementWhichRequiresEncryption = new XElement(elementWhichRequiresEncryption); 137var newPlaceholder = new XElement("placeholder"); 158/// Converts an <see cref="XElement"/> to a <see cref="Secret"/> so that it can be kept in memory 161public static Secret ToSecret(this XElement element) 182/// Converts a <see cref="Secret"/> back into an <see cref="XElement"/>. 184public static XElement ToXElement(this Secret secret) 193return XElement.Load(memoryStream); 202private static bool DoesElementOrDescendentRequireDecryption(XElement element) 207private static bool DoesElementOrDescendentRequireEncryption(XElement element) 212private static bool DoesSingleElementRequireEncryption(XElement element)
XmlExtensions.cs (3)
19public static XElement WithoutChildNodes(this XElement element) 21var newElement = new XElement(element.Name);
Microsoft.AspNetCore.DataProtection.EntityFrameworkCore (4)
EntityFrameworkCoreXmlRepository.cs (4)
41public virtual IReadOnlyCollection<XElement> GetAllElements() 46IEnumerable<XElement> GetAllElementsCore() 58yield return XElement.Parse(key.Xml); 66public void StoreElement(XElement element, string friendlyName)
Microsoft.AspNetCore.DataProtection.StackExchangeRedis (4)
RedisXmlRepository.cs (4)
33public IReadOnlyCollection<XElement> GetAllElements() 38private IEnumerable<XElement> GetAllElementsCore() 48yield return XElement.Parse((string)value!); 53public void StoreElement(XElement element, string friendlyName)
Microsoft.AspNetCore.OpenApi.SourceGenerators (24)
XmlCommentGenerator.Parser.cs (3)
51XElement xml; 54xml = XElement.Parse(text.ToString()); 62foreach (var member in members)
XmlComments\XmlComment.cs (7)
70foreach (var element in listElements) 101foreach (var element in codeElements) 115foreach (var element in paramRefElements) 130foreach (var element in typeParamRefElements) 148foreach (var element in paraElements) 188foreach (var item in nodes) 220foreach (var item in nodes)
XmlComments\XmlComment.InheritDoc.cs (14)
43var element = XElement.Parse(xmlText, LoadOptions.PreserveWhitespace); 110var element = (XElement)node; 142private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken) 232foreach (var typeParameterRef in typeParameterRefs) 247var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 345static string BuildXPathForElement(XElement element) 354for (var current = element; current != null; current = current.Parent) 370private static bool ElementNameIs(XElement element, string name) 402var sourceElement = (XElement)(object)node; 403var targetElement = (XElement)copy;
Microsoft.AspNetCore.Rewrite (20)
IISUrlRewrite\InvalidUrlRewriteFormatException.cs (3)
14public InvalidUrlRewriteFormatException(XElement element, string message) 19public InvalidUrlRewriteFormatException(XElement element, string message, Exception innerException) 27private static string FormatMessage(XElement element, string message)
IISUrlRewrite\RewriteMapParser.cs (4)
11public static IISRewriteMapCollection? Parse(XElement xmlRoot) 15var mapsElement = xmlRoot.Descendants(RewriteTags.RewriteMaps).SingleOrDefault(); 22foreach (var mapElement in mapsElement.Elements(RewriteTags.RewriteMap)) 25foreach (var addElement in mapElement.Elements(RewriteTags.Add))
IISUrlRewrite\UrlRewriteFileParser.cs (13)
24var xmlRoot = xmlDoc.Descendants(RewriteTags.Rewrite).FirstOrDefault(); 39private void ParseRules(XElement? rules, IList<IISUrlRewriteRule> result, bool global) 46foreach (var rule in rules.Elements(RewriteTags.Rule)) 58private void ParseRuleAttributes(XElement rule, UrlRewriteRuleBuilder builder) 74var match = rule.Element(RewriteTags.Match); 80var action = rule.Element(RewriteTags.Action); 91private static void ParseMatch(XElement match, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 104private void ParseConditions(XElement? conditions, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 121foreach (var cond in adds) 127private void ParseCondition(XElement conditionElement, UrlRewriteRuleBuilder builder, PatternSyntax patternSyntax) 188private void ParseUrlAction(XElement urlAction, UrlRewriteRuleBuilder builder, bool stopProcessing) 253private static bool ParseBool(XElement element, string rewriteTag, bool defaultValue) 268private static TEnum ParseEnum<TEnum>(XElement element, string rewriteTag, TEnum defaultValue)
Microsoft.AspNetCore.Server.IntegrationTesting (3)
Deployers\RemoteWindowsDeployer\RemoteWindowsDeployer.cs (3)
155var aspNetCoreSection = webConfig.Descendants("aspNetCore") 166var environmentVariablesSection = aspNetCoreSection.Elements("environmentVariables").FirstOrDefault(); 175var environmentVariable = new XElement("environmentVariable");
Microsoft.Build.Tasks.Core (23)
AssemblyDependency\GenerateBindingRedirects.cs (11)
77XElement runtimeNode = doc.Root 79.OfType<XElement>() 198private void UpdateExistingBindingRedirects(XElement runtimeNode, IDictionary<AssemblyName, string> redirects) 203.OfType<XElement>() 206foreach (var assemblyBinding in assemblyBindingNodes) 210.OfType<XElement>() 213foreach (var dependentAssembly in dependentAssemblies) 215var assemblyIdentity = dependentAssembly 217.OfType<XElement>() 228var bindingRedirect = dependentAssembly 230.OfType<XElement>()
AssemblyDependency\ResolveAssemblyReference.cs (1)
1409var node = new XElement(
CombineTargetFrameworkInfoProperties.cs (1)
49XElement root = UseAttributeForTargetFrameworkInfoPropertyNames ?
CombineXmlElements.cs (2)
37XElement root = new XElement(RootElementName); 41root.Add(XElement.Parse(item.ItemSpec));
GenerateResource.cs (1)
3129foreach (XElement dataElem in doc.Element("root").Elements("data"))
ResourceHandling\MSBuildResXReader.cs (4)
34foreach (XElement elem in doc.Element("root").Elements()) 58private static void ParseAssemblyAlias(Dictionary<string, string> aliases, XElement elem) 116XElement elem, 124XElement valueElement = elem.Element("value");
RoslynCodeTaskFactory\RoslynCodeTaskFactory.cs (3)
404XElement codeElement = null; 414XElement child = (XElement)node;
Microsoft.CodeAnalysis (17)
InternalUtilities\XmlUtilities.cs (5)
45var sourceElement = ((XElement)(object)node); 46var targetElement = ((XElement)copy); 68internal static XElement[]? TrySelectElements(XNode node, string xpath, out string? errorMessage, out bool invalidXPath)
RuleSet\RuleSetProcessor.cs (12)
66XElement? ruleSetNode = null; 81List<XElement> nodeList = ruleSetDocument.Elements(RuleSetNodeName).ToList(); 96private static RuleSet ReadRuleSet(XElement ruleSetNode, string filePath) 106foreach (XElement childNode in ruleSetNode.Elements()) 149private static List<KeyValuePair<string, ReportDiagnostic>> ReadRules(XElement rulesNode) 157foreach (XElement ruleNode in rulesNode.Elements()) 178private static KeyValuePair<string, ReportDiagnostic> ReadRule(XElement ruleNode) 191private static RuleSetInclude ReadRuleSetInclude(XElement includeNode) 205private static ReportDiagnostic ReadAction(XElement node, bool allowDefault) 242private static ReportDiagnostic ReadIncludeAll(XElement includeAllNode) 253private static string ReadNonEmptyAttribute(XElement node, string attributeName) 287private static void ValidateAttribute(XElement node, string attributeName)
Microsoft.CodeAnalysis.Analyzers (46)
MetaAnalyzers\DiagnosticDescriptorCreationAnalyzer_ResourceStringsFormat.cs (1)
76foreach (var dataElement in parsedDocument.Descendants("data"))
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.AnalyzerUtilities (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.CodeStyle (38)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
Microsoft.CodeAnalysis.CSharp (8)
Compiler\DocumentationCommentCompiler.IncludeElementExpander.cs (8)
179XElement element = (XElement)node; 215XElement element = (XElement)container; 252private static bool ElementNameIs(XElement element, string name) 266private XNode[] RewriteIncludeElement(XElement includeElement, string currentXmlFilePath, CSharpSyntaxNode originatingSyntax, out string commentMessage) 355XElement[] loadedElements = XmlUtilities.TrySelectElements(doc, xpathValue, out errorMessage, out invalidXPath); 464private Location GetIncludeElementLocation(XElement includeElement, ref string currentXmlFilePath, ref CSharpSyntaxNode originatingSyntax)
Microsoft.CodeAnalysis.CSharp.CodeStyle (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.CSharp.Workspaces (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
Microsoft.CodeAnalysis.Features (8)
DocumentationComments\AbstractDocumentationCommentFormattingService.cs (7)
278var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 310var summaryElement = XElement.Parse(inputString, LoadOptions.PreserveWhitespace); 340var element = (XElement)node; 465private static (string target, string hint)? GetNavigationTarget(XElement element, SemanticModel semanticModel, int position, SymbolDisplayFormat format)
src\roslyn\src\Analyzers\Core\CodeFixes\NamingStyle\NamingStyleCodeFixProvider.cs (1)
52var style = NamingStyle.FromXElement(XElement.Parse(serializedNamingStyle));
Microsoft.CodeAnalysis.NetAnalyzers (7)
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
50var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 93static XElement GetTopLevelRulesetNode(string rulesetFilePath) 100var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 124var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 133foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 144if (node is XElement ruleNode &&
Microsoft.CodeAnalysis.ResxSourceGenerator (46)
AbstractResxGenerator.cs (1)
444foreach (var node in XDocument.Load(new SourceTextReader(text)).Descendants("data"))
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.CodeAnalysis.VisualBasic (6)
Compilation\DocumentationComments\DocumentationCommentCompiler.Includes.vb (6)
273Dim element = DirectCast(node, XElement) 304Dim element = DirectCast(container, XElement) 431Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean 441Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode() 511Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath) 579Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
Microsoft.CodeAnalysis.Workspaces (83)
CodeStyle\CodeStyleOption.cs (3)
18XElement ToXElement(); 61public XElement ToXElement() => UnderlyingOption.ToXElement(); 63public static CodeStyleOption<T> FromXElement(XElement element)
Log\WorkspaceStructureLogger.cs (28)
40var workspaceElement = new XElement("workspace"); 54var projectElement = await BuildProjectElementAsync(project, cancellationToken).ConfigureAwait(false); 57var msbuildReferencesElement = CreateMsBuildReferencesElement(project); 71var workspaceAnalyzerReferencesElement = new XElement("workspaceAnalyzerReferences"); 89var generatorDiagnosticsElement = new XElement("generatorDiagnostics"); 109protected virtual Task<IEnumerable<XElement>> CreateAdditionalProjectElementsAsync(Project project, CancellationToken cancellationToken) 110=> Task.FromResult<IEnumerable<XElement>>([]); 112private static async Task<XElement> BuildProjectElementAsync(Project project, CancellationToken cancellationToken) 114var projectElement = new XElement("project"); 129private static XElement? CreateMsBuildReferencesElement(Project project) 137var msbuildReferencesElement = new XElement("msbuildReferences"); 146private XElement BuildWorkspaceReferencesElement(Project project) 148var workspaceReferencesElement = new XElement("workspaceReferences"); 155var referenceElement = new XElement("projectReference", new XAttribute("id", SanitizePath(projectReference.ProjectId.ToString()))); 166private async Task AddCompilationElementsAsync(XElement projectElement, Project project, CancellationToken cancellationToken) 172var compilationReferencesElement = new XElement("compilationReferences"); 180var diagnosticsElement = new XElement("diagnostics"); 189private static XElement CreateElementForDiagnostic(Diagnostic diagnostic) 196private static IEnumerable<XElement> CreateElementsForSourceGeneratedDocuments(IEnumerable<SourceGeneratedDocument> documents) 198var elements = new List<XElement>(); 203var element = new XElement("sourceGeneratedDocument", 240internal XElement CreateElementForPortableExecutableReference(MetadataReference reference) 263private static XElement CreateElementForAnalyzerReference(Microsoft.CodeAnalysis.Diagnostics.AnalyzerReference reference) 268private XElement CreateElementForCompilation(Compilation compilation) 274var typesElement = new XElement("types"); 295internal static async Task<IEnumerable<XElement>> CreateElementsForDocumentCollectionAsync(IEnumerable<TextDocument> documents, string elementName, CancellationToken cancellationToken) 297var elements = new List<XElement>(); 301var documentElement = new XElement(elementName, new XAttribute("path", SanitizePath(document.FilePath)));
Shared\Extensions\ISymbolExtensions.cs (14)
243var element = XElement.Parse(xmlText, LoadOptions.PreserveWhitespace); 301var element = (XElement)node; 344private static XNode[]? RewriteInheritdocElement(ISymbol memberSymbol, HashSet<ISymbol>? visitedSymbols, Compilation compilation, XElement element, CancellationToken cancellationToken) 426foreach (var typeParameterRef in typeParameterRefs) 439var replacement = new XElement(DocumentationCommentXmlNames.SeeElementName); 537static string BuildXPathForElement(XElement element) 546for (var current = element; current != null; current = current.Parent) 591var sourceElement = (XElement)(object)node; 592var targetElement = (XElement)copy; 633private static bool ElementNameIs(XElement element, string name)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Microsoft.DotNet.Arcade.Sdk (3)
src\ExtractNgenMethodList.cs (2)
59var parentElement = document.Root.Element("MethodProfilingData"); 62foreach (var child in parentElement.Elements("Item"))
src\GenerateResxSource.cs (1)
110foreach (var node in XDocument.Load(TaskEnvironment.GetAbsolutePath(ResourceFile)).Descendants("data"))
Microsoft.DotNet.Build.Manifest (17)
ArtifactModel.cs (1)
13public abstract XElement ToXml();
ArtifactSet.cs (2)
26public IEnumerable<XElement> ToXml() => Packages 37public static ArtifactSet Parse(XElement xml) => new ArtifactSet
AssetManifestModel.cs (1)
16public override XElement ToXml() => throw new NotImplementedException();
BlobArtifactModel.cs (2)
17public override XElement ToXml() => new XElement( 23public static BlobArtifactModel Parse(XElement xml) => new BlobArtifactModel
BuildIdentity.cs (2)
259public XElement ToXmlBuildElement() => new XElement("Build", ToXmlAttributes()); 261public static BuildIdentity Parse(XElement xml) => new BuildIdentity
BuildModel.cs (2)
26public XElement ToXml() => new XElement( 31public static BuildModel Parse(XElement xml) => new BuildModel(BuildIdentity.Parse(xml))
BuildModelFactory.cs (1)
189return BuildModel.Parse(XElement.Load(stream));
PackageArtifactModel.cs (2)
60public override XElement ToXml() => new XElement( 66public static PackageArtifactModel Parse(XElement xml) => new PackageArtifactModel
PdbArtifactModel.cs (2)
29public override XElement ToXml() => new XElement( 35public static PdbArtifactModel Parse(XElement xml) => new PdbArtifactModel
XElementParsingExtensions.cs (2)
13public static string GetRequiredAttribute(this XElement element, XName name) 24public static Dictionary<string, string> CreateAttributeDictionary(this XElement element)
Microsoft.DotNet.Build.Tasks.Installers (11)
src\CreateWixBuildWixpack.cs (1)
575foreach (var element in elements)
src\CreateWixCommandPackageDropBase.cs (4)
254IEnumerable<XElement> iels = doc.XPathSelectElements(xpath, nsmgr); 258foreach (XElement row in iels) 260IEnumerable<XElement> fields = row.XPathSelectElements("wix:field", nsmgr); 274foreach (XElement field in fields)
src\GenerateMacOSDistributionFile.cs (5)
44var titleElement = new XElement("title", $"{ProductBrandName} ({TargetArchitecture})"); 65var scriptElement = new XElement("script", new XCData(archScriptContent)); 97var optionsElement = document.Root.Element("options"); 137public static XElement WithAttribute(this XElement element, XName attribute, object value)
src\StabilizeWixFileId.cs (1)
72XElement[] matchingFileElements = content.Element(GetQualifiedName("Wix"))
Microsoft.DotNet.Build.Tasks.Packaging (2)
GenerateNuSpec.cs (1)
164var licenseUrlElement = nuspec.Descendants(NuSpecXmlNamespace + "licenseUrl").Single();
PackageIndex.cs (1)
217foreach (var file in frameworkList.Element("FileList").Elements("File"))
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\FinalizeInsertionVsixFile.cs (1)
77var installationElement = document.Element(XName.Get("PackageManifest", VsixNamespace))?.Element(XName.Get("Installation", VsixNamespace));
Microsoft.DotNet.Build.Tasks.Workloads (25)
Msi\WixDocument.cs (10)
24public XElement Package => _doc.Root.Descendants(s_wixNamespace + "Package").FirstOrDefault(); 50public XElement GetDirectory(string id) => 60public XElement GetElement(string elementName, string id = null, XNamespace ns = null) 67foreach (XElement element in _doc.Root.Descendants((ns ?? s_wixNamespace) + elementName)) 83public XElement GetFeature(string id) => 92public void AddRegistryKey(string componentId, XElement registryKey) 94var component = GetElement("Component", componentId) ?? 130public static XElement CreateDirectory(string name) => 139public static XElement CreateDirectory(string name, string id) => 150public static XElement CreateRegistryKey(string key, string root = "HKLM") =>
Msi\WixXmlExtensions.cs (15)
49public static XElement AddRegistryValue(this XElement element, string? name, string value, string type = "string", bool keyPath = false) 53var registryValue = new XElement(s_wixNamespace + "RegistryValue", 83public static XElement AddRegistryKey(this XElement element, string key, string? root = "HKLM") 87var registryKey = new XElement(s_wixNamespace + "RegistryKey", 111public static XElement AddComponentGroupRef(this XElement element, string id) 115var componentGroupRef = new XElement(s_wixNamespace + "ComponentGroupRef", 131public static XElement AddDirectory(this XElement element, string id, string name) 135var directory = new XElement(s_wixNamespace + "Directory", 147public static XElement AddDirectory(this XElement element, XElement directory)
Microsoft.DotNet.HotReload.Watch (1)
HotReload\HotReloadDotNetWatcher.cs (1)
1147var solutionElement = new XElement("Solution");
Microsoft.DotNet.MacOsPkg.Core (7)
Package.cs (7)
56var xml = XElement.Load(distribution); 57List<XElement> componentPackages = xml.Elements("pkg-ref").Where(e => e.Value.Trim() != "").ToList(); 58foreach (var package in componentPackages) 158XElement pkgInfo = XElement.Load(packageInfo); 202private static string GetPackageInfoAttribute(XElement pkgInfo, string elementName) =>
Microsoft.DotNet.NuGetRepack.Tasks (10)
src\NuGetVersionUpdater.cs (8)
140var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 152var versionElement = metadata.Element(XName.Get("version", nuspecXmlns)); 255private static bool IsDotnetTool(string nuspecXmlns, XElement metadata) 257var packageTypesElement = metadata.Element(XName.Get("packageTypes", nuspecXmlns)); 260foreach (var packageType in packageTypesElement.Elements(XName.Get("packageType", nuspecXmlns)) ?? Array.Empty<XElement>()) 284Descendants(XName.Get("dependency", package.NuspecXmlns)) ?? Array.Empty<XElement>(); 286foreach (var dependency in dependencies)
src\ReplacePackageParts.cs (2)
150var metadata = nuspecXml.Element(XName.Get("package", nuspecXmlns))?.Element(XName.Get("metadata", nuspecXmlns)); 164var versionElement = metadata.Element(XName.Get("version", nuspecXmlns));
Microsoft.DotNet.PackageTesting (4)
VerifyClosure.cs (4)
351var nodesElement = new XElement(s_dgmlns + "Nodes"); 352var linksElement = new XElement(s_dgmlns + "Links"); 381var categoriesElement = new XElement(s_dgmlns + "Categories"); 400private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
Microsoft.DotNet.SharedFramework.Sdk (6)
parent\Microsoft.DotNet.PackageTesting\VerifyClosure.cs (4)
351var nodesElement = new XElement(s_dgmlns + "Nodes"); 352var linksElement = new XElement(s_dgmlns + "Links"); 381var categoriesElement = new XElement(s_dgmlns + "Categories"); 400private static bool TryAddNode(ICollection<string> existing, XElement parent, string id, bool isNative = false)
src\CreateFrameworkListFile.cs (2)
71var frameworkManifest = new XElement("FileList", rootAttributes); 167var element = new XElement(
Microsoft.DotNet.SourceBuild.Tasks (17)
src\UsageReport\AnnotatedUsage.cs (1)
19public XElement ToXml() => new XElement(
src\UsageReport\Usage.cs (2)
30public XElement ToXml() => new XElement( 38public static Usage Parse(XElement xml) => new Usage
src\UsageReport\UsageData.cs (2)
18public XElement ToXml() => new XElement( 43public static UsageData Parse(XElement xml) => new UsageData
src\UsageReport\UsagePattern.cs (2)
15public XElement ToXml() => new XElement( 20public static UsagePattern Parse(XElement xml) => new UsagePattern
src\UsageReport\UsageValidationData.cs (1)
13public XElement Report { get; set; }
src\UsageReport\WriteUsageReports.cs (7)
67UsageData data = UsageData.Parse(XElement.Parse(File.ReadAllText(TaskEnvironment.GetAbsolutePath(DataFile)))); 88var xml = XElement.Parse(File.ReadAllText(prodConBuildManifestFile)); 89foreach (var x in xml.Descendants("Package")) 119var report = new XElement("AnnotatedUsages"); 192Xml = XElement.Parse(content) 258public static PackageVersionPropsElement[] Parse(XElement xml)
src\UsageReport\XmlParsingHelpers.cs (2)
15public static XElement ToXElement(this PackageIdentity ident) => new XElement( 26public static PackageIdentity ParsePackageIdentity(XElement xml) => new PackageIdentity(
Microsoft.DotNet.XliffTasks (52)
Model\ResxDocument.cs (4)
18foreach (XElement node in Document.Descendants("data")) 27XElement valueElement = node.Element("value"); 59foreach (XElement node in Document.Descendants("data")) 63XElement valueNodeOfFileRef = node.Element("value");
Model\TranslatableXmlDocument.cs (2)
29private readonly XElement _element; 31public TranslatableXmlElement(string id, string source, string note, XElement element)
Model\VsctDocument.cs (4)
20foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 31foreach (XElement child in strings.Elements()) 64foreach (XElement strings in Document.Descendants(Document.Root.Name.Namespace + "Strings")) 79foreach (XElement imageTag in Document.Descendants(Document.Root.Name.Namespace + "Bitmap"))
Model\XamlRuleDocument.cs (11)
27foreach (XElement? element in Document.Descendants()) 30var descendentDisplayName = element.Elements(XName.Get($"{element.Name.LocalName}.DisplayName", element.Name.NamespaceName)).FirstOrDefault(); 31var descendentDescription = element.Elements(XName.Get($"{element.Name.LocalName}.Description", element.Name.NamespaceName)).FirstOrDefault(); 125var parent = xObject.Parent; 133var grandparent = parent.Parent; 145private static string GenerateIdForPropertyMetadata(XElement element, XAttribute? attribute = null) 147var ancestorWithNameAttributeCandidate = element.Parent?.Parent; // start at grandparent 194private static string? GetComment(XElement element, string attributeName) 210private static string XmlName(XObject container) => container is XElement element ? XmlName(element) : XmlName((XAttribute)container); 211private static string XmlName(XElement element) 220private static string? AttributedName(XElement element) => element.Attribute("Name")?.Value;
Model\XDocumentExtensions.cs (1)
28public static void SelfCloseIfPossible(this XElement element)
Model\XElementExtensions.cs (15)
19public static string GetTargetValue(this XElement transUnitElement) => 29public static void SetTargetValue(this XElement transUnitElement, string value) 31XElement targetElement = transUnitElement.Element(Target); 34XElement sourceElement = transUnitElement.Element(Source); 53public static string GetTargetState(this XElement transUnitElement) => 63public static void SetTargetState(this XElement transUnitElement, string value) 65XElement targetElement = transUnitElement.Element(Target); 68XElement sourceElement = transUnitElement.Element(Source); 90public static string GetSourceValue(this XElement transUnitElement) => 98public static void SetSourceValue(this XElement transUnitElement, string value) => 106public static string GetNoteValue(this XElement transUnitElement) => 116public static void SetNoteValue(this XElement transUnitElement, string value) 118XElement noteElement = transUnitElement.Element(Note); 121XElement priorElement = transUnitElement.Element(Target) ?? transUnitElement.Element(Source); 135public static string GetId(this XElement transUnitElement) =>
Model\XlfDocument.cs (13)
90XElement fileElement = _document.Root.Element(File); 99XElement bodyElement = fileElement.Element(Body); 100XElement groupElement = bodyElement.Element(Group); 109foreach (XElement unitElement in bodyElement.Descendants(TransUnit).ToList()) 188XElement newTransUnit = 196foreach (XElement transUnit in bodyElement.Elements(TransUnit)) 227XElement fileElement = _document.Root.Element(File); 228XElement bodyElement = fileElement.Element(Body); 230IEnumerable<XElement> transUnits = bodyElement.Elements(TransUnit); 236SortedList<string, XElement> sortedTransUnits = new(comparer); 239foreach (XElement transUnit in transUnits) 245foreach (XElement transUnit in sortedTransUnits.Values) 265foreach (XElement element in _document.Descendants(TransUnit))
Tasks\TransformTemplates.cs (2)
84foreach (XElement projectNode in templateXml.Descendants().Where(d => d.Name.LocalName == "Project")) 91foreach (XElement templateItem in templateXml.Descendants().Where(d => d.Name.LocalName == "ProjectItem"))
Microsoft.Extensions.AI.Abstractions.Tests (1)
test\Shared\JsonSchemaExporter\TestTypes.cs (1)
1313[JsonSerializable(typeof(XElement))]
Microsoft.Extensions.AI.Evaluation.Safety (2)
ContentSafetyServicePayloadUtilities.cs (2)
102IEnumerable<List<XElement>> userTextListItems = 108List<XElement> item = [];
Microsoft.Extensions.FileProviders.Embedded (11)
Manifest\ManifestParser.cs (11)
38var manifest = EnsureElement(document, "Manifest"); 39var manifestVersion = EnsureElement(manifest, "ManifestVersion"); 47var fileSystem = EnsureElement(manifest, "FileSystem"); 51foreach (var element in entries) 80private static ManifestEntry BuildEntry(XElement element) 92var path = EnsureElement(element, "ResourcePath"); 101foreach (var child in element.Elements()) 115private static XElement EnsureElement(XContainer container, string elementName) 117var element = container.Element(elementName); 126private static string EnsureName(XElement element) 137private static string EnsureText(XElement element)
Microsoft.Extensions.FileProviders.Embedded.Manifest.Task (3)
Manifest.cs (3)
46var root = new XElement(ElementNames.Root, 56private XElement BuildNode(Entry entry) 66var directory = new XElement(ElementNames.Directory, new XAttribute(ElementNames.Name, entry.Name));
Microsoft.Maui.Resizetizer (22)
GeneratePackageAppxManifest.cs (10)
81 var identity = appx.Root.Element(xidentity); 125 var properties = appx.Root.Element(xproperties); 136 var xelem = properties.Element(xname); 145 var xelem = properties.Element(xname); 171 var applications = appx.Root.Element(xapplications); 180 var application = applications.Element(xapplication); 189 var visual = application.Element(xvisual); 252 var tile = visual.Element(xtile); 309 var showname = tile.Element(xshowname); 328 var splash = visual.Element(xsplash);
GenerateTizenManifest.cs (12)
84 var manifest = tizenManifest.Root; 85 var uiApplication = manifest.Element(xmlns + UiApplicationName); 97 void UpdateSharedManifest(XNamespace xmlns, XElement manifest) 99 var uiApplication = manifest.Element(xmlns + UiApplicationName); 122 var label = uiApplication.Element(xmlns + LabelName); 132 void UpdateSharedResources(XNamespace xmlns, XElement manifestElement) 134 var uiApplicationElement = manifestElement.Element(xmlns + UiApplicationName); 143 foreach (var icon in iconPlaceholderElements) 162 var splashscreensElement = uiApplicationElement.Element(xmlns + SplashScreensName); 178 var splashscreenElement = new XElement(xmlns + SplashScreenName); 190 void UpdateElementAttribute(XElement element, XName attrName, string? value, string? placeholder) 199 void UpdateElementValue(XElement element, string? value, string? placeholder)
Microsoft.ML.Maml (2)
HelpCommand.cs (2)
463var content = new XElement("Components", 494private XElement CreateDefaultValueElement(IChannel ch, string name, CmdParser.ArgInfo.Arg a)
Microsoft.NET.Build.Extensions.Tasks (1)
parent\Common\ConflictResolution\FrameworkListReader.cs (1)
66foreach (var file in frameworkList.Root?.Elements("File") ?? [])
Microsoft.NET.Build.Tasks (19)
GenerateToolsSettingsFile.cs (4)
67XElement runtimeIdentifierPackagesNode = null; 68XElement commandNode = new XElement("Command", 80var packageNode = new XElement("RuntimeIdentifierPackage"); 97var dotnetCliToolNode = new XElement("DotNetCliTool",
parent\Common\ConflictResolution\FrameworkListReader.cs (1)
66foreach (var file in frameworkList.Root?.Elements("File") ?? [])
ResolveRuntimePackAssets.cs (1)
192foreach (var fileElement in frameworkListDoc.Root.Elements("File"))
ResolveTargetingPackAssets.cs (2)
376foreach (var fileElement in frameworkListDoc.Root.Elements("File")) 459var firstFileElement = frameworkListDoc.Root.Elements("File").FirstOrDefault();
StoreArtifactParser.cs (1)
29foreach (var pkginfo in doc.Root.Elements(ns + "Package"))
ValidateExecutableReferences.cs (4)
42var additionalPropertiesXml = XElement.Parse(project.GetMetadata("AdditionalPropertiesFromProject")); 43XElement targetFrameworkElement = UseAttributeForTargetFrameworkInfoPropertyNames ? 47foreach (XElement propertyElement in targetFrameworkElement.Elements())
WriteAppConfigWithSupportedRuntime.cs (6)
60XElement startupNode = doc.Root 62.OfType<XElement>() 73out XElement supportedRuntime)) 86private static bool HasExistingSupportedRuntime(XElement startupNode) 89&& startupNode.Nodes().OfType<XElement>().Any(e => e.Name.LocalName == "supportedRuntime"); 98out XElement supportedRuntime)
Microsoft.NET.HostModel (7)
ComHost\RegFreeComManifest.cs (7)
30XElement manifest = new XElement(ns + "assembly", new XAttribute("manifestVersion", "1.0")); 36var fileElement = CreateComHostFileElement(clsidMapPath, comHostName, ns); 54private static XElement CreateComHostFileElement(string clsidMapPath, string comHostName, XNamespace ns) 56XElement fileElement = new XElement(ns + "file", new XAttribute("name", comHostName)); 67XElement comClassElement = new XElement(ns + "comClass", new XAttribute("clsid", guid.ToString("B")), new XAttribute("threadingModel", "Both")); 78private static void AddTypeLibElementsToFileElement(IReadOnlyDictionary<int, string> typeLibraries, XNamespace ns, XElement fileElement) 90XElement typeLibElement = new XElement(ns + "typelib",
Microsoft.NET.ProjectData (3)
FrameworkListExpander.cs (2)
76 XElement? root = doc.Root; 82 foreach (XElement file in root.Elements("File"))
SdkKnownFrameworkReferenceResolver.cs (1)
85 foreach (XElement element in doc.Descendants())
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (2)
BlazorWriteSatelliteAssemblyFile.cs (1)
28var root = new XElement("SatelliteAssembly");
CreateBlazorTrimmerRootDescriptorFile.cs (1)
41var roots = new XElement("linker");
Microsoft.NET.Sdk.Publish.Tasks (18)
Tasks\GenerateEnvTransform.cs (1)
76var envVariableTransform =
WebConfigTransform.cs (17)
21XElement? rootElement = null; 24var firstAspNetCoreElement = webConfig.Root?.Descendants(aspNetCoreElementName).FirstOrDefault(); 34var webServerSection = GetOrCreateChild(rootElement, "system.webServer"); 36var handlerSection = GetOrCreateChild(webServerSection, HandlersElementName); 45var aspNetCoreSection = GetOrCreateChild(webServerSection, aspNetCoreElementName); 53var aspNetCoreElement = webServerSection?.Element(HandlersElementName)? 64private static void TransformHandlers(XElement handlersElement, string? aspNetCoreModuleName) 66var aspNetCoreElement = 89private static void TransformAspNetCore(XElement aspNetCoreElement, string appName, bool configureForAzure, bool useAppHost, string? extension, string? aspNetCoreModuleName, string? aspNetCoreHostingModelValue, string? projectFullPath) 171private static void SetAspNetCoreHostingModel(string? aspNetCoreHostingModelValue, string? aspNetCoreModuleName, XElement aspNetCoreElement) 194private static void TransformEnvironmentVariables(XElement envVariablesElement, string? environmentName) 196var envVariableElement = 210private static XElement GetOrCreateChild(XElement? parent, string childName) 212var childElement = parent?.Element(childName); 221private static void SetAttributeValueIfEmpty(XElement element, string attributeName, string? value) 226private static void RemoveLauncherArgs(XElement aspNetCoreElement)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (13)
GeneratePackageAssetsTargetsFile.cs (3)
32var itemGroup = new XElement("ItemGroup"); 33var manifestItem = new XElement("StaticWebAssetPackageManifest", 42var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetEndpointsPropsFile.cs (2)
47var itemGroup = new XElement("ItemGroup"); 66var root = new XElement("Project", itemGroup);
GenerateStaticWebAssetsPropsFile.cs (2)
83var itemGroup = new XElement("ItemGroup"); 132var root = new XElement("Project", itemGroup);
Legacy\GenerateStaticWebAssetsPropsFile50.cs (2)
56var itemGroup = new XElement("ItemGroup"); 81var root = new XElement("Project", itemGroup);
Legacy\GenerateV1StaticWebAssetsManifest.cs (3)
38var root = new XElement( 100private IEnumerable<XElement> CreateNodes() 102var nodes = new List<XElement>();
StaticWebAssetsGeneratePackagePropsFile.cs (1)
32var root = new XElement("Project");
Microsoft.TestPlatform.Build (5)
Tasks\TestTaskUtils.cs (5)
297foreach (var loggerRunSettings in document.Root.Elements()) 304foreach (var loggers in loggerRunSettings.Elements()) 311foreach (var logger in loggers.Elements()) 341foreach (var configuration in logger.Elements()) 348foreach (var element in configuration.Elements())
Microsoft.TestPlatform.CrossPlatEngine (1)
TestEngine.cs (1)
576XElement? targetFrameworkTestHostDemultiplexer = document?.Element("RunSettings")?.Element("RunConfiguration")?.Element("TargetFrameworkTestHostDemultiplexer");
Microsoft.VisualStudio.TestPlatform.Common (3)
ExtensionDecorators\SerialTestRunDecorator.cs (3)
95XElement runSettings = XElement.Parse(runContext.RunSettings.SettingsXml); 96XElement? forceOneTestAtTimePerTestHost = runSettings.Element("RunConfiguration")?.Element("ForceOneTestAtTimePerTestHost");
netstandard (1)
netstandard.cs (1)
2273[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
NuGet.Commands (12)
RestoreCommand\MSBuildRestoreItemGroup.cs (3)
30public List<XElement> Items { get; set; } = new List<XElement>(); 69IEnumerable<XElement> items,
RestoreCommand\Utility\BuildAssetsUtils.cs (9)
242public static XElement GenerateProperty(string propertyName, string content) 249internal static XElement GenerateItem(string itemName, string path) 254public static XElement GenerateImport(string path) 261public static XElement GenerateContentFilesItem(string path, LockFileContentFile item, string packageId, string packageVersion) 263var entry = new XElement(Namespace + item.BuildAction.Value, 331var itemGroup = new XElement(Namespace + group.RootName, group.Items); 703var import = GenerateImport(pathWithMacros); 728var import = GenerateImport(pathWithMacros); 912private static XElement GeneratePackagePathProperty(LocalPackageInfo localPackageInfo)
NuGet.Configuration (67)
Settings\Items\AddItem.cs (1)
44internal AddItem(XElement element, SettingsFile origin)
Settings\Items\AuthorItem.cs (3)
23internal AuthorItem(XElement element, SettingsFile origin) 42if (Node is XElement) 47var element = new XElement(ElementName);
Settings\Items\CertificateItem.cs (1)
79internal CertificateItem(XElement element, SettingsFile origin)
Settings\Items\ClearItem.cs (1)
18internal ClearItem(XElement element, SettingsFile origin)
Settings\Items\ClientCertItem.cs (1)
25internal ClientCertItem(XElement element, SettingsFile origin)
Settings\Items\CredentialsItem.cs (5)
140internal CredentialsItem(XElement element, SettingsFile origin) 217if (Node is XElement) 223var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), 294var element = Node as XElement;
Settings\Items\FileClientCertItem.cs (3)
53internal FileClientCertItem(XElement element, SettingsFile origin) 142if (Node is XElement) 147var element = new XElement(ElementName);
Settings\Items\MinPublishAgeExceptionItem.cs (1)
56internal MinPublishAgeExceptionItem(XElement element, SettingsFile origin)
Settings\Items\OwnersItem.cs (5)
38internal OwnersItem(XElement element, SettingsFile origin) 41var descendants = element.Nodes().Where(n => n is XText text && !string.IsNullOrWhiteSpace(text.Value) || n is XElement) 69if (Node is XElement) 76var element = new XElement(ElementName, _content.AsXNode()); 128((XElement)Node).Add(_content.Node);
Settings\Items\PackagePatternItem.cs (1)
34internal PackagePatternItem(XElement element, SettingsFile origin)
Settings\Items\PackageSourceMappingSourceItem.cs (5)
75internal PackageSourceMappingSourceItem(XElement element, SettingsFile origin) 78var parsedDescendants = element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 127if (Node is XElement) 132var element = new XElement(ElementName); 191XElementUtility.AddIndented(Node as XElement, itemToAdd.Node);
Settings\Items\RepositoryItem.cs (5)
59internal RepositoryItem(XElement element, SettingsFile origin) 64internal RepositoryItem(XElement element, SettingsFile origin, IEnumerable<SettingBase> parsedDescendants) 106if (Node is XElement) 111var element = new XElement(ElementName); 191XElementUtility.AddIndented(Node as XElement, _owners.Node);
Settings\Items\SourceItem.cs (1)
98internal SourceItem(XElement element, SettingsFile origin)
Settings\Items\StoreClientCertItem.cs (3)
72internal StoreClientCertItem(XElement element, SettingsFile origin) 217if (Node is XElement) 222var element = new XElement(ElementName);
Settings\Items\TrustedSignerItem.cs (6)
53internal TrustedSignerItem(XElement element, SettingsFile origin) 56IEnumerable<SettingBase> parsedDescendants = element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 70internal TrustedSignerItem(XElement element, SettingsFile origin, IEnumerable<SettingBase> parsedDescendants) 84internal static IEnumerable<SettingBase> ParseDescendants(XElement element, SettingsFile origin) 86return element.Nodes().Where(n => n is XElement || n is XText text && !string.IsNullOrWhiteSpace(text.Value)) 154XElementUtility.AddIndented(Node as XElement, certToAdd.Node);
Settings\Items\UnknownItem.cs (5)
23internal UnknownItem(XElement element, SettingsFile origin) 29var descendants = element.Nodes().Where(n => n is XText text && !string.IsNullOrWhiteSpace(text.Value) || n is XElement) 102XElementUtility.AddIndented(Node as XElement, setting.Node); 150if (Node is XElement) 155var element = new XElement(ElementName, Children.Select(c => c.AsXNode()));
Settings\NuGetConfiguration.cs (2)
62internal NuGetConfiguration(XElement element, SettingsFile origin) 116XElementUtility.AddIndented(Node as XElement, section.Node);
Settings\ParsedSettingSection.cs (1)
12internal ParsedSettingSection(string name, XElement element, SettingsFile origin)
Settings\SettingElement.cs (4)
100internal SettingElement(XElement element, SettingsFile origin) 115if (Node != null && Node is XElement) 120var element = new XElement(ElementName); 234private void ValidateAttributes(XElement element, SettingsFile origin)
Settings\SettingFactory.cs (2)
26if (node is XElement element) 160internal static IEnumerable<T> ParseChildren<T>(XElement xElement, SettingsFile origin, bool canBeCleared) where T : SettingElement
Settings\SettingItem.cs (3)
28internal SettingItem(XElement element, SettingsFile origin) 64var xElement = Node as XElement;
Settings\SettingSection.cs (1)
27internal SettingSection(string name, XElement element, SettingsFile origin)
Settings\SettingsGroup.cs (4)
42internal SettingsGroup(string name, XElement element, SettingsFile origin) 57if (Node is XElement) 62var element = new XElement(XmlUtility.GetEncodedXMLName(ElementName), Children.Select(c => c.AsXNode())); 121XElementUtility.AddIndented(Node as XElement, setting.Node);
Utility\XElementUtility.cs (3)
12internal static string? GetOptionalAttributeValue(XElement element, string localName) 18internal static string? GetOptionalAttributeValue(XElement element, string localName, string namespaceName) 96foreach (var element in container.Elements())
NuGet.PackageManagement (53)
FileModifiers\XmlTransformer.cs (12)
23private readonly IDictionary<XName, Action<XElement, XElement>> _nodeActions; 31public XmlTransformer(IDictionary<XName, Action<XElement, XElement>> nodeActions) 74var xmlFragment = await GetXmlAsync(streamTaskFactory, projectSystem, cancellationToken); 119var xmlFragment = await GetXmlAsync(streamTaskFactory, projectSystem, cancellationToken); 127var elements = new List<XElement>(); 134var mergedFragments = elements.Aggregate( 151private static async Task<XElement> GetXmlAsync( 173return XElement.Parse(content, LoadOptions.PreserveWhitespace); 176private static async Task<XElement> GetXmlAsync( 183return XElement.Parse(content, LoadOptions.PreserveWhitespace);
Projects\MSBuildNuGetProject.cs (4)
629private static IDictionary<XName, Action<XElement, XElement>> GetConfigMappings() 634return new Dictionary<XName, Action<XElement, XElement>>
Utility\XElementExtensions.cs (37)
18public static string GetOptionalAttributeValue(this XElement element, string localName, string namespaceName = null) 34XElement child; 46public static IEnumerable<XElement> ElementsNoNamespace(this XContainer container, string localName) 51public static IEnumerable<XElement> ElementsNoNamespace(this IEnumerable<XContainer> source, string localName) 57public static XElement Except(this XElement source, XElement target) 86var sourceChild = sourceChildNode as XElement; 89var targetChild = FindElement(target, sourceChild); 107public static XElement MergeWith(this XElement source, XElement target) 113public static XElement MergeWith(this XElement source, XElement target, IDictionary<XName, Action<XElement, XElement>> nodeActions) 143var targetChild = targetChildNode as XElement; 146var sourceChild = FindElement(source, targetChild); 161Action<XElement, XElement> nodeAction; 172var newlyAddedElement = source.Elements().Last(); 187private static XElement FindElement(XElement source, XElement targetChild) 198private static bool HasComment(XElement element, XComment comment) 204private static int Compare(XElement target, XElement left, XElement right) 224private static int CountMatches(XElement left, XElement right, Func<XAttribute, XAttribute, bool> matcher) 232private static bool HasConflict(XElement source, XElement target) 250public static void RemoveAttributes(this XElement element, Func<XAttribute, bool> condition) 298foreach (var element in container.Elements())
NuGet.Packaging (128)
Core\NuspecCoreReader.cs (1)
40foreach (var node in nodes)
Core\NuspecCoreReaderBase.cs (5)
21private XElement? _metadataNode; 84var node = MetadataNode.Elements(XName.Get(Id, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 95var node = MetadataNode.Elements(XName.Get(Version, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 129var node = MetadataNode.Elements(XName.Get(DevelopmentDependency, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 181protected XElement MetadataNode
Core\NuspecUtility.cs (10)
50public static IReadOnlyList<PackageType> GetPackageTypes(XElement metadataNode, bool useMetadataNamespace) 52IEnumerable<XElement> nodes; 70foreach (var node in nodes) 114public static bool IsServiceable(XElement metadataNode) 117var element = metadataNode.Elements(XName.Get(Serviceable, metadataNamespace)).FirstOrDefault(); 142internal static IEnumerable<FrameworkReferenceGroup> GetFrameworkReferenceGroups(XElement metadataNode, IFrameworkNameProvider frameworkProvider, bool useMetadataNamespace) 145IEnumerable<XElement> frameworkReferenceGroups; 160foreach (var frameworkRefGroup in frameworkReferenceGroups) 175private static IEnumerable<string> GetFrameworkReferences(IEnumerable<XElement> nodes) 180private static string? GetAttributeValue(XElement element, string attributeName)
NuspecReader.cs (13)
130foreach (var depGroup in dependencyGroups) 172foreach (var group in MetadataNode.Elements(XName.Get(References, ns)).Elements(XName.Get(Group, ns))) 273var node = MetadataNode.Elements(XName.Get(Language, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 282var node = MetadataNode.Elements(XName.Get(LicenseUrl, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 293foreach (var filesNode in MetadataNode 414var node = MetadataNode.Elements(XName.Get(Repository, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 436var licenseNode = MetadataNode.Elements(XName.Get(NuspecUtility.License, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 582var node = MetadataNode.Elements(XName.Get(Icon, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 592var node = MetadataNode.Elements(XName.Get(Readme, MetadataNode.GetDefaultNamespace().NamespaceName)).FirstOrDefault(); 596private bool? AttributeAsNullableBool(XElement element, string attributeName) 627private static string? GetAttributeValue(XElement element, string attributeName) 663private HashSet<PackageDependency> GetPackageDependencies(IEnumerable<XElement> nodes, bool useStrictVersionCheck) 667foreach (var depNode in nodes)
PackageCreation\Authoring\Manifest.cs (1)
135foreach (var e in document.Descendants())
PackageCreation\Authoring\ManifestReader.cs (15)
26var metadataElement = document.Root!.ElementsNoNamespace("metadata").FirstOrDefault(); 38private static ManifestMetadata ReadMetadata(XElement xElement) 46foreach (var element in xElement.Elements()) 70private static void ReadMetadataValue(ManifestMetadata manifestMetadata, XElement element, HashSet<string> allElements) 176private static IEnumerable<FrameworkReferenceGroup> ReadFrameworkReferenceGroups(XElement frameworkReferenceGroupsElement) 181private static LicenseMetadata ReadLicenseMetadata(XElement licenseNode) 244private static List<ManifestContentFiles> ReadContentFiles(XElement contentFilesElement) 270private static List<PackageReferenceSet> ReadReferenceSets(XElement referencesElement) 299public static List<string> ReadReference(XElement referenceElement, bool throwIfEmpty) 315private static List<FrameworkAssemblyReference> ReadFrameworkAssemblies(XElement frameworkElement) 332private static List<PackageDependencyGroup> ReadDependencyGroups(XElement dependenciesElement) 383private static ISet<PackageDependency> ReadDependencies(XElement containerElement) 401private static List<ManifestFile>? ReadFilesList(XElement? xElement) 409foreach (var file in xElement.ElementsNoNamespace("file")) 433private static RepositoryMetadata? ReadRepository(XElement element)
PackageCreation\Authoring\PackageBuilder.cs (1)
1188XElement element = new XElement(content + "Types",
PackageCreation\Extensions\XElementExtensions.cs (19)
14public static string? GetOptionalAttributeValue(this XElement element, string localName, string? namespaceName = null) 28public static IEnumerable<XElement> ElementsNoNamespace(this XContainer container, string localName) 33public static XElement Except(this XElement source, XElement? target) 62var sourceChild = sourceChildNode as XElement; 65var targetChild = FindElement(target, sourceChild); 83private static XElement? FindElement(XElement source, XElement targetChild) 94private static int Compare(XElement target, XElement left, XElement right) 112private static int CountMatches(XElement left, XElement right, Func<XAttribute, XAttribute, bool> matcher) 120private static bool HasComment(XElement element, XComment comment) 126private static bool HasConflict(XElement source, XElement target)
PackageCreation\Xml\PackageMetadataXmlExtensions.cs (24)
27public static XElement ToXElement(this ManifestMetadata metadata, XNamespace ns) 32public static XElement ToXElement(this ManifestMetadata metadata, XNamespace ns, bool generateBackwardsCompatible = true) 34var elem = new XElement(ns + "metadata"); 61var licenseElement = GetXElementFromLicenseMetadata(ns, metadata.LicenseMetadata); 95var repoElement = GetXElementFromManifestRepository(ns, metadata.Repository); 139private static XElement? GetXElementFromGroupableItemSets<TSet, TItem>( 145Func<XNamespace, TItem, XElement> getXElementFromItem, 169var childElements = new List<XElement>(); 180var groupElem = new XElement( 200private static XElement GetXElementFromFrameworkReference(XNamespace ns, FrameworkReference frameworkReference) 205private static XElement GetXElementFromPackageReference(XNamespace ns, string reference) 210private static XElement GetXElementFromPackageDependency(XNamespace ns, PackageDependency dependency) 234private static XElement? GetXElementFromFrameworkAssemblies(XNamespace ns, IEnumerable<FrameworkAssemblyReference> references) 251private static XElement? GetXElementFromManifestContentFiles(XNamespace ns, IEnumerable<ManifestContentFiles> contentFiles) 262private static XElement GetXElementFromManifestContentFile(XNamespace ns, ManifestContentFiles file) 276private static XElement GetXElementFromLicenseMetadata(XNamespace ns, LicenseMetadata metadata) 289private static XElement? GetXElementFromManifestRepository(XNamespace ns, RepositoryMetadata repository) 319private static XElement GetXElementFromManifestPackageTypes(XNamespace ns, IEnumerable<PackageType> packageTypes) 321var packageTypesElement = new XElement(ns + NuspecUtility.PackageTypes); 325var packageTypeElement = GetXElementFromManifestPackageType(ns, packageType); 332private static XElement GetXElementFromManifestPackageType(XNamespace ns, PackageType packageType) 355private static void AddElementIfNotNull<T>(XElement parent, XNamespace ns, string name, T? value) 364private static void AddElementIfNotNull<T>(XElement parent, XNamespace ns, string name, T? value, Func<T, object> process) 377private static void AddElementIfNotEmpty<T>(XElement parent, XNamespace ns, string name, IEnumerable<T> value, Func<IEnumerable<T>, object> process)
PackagesConfig.cs (5)
25public static bool TryGetAttribute(XElement node, string name, [NotNullWhen(returnValue: true)] out string? value) 43public static bool HasAttributeValue(XElement node, string attributeName, string targetValue, [NotNullWhen(returnValue: true)] out XElement? element) 45foreach (var package in node.Elements(XName.Get(PackageNodeName))) 62public static bool BoolAttribute(XElement node, string name, bool defaultValue = false)
PackagesConfigReader.cs (1)
143foreach (var package in _doc.Root!.Elements(XName.Get(PackagesConfig.PackageNodeName)))
PackagesConfigWriter.cs (26)
128var packagesNode = EnsurePackagesNode(); 190var packagesNode = EnsurePackagesNode(); 192XElement? package; 201var node = CreateXElementForPackageEntry(entry); 230var packagesNode = EnsurePackagesNode(); 233var matchingNode = FindMatchingPackageNode(oldEntry, packagesNode); 242var newPackageNode = ReplacePackageAttributes(matchingNode, newEntry); 268var originalPackagesNode = originalConfig.Element(XName.Get(PackagesConfig.PackagesNodeName)); 270XElement? matchingIdNode; 279var packagesNode = _xDocument.Element(XName.Get(PackagesConfig.PackagesNodeName)); 280var newPackageNode = ReplacePackageAttributes(matchingIdNode!, newEntry); 346var packagesNode = EnsurePackagesNode(); 348var matchingNode = FindMatchingPackageNode(entry, packagesNode); 361private XElement CreateXElementForPackageEntry(PackageReference entry) 363var node = new XElement(XName.Get(PackagesConfig.PackageNodeName)); 402var packagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName)); 408private XElement EnsurePackagesNode() 410var packagesNode = _xDocument.Element(XName.Get(PackagesConfig.PackagesNodeName)); 421private XElement? FindMatchingPackageNode(PackageReference entry, XElement packagesNode) 423XElement? matchingIdNode; 447private XElement ReplacePackageAttributes(XElement existingNode, PackageReference newEntry) 449var newEntryNode = CreateXElementForPackageEntry(newEntry); 493private void SortPackageNodes(XElement packagesNode) 495var newPackagesNode = new XElement(XName.Get(PackagesConfig.PackagesNodeName),
Rules\InvalidUndottedFrameworkRule.cs (7)
53var metadataNode = xml.Root!.Elements().FirstOrDefault(e => StringComparer.Ordinal.Equals(e.Name.LocalName, Metadata)); 80internal static IEnumerable<PackagingLogMessage> ValidateDependencyGroups(XElement metadataNode) 90foreach (var depGroup in dependencyGroups) 114internal static IEnumerable<PackagingLogMessage> ValidateReferenceGroups(XElement metadataNode) 119foreach (var group in metadataNode.Elements(XName.Get(References, ns)).Elements(XName.Get(Group, ns))) 143internal static IEnumerable<PackagingLogMessage> ValidateFrameworkAssemblies(XDocument xml, XElement metadataNode) 279private static string? GetAttributeValue(XElement element, string attributeName)
NuGet.Protocol (13)
LegacyFeed\LegacyFeedCapabilityResourceV2Feed.cs (2)
143var packageEntityContainer = result.Container; 177var packageEntity = (from e in schemaDocument.Descendants()
LegacyFeed\V2FeedParser.cs (8)
328private V2FeedPackageInfo ParsePackage(string? id, XElement element, MetadataReferenceCache metadataCache) 330var properties = element.Element(_xnameProperties)!; 331var idElement = properties.Element(_xnameId); 332var titleElement = element.Element(_xnameTitle); 377var authorNode = element.Element(_xnameAuthor); 392private static string? GetString(XElement? parent, XName childName) 398var child = parent.Element(childName); 412private static DateTimeOffset? GetDate(XElement parent, XName childName)
RemoteRepositories\RemoteV2FindPackageByIdResource.cs (3)
566private static PackageInfo BuildModel(string id, XElement element) 568var properties = element.Element(_xnameProperties)!; 569var idElement = properties.Element(_xnameId);
PresentationFramework-SystemXmlLinq (3)
SystemXmlLinqExtension.cs (3)
20XElement xelement = new XElement("Dummy"); 32return item is XElement; 38XName name = ((XElement)item).Name;
Roslyn.Diagnostics.Analyzers (45)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RulesetToEditorconfigConverter.cs (7)
51var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 94static XElement GetTopLevelRulesetNode(string rulesetFilePath) 101var rulesetNode = ruleSetDocument.Elements(RuleSetNodeName).First(); 125var rulesetNode = GetTopLevelRulesetNode(rulesetFilePath); 134foreach (var childNode in rulesetNode.Nodes().OfType<XElement>()) 145if (node is XElement ruleNode &&
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\CodeStyle\CodeStyleOption2`1.cs (3)
19XElement ToXElement(); 107public XElement ToXElement() 160public static CodeStyleOption2<T> FromXElement(XElement element)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\NamingStyle.cs (2)
464internal XElement CreateXElement() 473internal static NamingStyle FromXElement(XElement namingStyleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\NamingStylePreferences.cs (9)
335public static NamingStylePreferences Default { get; } = FromXElement(XElement.Parse(DefaultNamingPreferencesString)); 341internal XElement CreateXElement() 350internal static NamingStylePreferences FromXElement(XElement element) 397private static XElement GetUpgradedSerializationIfNecessary(XElement rootElement) 415: XElement.Parse(DefaultNamingPreferencesString); 418private static void UpgradeSerialization_4To5(XElement rootElement) 424foreach (var element in methodElements) 426element.ReplaceWith(XElement.Parse("<MethodKind>Ordinary</MethodKind>"));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SerializableNamingRule.cs (3)
24internal XElement CreateXElement() 26var element = new XElement(nameof(SerializableNamingRule), 34internal static SerializableNamingRule FromXElement(XElement namingRuleElement)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\NamingStyles\Serialization\SymbolSpecification.cs (21)
212internal XElement CreateXElement() 241private XElement CreateSymbolKindsXElement() 243var symbolKindsElement = new XElement(nameof(ApplicableSymbolKindList)); 253private XElement CreateAccessibilitiesXElement() 255var accessibilitiesElement = new XElement(nameof(ApplicableAccessibilityList)); 265private XElement CreateModifiersXElement() 267var modifiersElement = new XElement(nameof(RequiredModifierList)); 277internal static SymbolSpecification FromXElement(XElement symbolSpecificationElement) 285private static ImmutableArray<SymbolKindOrTypeKind> GetSymbolKindListFromXElement(XElement symbolKindListElement) 288foreach (var symbolKindElement in symbolKindListElement.Elements(nameof(SymbolKind))) 293foreach (var typeKindElement in symbolKindListElement.Elements(nameof(TypeKind))) 298foreach (var methodKindElement in symbolKindListElement.Elements(nameof(MethodKind))) 306private static ImmutableArray<Accessibility> GetAccessibilityListFromXElement(XElement accessibilityListElement) 309private static Accessibility ParseAccessibility(XElement accessibilityElement) 312private static ImmutableArray<ModifierKind> GetModifierListFromXElement(XElement modifierListElement) 367internal XElement CreateXElement() 419internal static SymbolKindOrTypeKind AddSymbolKindFromXElement(XElement symbolKindElement) 432internal static SymbolKindOrTypeKind AddTypeKindFromXElement(XElement typeKindElement) 435internal static SymbolKindOrTypeKind AddMethodKindFromXElement(XElement methodKindElement) 532internal XElement CreateXElement() 535internal static ModifierKind FromXElement(XElement modifierElement)
Roslyn.Diagnostics.CSharp.Analyzers (2)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\CSharp\CodeStyle\PreferBracesPreference.cs (2)
22/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value 39/// <see cref="CodeStyleOption2{T}.FromXElement(XElement)"/>. Prior to the use of this enum, the serialized value
sdk-tasks (5)
GetDependencyInfo.cs (1)
31XElement dependency = document
OverrideAndCreateBundledNETCoreAppPackageVersion.cs (4)
72foreach (var item2 in items2Filtered) 87var item0 = matches0[0]; 167foreach (var property in LoadDownlevelRuntimePackVersions(stage2Doc)) 187private static IEnumerable<XElement> LoadDownlevelRuntimePackVersions(XDocument doc)
Shared.Tests (1)
JsonSchemaExporter\TestTypes.cs (1)
1313[JsonSerializable(typeof(XElement))]
System.ComponentModel.TypeConverter (52)
MS\Internal\Xml\Linq\ComponentModel\XComponentModel.cs (52)
44if (typeof(T) == typeof(XElement)) 144internal sealed class XElementAttributePropertyDescriptor : XPropertyDescriptor<XElement, object> 155return _value = new XDeferredSingleton<XAttribute>((e, n) => e.Attribute(n), (component as XElement)!, null); 196internal sealed class XElementDescendantsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>> 198private XDeferredAxis<XElement>? _value; 207return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Descendants(n) : e.Descendants(), (component as XElement)!, null); 218XElement? e = sender as XElement; 225e = sender as XElement; 242XElement? e = sender as XElement; 249internal sealed class XElementElementPropertyDescriptor : XPropertyDescriptor<XElement, object> 251private XDeferredSingleton<XElement>? _value; 252private XElement? _changeState; 260return _value = new XDeferredSingleton<XElement>((e, n) => e.Element(n), (component as XElement)!, null); 270XElement? e = sender as XElement; 277e = sender as XElement; 285e = sender as XElement; 310XElement? e = sender as XElement; 317internal sealed class XElementElementsPropertyDescriptor : XPropertyDescriptor<XElement, IEnumerable<XElement>> 319private XDeferredAxis<XElement>? _value; 328return _value = new XDeferredAxis<XElement>((e, n) => n != null ? e.Elements(n) : e.Elements(), (component as XElement)!, null); 338XElement? e = sender as XElement; 345e = sender as XElement; 353e = sender as XElement; 370XElement? e = sender as XElement; 374e = sender as XElement; 381internal sealed class XElementValuePropertyDescriptor : XPropertyDescriptor<XElement, string> 383private XElement? _element; 396_element = component as XElement; 404_element = component as XElement; 418if (sender is XElement || sender is XText) 433internal sealed class XElementXmlPropertyDescriptor : XPropertyDescriptor<XElement, string> 435private XElement? _element; 443_element = component as XElement; 499private readonly Func<XElement, XName?, IEnumerable<T>> _func; 500internal XElement element; 503public XDeferredAxis(Func<XElement, XName?, IEnumerable<T>> func, XElement element, XName? name) 543private readonly Func<XElement, XName, T?> _func; 544internal XElement element; 547public XDeferredSingleton(Func<XElement, XName, T?> func, XElement element, XName? name)
System.Private.CoreLib.Generators (19)
NativeRuntimeEventSourceGenerator.cs (19)
46XElement? providerNode = manifest 132private static string GenerateEventSourceClass(XElement providerNode, string className, Dictionary<string, HashSet<string>> inclusionList) 159private static void GenerateKeywordsClass(XElement providerNode, StringWriter writer, Dictionary<string, HashSet<string>> inclusionList) 168XElement eventsNode = providerNode.Element(EventNs + "events"); 174IEnumerable<XElement> eventNodes = eventsNode.Elements(EventNs + "event"); 176foreach (XElement? eventNode in eventNodes) 195XElement? keywordsNode = providerNode.Element(EventNs + "keywords"); 206foreach (XElement keywordNode in keywordsNode.Elements(EventNs + "keyword")) 222private static void GenerateEventMethods(XElement providerNode, StringWriter writer, Dictionary<string, HashSet<string>> inclusionList) 231XElement eventsNode = providerNode.Element(EventNs + "events"); 238XElement templatesNode = providerNode.Element(EventNs + "templates"); 239var templateDict = new Dictionary<string, XElement>(); 242foreach (XElement? template in templatesNode.Elements(EventNs + "template")) 254foreach (XElement? eventNode in eventNodes) 274foreach (XElement? eventNode in eventNodes) 319&& templateDict.TryGetValue(templateValue, out XElement? template)) 321IEnumerable<XElement> dataNodes = template.Elements(EventNs + "data").ToArray(); 328foreach (XElement data in dataNodes) 345foreach (XElement data in dataNodes)
System.Private.DataContractSerialization (1)
System\Runtime\Serialization\XmlDataContract.cs (1)
371if (type == typeof(System.Xml.Linq.XElement))
System.Private.Xml.Linq (610)
System\Xml\Linq\Extensions.cs (126)
16/// Returns all of the <see cref="XAttribute"/>s for each <see cref="XElement"/> of 17/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 21/// Attributes for every <see cref="XElement"/> in the target <see cref="IEnumerable"/> 22/// of <see cref="XElement"/>. 24public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source) 33/// <see cref="XElement"/>'s <see cref="XAttribute"/>s in the target <see cref="IEnumerable"/> 34/// of <see cref="XElement"/> are scanned for a matching <see cref="XName"/>. 38/// Attributes with a matching <see cref="XName"/> for every <see cref="XElement"/> in 39/// the target <see cref="IEnumerable"/> of <see cref="XElement"/>. 41public static IEnumerable<XAttribute> Attributes(this IEnumerable<XElement?> source, XName? name) 49/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 50/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this 51/// <see cref="IEnumerable"/> of <see cref="XElement"/>. 54/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 55/// and it's parent up to the root) of each of the <see cref="XElement"/>s in this 56/// <see cref="IEnumerable"/> of <see cref="XElement"/>. 58public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source) where T : XNode 66/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 68/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 71/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the ancestors (parent 73/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 75public static IEnumerable<XElement> Ancestors<T>(this IEnumerable<T?> source, XName? name) where T : XNode 79return name != null ? GetAncestors(source, name, false) : XElement.EmptySequence; 83/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 84/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root). 85/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of 86/// <see cref="XElement"/>. 89/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 90/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root). 91/// This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of 92/// <see cref="XElement"/>. 94public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source) 102/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 103/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root) 105/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 108/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 109/// <see cref="XElement"/> and it's ancestors (parent and it's parent up to the root) 111/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 113public static IEnumerable<XElement> AncestorsAndSelf(this IEnumerable<XElement?> source, XName? name) 117return name != null ? GetAncestors(source, name, true) : XElement.EmptySequence; 160/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 161/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in 162/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 165/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 166/// and their children down to the leaf level). This is done for each <see cref="XElement"/> in 167/// this <see cref="IEnumerable"/> of <see cref="XElement"/>. 169public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source) where T : XContainer 177/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 179/// for each <see cref="XElement"/> in the target <see cref="IEnumerable"/> of <see cref="XElement"/>. 182/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the descendants (children 184/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 186public static IEnumerable<XElement> Descendants<T>(this IEnumerable<T?> source, XName? name) where T : XContainer 190return name != null ? GetDescendants(source, name, false) : XElement.EmptySequence; 194/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 195/// <see cref="XElement"/> and it's descendants 197/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 200/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 201/// <see cref="XElement"/> and descendants. 203/// <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 205public static IEnumerable<XNode> DescendantNodesAndSelf(this IEnumerable<XElement?> source) 213/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 214/// <see cref="XElement"/> and it's descendants (children and children's children down 215/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> 216/// of <see cref="XElement"/>. 219/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 220/// <see cref="XElement"/> and it's descendants (children and children's children down 221/// to the leaf nodes). This is done for each <see cref="XElement"/> in this <see cref="IEnumerable"/> 222/// of <see cref="XElement"/>. 224public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source) 232/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 233/// <see cref="XElement"/> and it's descendants (children and children's children down 235/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 238/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 239/// <see cref="XElement"/> and it's descendants (children and children's children down 241/// each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 243public static IEnumerable<XElement> DescendantsAndSelf(this IEnumerable<XElement?> source, XName? name) 247return name != null ? GetDescendants(source, name, true) : XElement.EmptySequence; 251/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 252/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 255/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 256/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 258public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source) where T : XContainer 266/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 267/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 270/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 271/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 273public static IEnumerable<XElement> Elements<T>(this IEnumerable<T?> source, XName? name) where T : XContainer 277return name != null ? GetElements(source, name) : XElement.EmptySequence; 281/// Returns an <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 282/// with a matching for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 285/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the child elements 286/// for each <see cref="XElement"/> in this <see cref="IEnumerable"/> of <see cref="XElement"/>. 341private static IEnumerable<XAttribute> GetAttributes(IEnumerable<XElement?> source, XName? name) 343foreach (XElement? e in source) 360private static IEnumerable<XElement> GetAncestors<T>(IEnumerable<T?> source, XName? name, bool self) where T : XNode 366XElement? e = (self ? node : node.parent) as XElement; 370e = e.parent as XElement; 404private static IEnumerable<XElement> GetDescendants<T>(IEnumerable<T?> source, XName? name, bool self) where T : XContainer 412XElement e = (XElement)root; 429XElement? e = n as XElement; 437private static IEnumerable<XElement> GetElements<T>(IEnumerable<T?> source, XName? name) where T : XContainer 449XElement? e = n as XElement;
System\Xml\Linq\XAttribute.cs (8)
114get { return parent != null && ((XElement)parent).lastAttr != this ? next : null; } 143XAttribute a = ((XElement)parent).lastAttr!; 148return a != ((XElement)parent).lastAttr ? a : null; 183((XElement)parent).RemoveAttribute(this); 188/// <seealso cref="XElement.SetValue"/> 189/// <seealso cref="XElement.SetAttributeValue"/> 190/// <seealso cref="XElement.SetElementValue"/> 694if (parent != null) return ((XElement)parent).GetPrefixOfNamespace(ns);
System\Xml\Linq\XContainer.cs (46)
20/// <see cref="XDocument"/> and <see cref="XElement"/>. 239/// applies only for <see cref="XElement"/>. 259/// Returns the descendant <see cref="XElement"/>s of this <see cref="XContainer"/>. Note this method will 260/// not return itself in the resulting IEnumerable. See <see cref="XElement.DescendantsAndSelf()"/> if you 261/// need to include the current <see cref="XElement"/> in the results. 262/// <seealso cref="XElement.DescendantsAndSelf()"/> 265/// An IEnumerable of <see cref="XElement"/> with all of the descendants below this <see cref="XContainer"/> in the XML tree. 267public IEnumerable<XElement> Descendants() 273/// Returns the Descendant <see cref="XElement"/>s with the passed in <see cref="XName"/> as an IEnumerable 276/// <param name="name">The <see cref="XName"/> to match against descendant <see cref="XElement"/>s.</param> 277/// <returns>An <see cref="IEnumerable"/> of <see cref="XElement"/></returns> 278public IEnumerable<XElement> Descendants(XName? name) 280return name != null ? GetDescendants(name, false) : XElement.EmptySequence; 292/// An <see cref="XElement"/> child that matches the <see cref="XName"/> passed in, or null. 294public XElement? Element(XName name) 302XElement? e = n as XElement; 310/// Returns the child <see cref="XElement"/>s of this <see cref="XContainer"/>. 316/// An <see cref="IEnumerable"/> over all of this <see cref="XContainer"/>'s child <see cref="XElement"/>s. 318public IEnumerable<XElement> Elements() 327/// The <see cref="XName"/> to match against the <see cref="XElement"/> children of this <see cref="XContainer"/>. 330/// An <see cref="IEnumerable"/> of <see cref="XElement"/> children of this <see cref="XContainer"/> that have 333public IEnumerable<XElement> Elements(XName? name) 335return name != null ? GetElements(name) : XElement.EmptySequence; 341/// <seealso cref="XElement.Attributes()"/> 346/// <seealso cref="XElement.Attributes()"/> 364/// methods does not remove attributes. See <see cref="XElement.RemoveAttributes()"/>. 365/// <seealso cref="XElement.RemoveAttributes()"/> 385if (this is XElement) 554if (this is XElement) 766internal IEnumerable<XElement> GetDescendants(XName? name, bool self) 770XElement e = (XElement)this; 787XElement? e = n as XElement; 793private IEnumerable<XElement> GetElements(XName? name) 801XElement? e = n as XElement; 979XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1038XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1107XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1145XElement? e = _currentContainer as XElement; 1229XElement e = new XElement(_eCache.Get(r.NamespaceURI).GetName(r.LocalName)); 1269XElement? e = _currentContainer as XElement;
System\Xml\Linq\XDocument.cs (2)
149public XElement? Root 153return GetFirstNode<XElement>();
System\Xml\Linq\XElement.cs (257)
26/// An <see cref="XElement"/> can contain the following types of content: 29/// <item><see cref="XElement"/></item> 41public static IEnumerable<XElement> EmptySequence 45return Array.Empty<XElement>(); 106public XElement(XElement other) 162internal static async Task<XElement> CreateAsync(XmlReader r, CancellationToken cancellationToken) 164XElement xe = new XElement(default(AsyncConstructionSentry)); 170/// Outputs this <see cref="XElement"/>'s underlying XML tree. The output can 175/// Output this <see cref="XElement"/> to a file. 180/// <see cref="XElement.Save(string, SaveOptions)"/>) enabling 194/// Output this <see cref="XElement"/> to a file. 240if (n is XElement) return true; 323/// Returns this <see cref="XElement"/> and all of it's ancestors up 329/// Returns this <see cref="XElement"/> and all of it's ancestors up to 334/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of 335/// this <see cref="XElement"/>'s ancestors up to the root node (including 336/// this <see cref="XElement"/>. 338public IEnumerable<XElement> AncestorsAndSelf() 344/// Returns the ancestor(s) of this <see cref="XElement"/> with the matching 345/// <see cref="XName"/>. If this <see cref="XElement"/>'s <see cref="XName"/> 347/// resulting <see cref="IEnumerable"/> or <see cref="XElement"/>. 354/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing the 355/// ancestors of this <see cref="XElement"/> with a matching <see cref="XName"/>. 357public IEnumerable<XElement> AncestorsAndSelf(XName? name) 359return name != null ? GetAncestors(name, true) : XElement.EmptySequence; 363/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/> that has this 388/// Returns the <see cref="XAttribute"/> associated with this <see cref="XElement"/>. Optionally 392/// Returns all of the <see cref="XAttribute"/>s associated with this <see cref="XElement"/>. 397/// associated with this <see cref="XElement"/>. 405/// Returns the <see cref="XAttribute"/>(s) associated with this <see cref="XElement"/> that has the passed 407/// <seealso cref="XElement.Attributes()"/> 421/// Get the self and descendant nodes for an <see cref="XElement"/> 430/// Returns this <see cref="XElement"/> and all of it's descendants. Overloads allow 432/// of a descendant <see cref="XElement"/> to match. 435/// Returns this <see cref="XElement"/> and all of it's descendant <see cref="XElement"/>s 436/// as an <see cref="IEnumerable"/> of <see cref="XElement"/>. 437/// <seealso cref="XElement.DescendantsAndSelf()"/> 440/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing this <see cref="XElement"/> 443public IEnumerable<XElement> DescendantsAndSelf() 449/// Returns the descendants of this <see cref="XElement"/> that have a matching <see cref="XName"/> 450/// to the one passed in, including, potentially, this <see cref="XElement"/>. 451/// <seealso cref="XElement.DescendantsAndSelf(XName)"/> 454/// The <see cref="XName"/> of the descendant <see cref="XElement"/> that is being targeted. 457/// An <see cref="IEnumerable"/> of <see cref="XElement"/> containing all of the descendant 458/// <see cref="XElement"/>s that have this <see cref="XName"/>. 460public IEnumerable<XElement> DescendantsAndSelf(XName? name) 462return name != null ? GetDescendants(name, true) : XElement.EmptySequence; 466/// Returns the default <see cref="XNamespace"/> of an <see cref="XElement"/> 475/// Get the namespace associated with a particular prefix for this <see cref="XElement"/> 501XElement? e = this; 528e = e.parent as XElement; 544/// <see cref="XElement"/> and initializing it from a data source containing 550/// <seealso cref="XElement.Parse(string)"/> 553/// Create a new <see cref="XElement"/> based on the contents of the file 555/// <see cref="XElement.Parse(string)"/> to create an <see cref="XElement"/> from 558/// <seealso cref="XElement.Parse(string)"/> 567/// A URI string referencing the file to load into a new <see cref="XElement"/>. 570/// An <see cref="XElement"/> initialized with the contents of the file referenced 573public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri) 579/// Create a new <see cref="XElement"/> based on the contents of the file 592/// A string representing the URI of the file to be loaded into a new <see cref="XElement"/>. 598/// An <see cref="XElement"/> initialized with the contents of the file referenced 602public static XElement Load([StringSyntax(StringSyntaxAttribute.Uri)] string uri, LoadOptions options) 612/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 617/// created <see cref="XElement"/>. 620/// A new <see cref="XElement"/> containing the contents of the passed in 623public static XElement Load(Stream stream) 629/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 640/// created <see cref="XElement"/>. 646/// A new <see cref="XElement"/> containing the contents of the passed in 649public static XElement Load(Stream stream, LoadOptions options) 659/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 670/// created <see cref="XElement"/>. 678/// A new <see cref="XElement"/> containing the contents of the passed in 681public static async Task<XElement> LoadAsync(Stream stream, LoadOptions options, CancellationToken cancellationToken) 694/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 699/// created <see cref="XElement"/>. 702/// A new <see cref="XElement"/> containing the contents of the passed in 705public static XElement Load(TextReader textReader) 711/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 722/// created <see cref="XElement"/>. 728/// A new <see cref="XElement"/> containing the contents of the passed in 731public static XElement Load(TextReader textReader, LoadOptions options) 741/// Create a new <see cref="XElement"/> and initialize its underlying XML tree using 752/// created <see cref="XElement"/>. 760/// A new <see cref="XElement"/> containing the contents of the passed in 763public static async Task<XElement> LoadAsync(TextReader textReader, LoadOptions options, CancellationToken cancellationToken) 776/// Create a new <see cref="XElement"/> containing the contents of the 781/// <see cref="XElement"/>. 784/// A new <see cref="XElement"/> containing the contents of the passed 787public static XElement Load(XmlReader reader) 793/// Create a new <see cref="XElement"/> containing the contents of the 798/// <see cref="XElement"/>. 804/// A new <see cref="XElement"/> containing the contents of the passed 807public static XElement Load(XmlReader reader, LoadOptions options) 812XElement e = new XElement(reader, options); 819/// Create a new <see cref="XElement"/> containing the contents of the 824/// <see cref="XElement"/>. 832/// A new <see cref="XElement"/> containing the contents of the passed 835public static Task<XElement> LoadAsync(XmlReader reader, LoadOptions options, CancellationToken cancellationToken) 840return Task.FromCanceled<XElement>(cancellationToken); 844private static async Task<XElement> LoadAsyncInternal(XmlReader reader, LoadOptions options, CancellationToken cancellationToken) 848XElement e = new XElement(default(AsyncConstructionSentry)); 859/// Parses a string containing XML into an <see cref="XElement"/>. Optionally 863/// Parses a string containing XML into an <see cref="XElement"/>. 869/// A string containing the XML to parse into an <see cref="XElement"/>. 872/// An <see cref="XElement"/> created from the XML string passed in. 874public static XElement Parse(string text) 880/// Parses a string containing XML into an <see cref="XElement"/> and optionally 894/// A string containing the XML to parse into an <see cref="XElement"/>. 900/// An <see cref="XElement"/> created from the XML string passed in. 902public static XElement Parse(string text, LoadOptions options) 915/// Removes content and attributes from this <see cref="XElement"/>. 916/// <seealso cref="XElement.RemoveAttributes"/> 926/// Removes that attributes of this <see cref="XElement"/>. 927/// <seealso cref="XElement.RemoveAll"/> 928/// <seealso cref="XElement.RemoveAttributes"/> 1032/// Output this <see cref="XElement"/> to the passed in <see cref="Stream"/>. 1037/// <see cref="XElement.Save(Stream, SaveOptions)"/>) enabling 1043/// The <see cref="Stream"/> to output this <see cref="XElement"/> to. 1051/// Output this <see cref="XElement"/> to a <see cref="Stream"/>. 1070/// Output this <see cref="XElement"/> to a <see cref="Stream"/>. 1094/// Output this <see cref="XElement"/> to the passed in <see cref="TextWriter"/>. 1099/// <see cref="XElement.Save(TextWriter, SaveOptions)"/>) enabling 1105/// The <see cref="TextWriter"/> to output this <see cref="XElement"/> to. 1113/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>. 1132/// Output this <see cref="XElement"/> to a <see cref="TextWriter"/>. 1156/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>. 1171/// Output this <see cref="XElement"/> to an <see cref="XmlWriter"/>. 1201/// <seealso cref="XElement.SetElementValue"/> 1202/// <seealso cref="XElement.SetValue"/> 1241/// <seealso cref="XElement.SetAttributeValue"/> 1242/// <seealso cref="XElement.SetValue"/> 1257XElement? e = Element(name); 1278/// <seealso cref="XElement.SetAttributeValue"/> 1279/// <seealso cref="XElement.SetElementValue"/> 1296/// Write this <see cref="XElement"/> to the passed in <see cref="XmlWriter"/>. 1299/// The <see cref="XmlWriter"/> to write this <see cref="XElement"/> to. 1309/// Write this <see cref="XElement"/> to the passed in <see cref="XmlTextWriter"/>. 1312/// The <see cref="XmlTextWriter"/> to write this <see cref="XElement"/> to. 1325/// Cast the value of this <see cref="XElement"/> to a <see cref="string"/>. 1328/// If the <see cref="XElement"/> is a subtree (an <see cref="XElement"/> 1329/// that has <see cref="XElement"/> children. The concatenated string 1330/// value of all of the <see cref="XElement"/>'s text and descendants 1334/// The <see cref="XElement"/> to cast to a string. 1337/// The content of this <see cref="XElement"/> as a <see cref="string"/>. 1341public static explicit operator string?(XElement? element) 1348/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>. 1351/// The <see cref="XElement"/> to cast to <see cref="bool"/>. 1354/// The content of this <see cref="XElement"/> as a <see cref="bool"/>. 1363public static explicit operator bool(XElement element) 1371/// Cast the value of this <see cref="XElement"/> to a <see cref="bool"/>?. 1374/// The <see cref="XElement"/> to cast to <see cref="bool"/>?. 1377/// The content of this <see cref="XElement"/> as a <see cref="bool"/>?. 1384public static explicit operator bool?(XElement? element) 1391/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>. 1394/// The <see cref="XElement"/> to cast to <see cref="int"/>. 1397/// The content of this <see cref="XElement"/> as a <see cref="int"/>. 1406public static explicit operator int(XElement element) 1414/// Cast the value of this <see cref="XElement"/> to an <see cref="int"/>?. 1417/// The <see cref="XElement"/> to cast to <see cref="int"/>?. 1420/// The content of this <see cref="XElement"/> as a <see cref="int"/>?. 1427public static explicit operator int?(XElement? element) 1434/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>. 1437/// The <see cref="XElement"/> to cast to <see cref="uint"/>. 1440/// The content of this <see cref="XElement"/> as a <see cref="uint"/>. 1449public static explicit operator uint(XElement element) 1457/// Cast the value of this <see cref="XElement"/> to an <see cref="uint"/>?. 1460/// The <see cref="XElement"/> to cast to <see cref="uint"/>?. 1463/// The content of this <see cref="XElement"/> as a <see cref="uint"/>?. 1470public static explicit operator uint?(XElement? element) 1477/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>. 1480/// The <see cref="XElement"/> to cast to <see cref="long"/>. 1483/// The content of this <see cref="XElement"/> as a <see cref="long"/>. 1492public static explicit operator long(XElement element) 1500/// Cast the value of this <see cref="XElement"/> to a <see cref="long"/>?. 1503/// The <see cref="XElement"/> to cast to <see cref="long"/>?. 1506/// The content of this <see cref="XElement"/> as a <see cref="long"/>?. 1513public static explicit operator long?(XElement? element) 1520/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>. 1523/// The <see cref="XElement"/> to cast to <see cref="ulong"/>. 1526/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>. 1535public static explicit operator ulong(XElement element) 1543/// Cast the value of this <see cref="XElement"/> to an <see cref="ulong"/>?. 1546/// The <see cref="XElement"/> to cast to <see cref="ulong"/>?. 1549/// The content of this <see cref="XElement"/> as a <see cref="ulong"/>?. 1556public static explicit operator ulong?(XElement? element) 1563/// Cast the value of this <see cref="XElement"/> to a <see cref="float"/>. 1566/// The <see cref="XElement"/> to cast to <see cref="float"/>. 1569/// The content of this <see cref="XElement"/> as a <see cref="float"/>. 1578public static explicit operator float(XElement element) 1586/// Cast the value of this <see cref="XElement"/> to an <see cref="float"/>?. 1589/// The <see cref="XElement"/> to cast to <see cref="float"/>?. 1592/// The content of this <see cref="XElement"/> as a <see cref="float"/>?. 1599public static explicit operator float?(XElement? element) 1606/// Cast the value of this <see cref="XElement"/> to a <see cref="double"/>. 1609/// The <see cref="XElement"/> to cast to <see cref="double"/>. 1612/// The content of this <see cref="XElement"/> as a <see cref="double"/>. 1621public static explicit operator double(XElement element) 1629/// Cast the value of this <see cref="XElement"/> to an <see cref="double"/>?. 1632/// The <see cref="XElement"/> to cast to <see cref="double"/>?. 1635/// The content of this <see cref="XElement"/> as a <see cref="double"/>?. 1642public static explicit operator double?(XElement? element) 1649/// Cast the value of this <see cref="XElement"/> to a <see cref="decimal"/>. 1652/// The <see cref="XElement"/> to cast to <see cref="decimal"/>. 1655/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>. 1664public static explicit operator decimal(XElement element) 1672/// Cast the value of this <see cref="XElement"/> to an <see cref="decimal"/>?. 1675/// The <see cref="XElement"/> to cast to <see cref="decimal"/>?. 1678/// The content of this <see cref="XElement"/> as a <see cref="decimal"/>?. 1685public static explicit operator decimal?(XElement? element) 1692/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTime"/>. 1695/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>. 1698/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>. 1707public static explicit operator DateTime(XElement element) 1715/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTime"/>?. 1718/// The <see cref="XElement"/> to cast to <see cref="DateTime"/>?. 1721/// The content of this <see cref="XElement"/> as a <see cref="DateTime"/>?. 1728public static explicit operator DateTime?(XElement? element) 1735/// Cast the value of this <see cref="XElement"/> to a <see cref="DateTimeOffset"/>. 1738/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>. 1741/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>. 1750public static explicit operator DateTimeOffset(XElement element) 1758/// Cast the value of this <see cref="XElement"/> to an <see cref="DateTimeOffset"/>?. 1761/// The <see cref="XElement"/> to cast to <see cref="DateTimeOffset"/>?. 1764/// The content of this <see cref="XElement"/> as a <see cref="DateTimeOffset"/>?. 1771public static explicit operator DateTimeOffset?(XElement? element) 1778/// Cast the value of this <see cref="XElement"/> to a <see cref="TimeSpan"/>. 1781/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>. 1784/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>. 1793public static explicit operator TimeSpan(XElement element) 1801/// Cast the value of this <see cref="XElement"/> to an <see cref="TimeSpan"/>?. 1804/// The <see cref="XElement"/> to cast to <see cref="TimeSpan"/>?. 1807/// The content of this <see cref="XElement"/> as a <see cref="TimeSpan"/>?. 1814public static explicit operator TimeSpan?(XElement? element) 1821/// Cast the value of this <see cref="XElement"/> to a <see cref="Guid"/>. 1824/// The <see cref="XElement"/> to cast to <see cref="Guid"/>. 1827/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>. 1836public static explicit operator Guid(XElement element) 1844/// Cast the value of this <see cref="XElement"/> to an <see cref="Guid"/>?. 1847/// The <see cref="XElement"/> to cast to <see cref="Guid"/>?. 1850/// The content of this <see cref="XElement"/> as a <see cref="Guid"/>?. 1857public static explicit operator Guid?(XElement? element) 1872/// Generates a <see cref="XElement"/> from its XML representation. 1875/// The <see cref="XmlReader"/> stream from which the <see cref="XElement"/> 1888/// Converts a <see cref="XElement"/> into its XML representation. 1891/// The <see cref="XmlWriter"/> stream to which the <see cref="XElement"/> 1936private bool AttributesEqual(XElement e) 1960XElement? e = node as XElement; 1977private string? GetNamespaceOfPrefixInScope(string prefix, XElement? outOfScope) 1979XElement? e = this; 1993e = e.parent as XElement;
System\Xml\Linq\XLinq.cs (14)
45if (_parent is XElement) 206public void WriteElement(XElement e) 209XElement root = e; 213XElement? current = n as XElement; 250public async Task WriteElementAsync(XElement e, CancellationToken cancellationToken) 253XElement root = e; 257XElement? current = n as XElement; 306private void PushAncestors(XElement? e) 310e = e!.parent as XElement; 327private void PushElement(XElement e) 370private void WriteStartElement(XElement e) 389private async Task WriteStartElementAsync(XElement e, CancellationToken cancellationToken)
System\Xml\Linq\XNode.cs (22)
21/// <see cref="XElement"/>, 188public IEnumerable<XElement> Ancestors() 205public IEnumerable<XElement> Ancestors(XName? name) 207return name != null ? GetAncestors(name, false) : XElement.EmptySequence; 345public IEnumerable<XElement> ElementsAfterSelf() 359public IEnumerable<XElement> ElementsAfterSelf(XName? name) 361return name != null ? GetElementsAfterSelf(name) : XElement.EmptySequence; 371public IEnumerable<XElement> ElementsBeforeSelf() 385public IEnumerable<XElement> ElementsBeforeSelf(XName? name) 387return name != null ? GetElementsBeforeSelf(name) : XElement.EmptySequence; 498return await XElement.CreateAsync(reader, cancellationToken).ConfigureAwait(false); 591/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 627internal IEnumerable<XElement> GetAncestors(XName? name, bool self) 629XElement? e = (self ? this : parent) as XElement; 633e = e.parent as XElement; 637private IEnumerable<XElement> GetElementsAfterSelf(XName? name) 643XElement? e = n as XElement; 648private IEnumerable<XElement> GetElementsBeforeSelf(XName? name) 657XElement? e = n as XElement;
System\Xml\Linq\XNodeBuilder.cs (3)
110_parent = ((XElement)_parent!).parent; 139XElement e = (XElement)_parent!;
System\Xml\Linq\XNodeEqualityComparer.cs (2)
28/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same 67/// <see cref="XElement"/> nodes are equal if they have the same tag name, the same
System\Xml\Linq\XNodeReader.cs (64)
45XElement? e = GetElementInAttributeScope(); 133XElement? e = GetElementInAttributeScope(); 188XElement? e = _source as XElement; 204XElement? e = _source as XElement; 251XElement? e = _source as XElement; 319XElement? e = _source as XElement; 396XElement? e = GetElementInScope(); 407e = e.parent as XElement; 422XElement? e = GetElementInScope(); 441e = e.parent as XElement; 470XElement? e = GetElementInAttributeScope(); 516XElement? e = GetElementInAttributeScope(); 562XElement? e = GetElementInAttributeScope(); 594XElement? e = GetElementInScope(); 612XElement? e = GetElementInAttributeScope(); 650XElement? e = GetElementInAttributeScope(); 698XElement? e = GetElementInAttributeScope(); 752XElement? e = GetElementInAttributeScope(); 782XElement? e = _source as XElement; 818if (a.parent != null && ((XElement)a.parent).lastAttr != a) 883XElement? c = _source as XElement; 890foreach (XElement e in c.Descendants()) 908XElement? e = _source as XElement; 933foreach (XElement e in n.ElementsAfterSelf()) 943if (n.parent is XElement) 952if (_parent is XElement) 983XElement? e = _source as XElement; 1008XElement? e = _source as XElement; 1038XElement? e = _source as XElement; 1080private XElement? GetElementInAttributeScope() 1082XElement? e = _source as XElement; 1094return (XElement?)a.parent; 1099return (XElement?)a.parent; 1104private XElement? GetElementInScope() 1106XElement? e = _source as XElement; 1114return n.parent as XElement; 1119return (XElement?)a.parent; 1121e = _parent as XElement; 1129return (XElement?)a.parent; 1134private static void GetNameInAttributeScope(string? qualifiedName, XElement e, out string? localName, out string? namespaceName) 1162XElement? e = _source as XElement; 1205private bool ReadIntoElement(XElement e) 1240XElement? e = (XElement?)a.parent; 1278if (_parent is XElement) 1333XElement? element = candidateAttribute.parent as XElement; 1339element = element.parent as XElement; 1374element = element.parent as XElement; 1392XElement? e = candidate.parent as XElement;
System\Xml\Linq\XObject.cs (4)
66/// Gets the parent <see cref="XElement"/> of this <see cref="XObject"/>. 69/// If this <see cref="XObject"/> has no parent <see cref="XElement"/>, this property returns null. 71public XElement? Parent 73get { return parent as XElement; }
System\Xml\Schema\XNodeValidator.cs (16)
83ValidateElement((XElement)source); 171private void PushAncestorsAndSelf(XElement? e) 195e = e.parent as XElement; 199private void PushElement(XElement e, ref string? xsiType, ref string? xsiNil) 259private void ValidateAttributes(XElement e) 296private void ValidateElement(XElement e) 322private void ValidateNodes(XElement e) 331XElement? c = n as XElement; 435/// Gets the schema information that has been assigned to the <see cref="XElement"/> as a result of schema validation. 438public static IXmlSchemaInfo? GetSchemaInfo(this XElement source) 489/// Validate a <see cref="XElement"/> 499public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler) 505/// Validate a <see cref="XElement"/> 515/// <param name="addSchemaInfo">If enabled the <see cref="XElement"/> and the corresponding 518public static void Validate(this XElement source, XmlSchemaObject partialValidationType, XmlSchemaSet schemas, ValidationEventHandler? validationEventHandler, bool addSchemaInfo)
System\Xml\XPath\XNodeNavigator.cs (46)
47private XElement? _parent; 84XElement? element = _source as XElement; 122XElement? e = _source as XElement; 134XElement? e = _source as XElement; 176XElement? e = _source as XElement; 232XElement? e = _source as XElement; 275return ((XElement)_source).Value; 279XElement? root = ((XDocument)_source).Root; 325XElement? e = _source as XElement; 347foreach (XElement element in c.Elements()) 384XElement? e = _source as XElement; 418XElement? e = _source as XElement; 456XElement? e = _source as XElement; 523foreach (XElement element in currentNode.ElementsAfterSelf()) 573XElement? e = (XElement?)currentAttribute.GetParent(); 750if (c.GetParent() != null || c is XElement) 772private static XAttribute? GetFirstNamespaceDeclarationGlobal(XElement e) 774XElement? ce = e; 787private static XAttribute? GetFirstNamespaceDeclarationLocal(XElement e) 801XElement? e = (XElement?)a.GetParent(); 821XElement? e = a.Parent; 848private static bool HasNamespaceDeclarationInScope(XAttribute a, XElement e) 851XElement? ce = e; 966/// Select an <see cref="XElement"/> using a XPath expression 970/// <returns>An <see cref="XElement"> or null</see></returns> 971public static XElement? XPathSelectElement(this XNode node, string expression) 977/// Select an <see cref="XElement"/> using a XPath expression 983/// <returns>An <see cref="XElement"> or null</see></returns> 984public static XElement? XPathSelectElement(this XNode node, string expression, IXmlNamespaceResolver? resolver) 990/// Select a set of <see cref="XElement"/> using a XPath expression 995public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression) 1001/// Select a set of <see cref="XElement"/> using a XPath expression 1008public static IEnumerable<XElement> XPathSelectElements(this XNode node, string expression, IXmlNamespaceResolver? resolver) 1012return (IEnumerable<XElement>)XPathEvaluator.Evaluate<XElement>(node, expression, resolver);
System.Xml.Linq (1)
System.Xml.Linq.cs (1)
15[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]
System.Xml.XDocument (1)
src\runtime\artifacts\obj\System.Xml.XDocument\Release\net11.0\System.Xml.XDocument.Forwards.cs (1)
14[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Xml.Linq.XElement))]