112 references to new
Aspire.Hosting (14)
ApplicationModel\EndpointReference.cs (8)
365EndpointProperty.Scheme => new(Endpoint.Scheme), 368EndpointProperty.TargetPort when Endpoint.TargetPort is int port => new(port.ToString(CultureInfo.InvariantCulture)), 378EndpointProperty.Url => new(allocatedEndpoint.UriString), 379EndpointProperty.Host => new(allocatedEndpoint.Address), 380EndpointProperty.IPV4Host => new(allocatedEndpoint.Address), 381EndpointProperty.Port => new(allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)), 382EndpointProperty.TargetPort => new(ComputeTargetPort(allocatedEndpoint)), 383EndpointProperty.HostAndPort => new($"{allocatedEndpoint.Address}:{allocatedEndpoint.Port.ToString(CultureInfo.InvariantCulture)}"),
ApplicationModel\HostUrl.cs (2)
35return new(Url); 126return new(retval);
Dcp\ContainerCreator.cs (2)
503Contents = new string(publicCertificatePem), 522Contents = new string([.. keyPem, '\n', .. publicCertificatePem]),
Dcp\ExecutableConfigurationResolver.cs (1)
135new([.. keyPem, '\n', .. publicCertificatePem]));
src\Shared\PasswordGenerator.cs (1)
56var result = new string(chars);
Aspire.Hosting.Azure (1)
AzureProvisioningController.cs (1)
3232return index == 0 ? location : new string(buffer[..index]);
Aspire.Hosting.Kubernetes (1)
KubernetesResource.cs (1)
387Commands.Add(new(str));
Aspire.Hosting.RemoteHost (1)
AtsCapabilityScanner.cs (1)
354var sanitizedPrefix = new string([.. prefix.Where(character => char.IsAsciiLetterOrDigit(character) || character == '_')]);
Aspire.Playground.Tests (1)
src\Shared\PasswordGenerator.cs (1)
56var result = new string(chars);
GenerateDocumentationAndConfigFiles (1)
src\a1065d420d446521\NamingStylePreferencesEditorConfigSerializer.cs (1)
155return new string([.. name
ILAssembler (1)
GrammarVisitor.cs (1)
4299str = new string(MemoryMarshal.Cast<byte, char>(utf8Bytes));
ILCompiler.Compiler (1)
Compiler\TypePreinit.cs (1)
3482return new string(MemoryMarshal.Cast<byte, char>(
Microsoft.AspNetCore.Components (1)
src\aspnetcore\src\Http\Routing\src\Patterns\RoutePatternMatcher.cs (1)
474outValues.Add(parameterNeedsValue.Name, new string(parameterValueSpan));
Microsoft.AspNetCore.Components.Forms (1)
src\aspnetcore\src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (1)
112? new(_currentBuffer[_nextEndIndex..])
Microsoft.AspNetCore.Components.Web (1)
src\aspnetcore\src\Components\Shared\src\ExpressionFormatting\ReverseStringBuilder.cs (1)
112? new(_currentBuffer[_nextEndIndex..])
Microsoft.AspNetCore.HttpLogging (1)
BufferingStream.cs (1)
85return new string(bufferWriter.WrittenSpan);
Microsoft.AspNetCore.Routing (1)
Patterns\RoutePatternMatcher.cs (1)
474outValues.Add(parameterNeedsValue.Name, new string(parameterValueSpan));
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
RedisHubLifetimeManager.cs (1)
829return new string(base64[..^2]);
Microsoft.Build (2)
Logging\TerminalLogger\TerminalLogger.cs (2)
944Uri.TryCreate(new(Path.GetDirectoryName(outputPathSpan)), UriKind.Absolute, out Uri? uri); 985return (new(projectDisplayPathSpan), uri);
Microsoft.CodeAnalysis.Workspaces (2)
src\a1065d420d446521\NamingStylePreferencesEditorConfigSerializer.cs (1)
155return new string([.. name
Workspace\Host\PersistentStorage\IPersistentStorageConfiguration.cs (1)
95val = new string([.. val.Where(c => !s_invalidPathChars.Contains(c))]);
Microsoft.Diagnostics.DataContractReader.Contracts (1)
Contracts\Object_1.cs (1)
61return new string(MemoryMarshal.Cast<byte, char>(span));
Microsoft.Extensions.Caching.Hybrid.Tests (1)
TagSetTests.cs (1)
178return new string(chars);
Microsoft.Extensions.Diagnostics.ResourceMonitoring (34)
Linux\LinuxUtilizationParserCgroupV1.cs (14)
113Throw.InvalidOperationException($"Could not get cpu usage from '{_cpuacctUsage}'. Expected positive number, but got '{new string(usage)}'."); 133Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'."); 150$"'{_procStat}' should contain whitespace separated values according to POSIX. We've failed trying to get {i}th value. File content: '{new string(stat)}'."); 199Throw.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead."); 228Throw.InvalidOperationException($"The value of total_inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'."); 242$"We tried to read '{_memoryUsageInBytes}', and we expected to get a positive number but instead it was: '{new string(containerMemoryUsageFile)}'."); 268Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead."); 277Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'."); 282Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'."); 295$"We tried to convert total memory usage value from '{_memInfo}' to bytes, but we've got a unit that we don't recognize: '{new string(unit)}'.") 368$"Could not parse '{_cpuSetCpus}'. Expected comma-separated list of integers, with dashes (\"-\") based ranges (\"0\", \"2-6,12\") but got '{new string(content)}'."); 426Throw.InvalidOperationException($"Could not parse '{_cpuCfsQuotaUs}'. Expected an integer but got: '{new string(quotaBuffer)}'."); 444Throw.InvalidOperationException($"Could not parse '{_cpuCfsPeriodUs}'. Expected to get an integer but got: '{new string(periodBuffer)}'."); 474Throw.InvalidOperationException($"Could not parse '{_cpuPodWeight}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead.");
Linux\LinuxUtilizationParserCgroupV2.cs (20)
179Throw.InvalidOperationException($"Expected proc/stat to start with '{StartingTokens}' but it was '{new string(bufferWriter.Buffer.WrittenSpan)}'."); 196$"'{_procStat}' should contain whitespace separated values according to POSIX. We've failed trying to get {i}th value. File content: '{new string(stat)}'."); 300Throw.InvalidOperationException($"Could not parse '{_memoryLimitInBytes}' content. Expected to find available memory in bytes but got '{new string(memoryBuffer)}' instead."); 377Throw.InvalidOperationException($"The value of inactive_file found in '{_memoryStat}' is not a positive number: '{new string(inactiveMemorySlice)}'."); 412Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected first line of the file to start with '{MemTotal}' but it was '{new string(firstLine)}' instead."); 421Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get total memory usage on first line but we've got: '{new string(firstLine)}'."); 426Throw.InvalidOperationException($"Could not parse '{_memInfo}'. We expected to get memory usage followed by the unit (kB, MB, GB) but found no unit: '{new string(firstLine)}'."); 439$"We tried to convert total memory usage value from '{_memInfo}' to bytes, but we've got a unit that we don't recognize: '{new string(unit)}'.") 512$"Could not parse '{_cpuSetCpus}'. Expected comma-separated list of integers, with dashes (\"-\") based ranges (\"0\", \"2-6,12\") but got '{new string(content)}'."); 529Throw.InvalidOperationException($"Could not parse '{memoryMinFile}' content. Expected to find memory minimum in bytes but got '{new string(memoryMinBuffer)}' instead."); 550Throw.InvalidOperationException($"Could not parse '{memoryLowFile}' content. Expected to find memory low in bytes but got '{new string(memoryLowBuffer)}' instead."); 581Throw.InvalidOperationException($"Could not get usage_usec from '{cpuUsageFile}'. Expected positive number, but got '{new string(content.Slice(usageIndex))}'."); 596Throw.InvalidOperationException($"Could not get nr_periods from '{cpuUsageFile}'. Expected positive number, but got '{new string(content.Slice(periodsIndex))}'."); 687Throw.InvalidOperationException($"Could not parse '{cpuLimitsFile}'. Expected an integer but got: '{new string(quotaBuffer)}'."); 697Throw.InvalidOperationException($"Could not parse '{cpuLimitsFile}'. Expected to get an integer but got: '{new string(cpuPeriodSlice)}'."); 726Throw.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after 'max' but got: '{new string(content)}'."); 741Throw.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after '-1' but got: '{new string(content)}'."); 753Throw.InvalidOperationException($"Could not parse quota value from '{cpuLimitsFile}'. Expected an integer but got: '{new string(content)}'."); 766Throw.InvalidOperationException($"Could not parse period value from '{cpuLimitsFile}'. Expected an integer after quota but got: '{new string(content)}'."); 807$"Could not parse '{cpuWeightFile}' content. Expected to find CPU weight but got '{new string(cpuPodWeightBuffer)}' instead.");
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (2)
Linux\OSFileSystemTests.cs (2)
39var s = new string(bw.WrittenSpan).Replace("\r", ""); // Git is overwriting LF to CRLF all the time for windows, I am so tired of it I am hacking it!! 53var s = new string(bw.WrittenSpan).Replace("\r", ""); // Git is overwriting LF to CRLF all the time for windows, I am so tired of it I am hacking it!!
Microsoft.Win32.Registry (1)
Microsoft\Win32\RegistryKey.cs (1)
792names[cpt++] = new string(nameSpan.Slice(0, nameLength));
NuGet.Packaging (1)
Signing\TrustStore\CertificateBundleX509ChainFactory.cs (1)
121return new string(pem.Span);
PresentationCore (3)
MS\Internal\TextFormatting\NumberSubstitution.cs (1)
504digits[i] = new string(twoChars);
System\Windows\Input\TextCompositionManager.cs (1)
414return new string(outputChars.Slice(0, charsWritten));
System\Windows\Media\Imaging\PropVariant.cs (1)
339pszVal = Marshal.StringToCoTaskMemAnsi(new String(stackalloc char[] { (char)value }));
PresentationFramework (2)
MS\Internal\Globalization\BamlResourceContent.cs (1)
100return returnNewInstance ? new string(contentSpan) : null;
MS\Internal\PtsHost\ListMarkerSourceInfo.cs (1)
163return new string(stackalloc char[2] // digit + suffix
System.Data.Odbc (3)
System\Data\Odbc\OdbcHandle.cs (3)
191sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 211sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 217messageBuilder.Append(new string(message.AsSpan(0, message.AsSpan().IndexOf('\0'))));
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Activity.GenerateRootId.netcoreapp.cs (1)
22return new string(result.Slice(0, 1 + charsWritten + s_uniqSuffix.Length));
System.Net.Http (2)
System\Net\Http\Headers\AltSvcHeaderParser.cs (2)
247result = new string(value); 350result = value.Length != 0 ? new string(value) : null;
System.Net.NameResolution (1)
System\Net\DnsEncodedName.cs (1)
367return new string(chars[..charsWritten]);
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\PhysicalAddress.cs (1)
81throw new FormatException(SR.Format(SR.net_bad_mac_address, new string(address)));
System.Net.Primitives (1)
System\Net\IPAddress.cs (1)
469_toString = toString = new string(span.Slice(0, length));
System.Numerics.Tensors (2)
System\Buffers\NIndex.cs (1)
181return new string(span.Slice(0, charsWritten + 1));
System\Buffers\NRange.cs (1)
88return new string(span.Slice(0, pos));
System.Private.DataContractSerialization (3)
System\Runtime\Serialization\Json\XmlJsonWriter.cs (1)
957WriteString(new string([highChar, lowChar]));
System\Xml\ValueHandle.cs (1)
868return new string([surrogate.HighChar, surrogate.LowChar]);
System\Xml\XmlBaseWriter.cs (1)
1129WriteAttributeText(new string([highChar, lowChar]));
System.Private.Uri (3)
System\IPv4AddressHelper.cs (1)
42return new string(stackSpace.Slice(0, totalChars + charsWritten));
System\IPv6AddressHelper.cs (1)
87return new string(stackSpace.Slice(0, pos));
System\Uri.cs (1)
2504info.MoreInfo.ScopeId = new string(scopeIdSpan);
System.Private.Xml (9)
System\Xml\BinaryXml\SqlUtils.cs (1)
241return new string(szResult);
System\Xml\Cache\XPathDocumentBuilder.cs (1)
428WriteString(new string([highChar, lowChar]), TextBlockType.Text);
System\Xml\Core\XmlRawWriter.cs (1)
155WriteString(new string([lowChar, highChar]));
System\Xml\Core\XmlRawWriterAsync.cs (1)
120return WriteStringAsync(new string([lowChar, highChar]));
System\Xml\Dom\DocumentXmlWriter.cs (1)
338WriteString(new string([highCh, lowCh]));
System\Xml\Serialization\XmlSerializationReader.cs (2)
1026throw new ArgumentException(SR.Format(SR.XmlInvalidArrayLength, new string(lengthStringSpan)), nameof(value)); 1052soapArrayInfo.qname = new string(value.AsSpan(0, pos + 1));
System\Xml\XmlException.cs (1)
242aStringList[0] = new string([invChar, nextChar]);
System\Xml\Xsl\Xslt\XsltLoader.cs (1)
998DecimalFormatDecl format = new DecimalFormatDecl(name, infinity, nan, new string(characters));
System.Private.Xml.Linq (1)
System\Xml\Linq\XNodeBuilder.cs (1)
193AddString(new string([highCh, lowCh]));
System.Runtime.Numerics (1)
System\Number.BigInteger.cs (1)
1030return new string(Unsafe.BitCast<ReadOnlySpan<TChar>, ReadOnlySpan<char>>(value));
System.Security.Cryptography (5)
System\Security\Cryptography\CapiHelper.Windows.cs (1)
101string providerNameString = new string(providerName.AsSpan(0, providerName.AsSpan().IndexOf('\0')));
System\Security\Cryptography\X509Certificates\CertificatePal.Windows.cs (1)
308return new string(buffer.Slice(0, ((int)cbData / 2) - 1));
System\Security\Cryptography\X509Certificates\WindowsInterop.crypt32.cs (1)
41return new string(buffer.Slice(0, cchCount - 1));
System\Security\Cryptography\X509Certificates\X509Pal.Windows.X500DistinguishedName.cs (2)
38return new string(buffer.Slice(0, cchDecoded - 1)); 101return new string(buffer.Slice(0, (cbFormat / 2) - 1));
System.Windows.Forms (2)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (1)
1547string letter = new([keyChar]);
System\Windows\Forms\Screen.cs (1)
78_deviceName = new string(info.szDevice.ToString());
System.Windows.Forms.Design (1)
System\ComponentModel\Design\ByteViewer.cs (1)
415_edit.Text = new string(text);