417 references to AsMemory
aspire (1)
Templating\CliTemplateFactory.cs (1)
212await writer.WriteAsync(transformedContent.AsMemory(), cancellationToken);
Aspire.Hosting (1)
Devcontainers\DevcontainerSettingsWriter.cs (1)
257await writer.WriteAsync("{}".AsMemory(), cancellationToken).ConfigureAwait(false);
GenerateDocumentationAndConfigFiles (11)
Program.cs (11)
277await Console.Error.WriteLineAsync($"'{path}' does not exist".AsMemory(), cancellationToken).ConfigureAwait(false); 378await Console.Out.WriteLineAsync($"Failed to create analyzer rules missing documentation file. Http response timed out".AsMemory(), cancellationToken).ConfigureAwait(false); 384await Console.Error.WriteLineAsync("One or more auto-generated documentation files were either edited manually, or not updated. Please revert changes made to the following files (if manually edited) and run `dotnet msbuild /t:pack` at the root of the repo to automatically update them:".AsMemory(), cancellationToken).ConfigureAwait(false); 821await Console.Error.WriteLineAsync($"Missing entry in {fileWithPath}".AsMemory(), cancellationToken).ConfigureAwait(false); 822await Console.Error.WriteLineAsync(line.AsMemory(), cancellationToken).ConfigureAwait(false); 877await Console.Error.WriteLineAsync($"'{assemblyPath}' does not exist".AsMemory(), cancellationToken).ConfigureAwait(false); 889await Console.Error.WriteLineAsync(ex.Message.AsMemory(), cancellationToken).ConfigureAwait(false); 915await Console.Error.WriteLineAsync($"Expected both '{shippedFile}' and '{unshippedFile}' to exist or not exist, but '{existingFile}' exists and '{nonExistingFile}' does not exist.".AsMemory(), cancellationToken).ConfigureAwait(false); 925await Console.Error.WriteLineAsync($"'{shippedFile}' exists but was not expected".AsMemory(), cancellationToken).ConfigureAwait(false); 954await Console.Error.WriteLineAsync(ex.Message.AsMemory(), cancellationToken).ConfigureAwait(false); 962await Console.Error.WriteLineAsync($"Could not find any 'AnalyzerReleases.Shipped.md' file".AsMemory(), cancellationToken).ConfigureAwait(false);
Microsoft.AspNetCore.Components (3)
NavigationManagerExtensions.cs (1)
711parameterSources.Add(parameterSource.EncodedName.AsMemory(), parameterSource);
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
41var values = _queryParameterValuesByName.GetValueOrDefault(queryParameterName.AsMemory());
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
37: this(queryString.AsMemory())
Microsoft.AspNetCore.Components.Endpoints (1)
FormMapping\HttpContextFormValueMapper.cs (1)
128dictionary.Add(new FormKey(key.AsMemory()), value);
Microsoft.AspNetCore.Components.QuickGrid (2)
src\aspnetcore\src\Components\Shared\src\QueryParameterValueSupplier.cs (1)
41var values = _queryParameterValuesByName.GetValueOrDefault(queryParameterName.AsMemory());
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
37: this(queryString.AsMemory())
Microsoft.AspNetCore.Http.Connections.Client (1)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
37: this(queryString.AsMemory())
Microsoft.AspNetCore.Http.Extensions (1)
RequestDelegateFactory.cs (1)
2309dictionary.Add(new FormKey(key.AsMemory()), value);
Microsoft.AspNetCore.HttpLogging (1)
FileLoggerProcessor.cs (1)
266await streamWriter.WriteLineAsync(message.AsMemory(), cancellationToken);
Microsoft.AspNetCore.Razor.Utilities.Shared (2)
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\MemoryBuilderExtensions.cs (1)
12builder.Append(value.AsMemory());
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\StringExtensions.cs (1)
295=> text is not null ? text.AsMemory() : default;
Microsoft.AspNetCore.WebUtilities (1)
src\aspnetcore\src\Shared\QueryStringEnumerable.cs (1)
37: this(queryString.AsMemory())
Microsoft.Build (7)
Evaluation\Expander.Function.cs (2)
848ReadOnlyMemory<char> argumentsContent = expressionFunction.AsMemory().Slice(1, indexerEndIndex - 1); 934ReadOnlyMemory<char> argumentsContent = expressionFunction.AsMemory().Slice(argumentStartIndex, argumentsEndIndex - argumentStartIndex);
Evaluation\Expander.ItemExpander.cs (1)
136arguments = ExtractFunctionArguments(elementLocation, argumentsExpression, argumentsExpression.AsMemory());
Logging\TerminalLogger\TerminalLogger.cs (4)
862(string? projectDisplayPath, var urlLink) = DetermineOutputPathToRender(outputPathSpan, _initialWorkingDirectory.AsMemory(), project.SourceRoot); 1139project.OutputPath = output.ItemSpec.AsMemory(); 1152?.ItemSpec.AsMemory(); 1218ReadOnlyMemory<char> outputPath = e.Message.AsMemory().Slice(index + 4);
Microsoft.Build.Framework (1)
FileUtilities.cs (1)
775return shouldAdjust ? newValue.ToString().AsMemory() : value;
Microsoft.CodeAnalysis (22)
CommandLine\AnalyzerConfigSet.cs (2)
412ReadOnlyMemory<char> idSlice = key.AsMemory().Slice(diagnosticOptionPrefix.Length, diagIdLength); 423diagId = diagIdCache.GetOrAdd(diagId.AsMemory(), diagId);
CommandLine\CommandLineParser.cs (7)
173name = arg.AsMemory(); 200var argMemory = arg.AsMemory(); 930? RemoveQuotesAndSlashes(arg.AsMemory()) 976return pool.ToStringAndFree().AsMemory(); 1064ParseSeparatedPathsEx(arg.AsMemory(), builder); 1138ReadOnlyMemory<char> extension = PathUtilities.GetExtension(resolvedPath.AsMemory()); 1202ParseSeparatedFileArgument(value.AsMemory(), baseDirectory, builder, errors);
MetadataReader\MetadataHelpers.cs (9)
569var emittedTypeNameMemory = emittedTypeName.AsMemory(); 610private static readonly ImmutableArray<ReadOnlyMemory<char>> s_splitQualifiedNameSystemMemory = ImmutableArray.Create(SystemString.AsMemory()); 613=> SplitQualifiedNameWorker(name.AsMemory(), s_splitQualifiedNameSystem, static memory => memory.ToString()); 656result.Add(convert(SystemString.AsMemory())); 718qualifier = string.Empty.AsMemory(); 719return pstrName.AsMemory(); 724qualifier = SystemString.AsMemory(); 728qualifier = pstrName.AsMemory()[..delimiter]; 731return pstrName.AsMemory()[(delimiter + 1)..];
MetadataReader\MetadataTypeName.cs (4)
137name._namespaceNameMemory = namespaceName.AsMemory(); 139name._typeNameMemory = typeName.AsMemory(); 165name._namespaceNameMemory = string.Empty.AsMemory(); 167name._typeNameMemory = typeName.AsMemory();
Microsoft.CodeAnalysis.CSharp (27)
CommandLine\CSharpCommandLineParser.cs (4)
177ParseFileArgument(arg.AsMemory(), baseDirectory, filePathBuilder, diagnostics); 1370ParseSeparatedFileArgument(value.AsMemory(), baseDirectory, filePathBuilder, diagnostics); 1454ParseAndResolveReferencePaths(null, additionalReferenceDirectories.AsMemory(), baseDirectory, libPaths, MessageID.IDS_LIB_ENV, diagnostics); 1784ParseConditionalCompilationSymbols(value.AsMemory(), builder, out diagnostics);
Symbols\MergedNamespaceSymbol.cs (1)
183childNames.Add(child.Name.AsMemory());
Symbols\Metadata\PE\PENamedTypeSymbol.cs (2)
1966if (_lazyNestedTypes.TryGetValue(name.AsMemory(), out t)) 2706return symbols.ToDictionary(s => s.Name.AsMemory(), ReadOnlyMemoryOfCharComparer.Instance);
Symbols\Metadata\PE\PENamespaceSymbol.cs (2)
267namespaces.Add(c.Name.AsMemory(), c); 315var typesDict = children.ToDictionary(c => c.Name.AsMemory(), ReadOnlyMemoryOfCharComparer.Instance);
Symbols\NamespaceOrTypeSymbol.cs (2)
162=> GetTypeMembers(name.AsMemory()); 171=> GetTypeMembers(name.AsMemory(), arity);
Symbols\NamespaceSymbol.cs (2)
268=> GetNestedNamespace(name.AsMemory()); 288=> GetMembers(name.AsMemory());
Symbols\Source\SourceMemberContainerSymbol.cs (13)
1486symbols.ToDictionary(s => s.Name.AsMemory(), ReadOnlyMemoryOfCharComparer.Instance) : 1627if (GetMembersByName().TryGetValue(name.AsMemory(), out members)) 1708return GetEarlyAttributeDecodingMembersDictionary().TryGetValue(name.AsMemory(), out result) ? result : ImmutableArray<Symbol>.Empty; 1754{ symbol.Name.AsMemory(), ImmutableArray.Create(symbol) }, 1771ImmutableArrayExtensions.AddToMultiValueDictionaryBuilder(accumulator, item.Name.AsMemory(), item); 2525if (membersByName.ContainsKey(indexerName.AsMemory())) 2529Debug.Assert(!membersByName[indexerName.AsMemory()].Any(SymbolExtensions.IsIndexer)); 2964if (membersByName.TryGetValue(operatorName1.AsMemory(), out ImmutableArray<Symbol> candidates)) 3762(member.IsIndexer() ? WellKnownMemberNames.Indexer : member.Name).AsMemory(), 4201Debug.Assert(pair.Key.Equals(WellKnownMemberNames.InstanceConstructorName.AsMemory())); 4569foreach (var symbol in membersByName.TryGetValue(accessorName.AsMemory(), out var members) ? members : []) 4608foreach (var symbol in membersByName.TryGetValue(accessorName.AsMemory(), out var members) ? members : []) 5490if (memberNames.Contains(symbol.Name) || this.GetTypeMembersDictionary().ContainsKey(symbol.Name.AsMemory()))
Symbols\Source\SourceNamespaceSymbol.cs (1)
279ImmutableArrayExtensions.AddToMultiValueDictionaryBuilder(builder, symbol.Name.AsMemory(), symbol);
Microsoft.CodeAnalysis.CSharp.CodeStyle (3)
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (3)
24return commentTrivia.ToFullString().AsMemory()[2..]; 35return triviaString.AsMemory()[startIndex..]; 38return triviaString.AsMemory()[startIndex..endIndex];
Microsoft.CodeAnalysis.CSharp.Features (3)
src\roslyn\src\Analyzers\CSharp\Analyzers\FileHeaders\CSharpFileHeaderHelper.cs (3)
24return commentTrivia.ToFullString().AsMemory()[2..]; 35return triviaString.AsMemory()[startIndex..]; 38return triviaString.AsMemory()[startIndex..endIndex];
Microsoft.CodeAnalysis.Features (4)
InlineHints\AbstractInlineParameterNameHintsService.cs (3)
180prefix = name.AsMemory()[..^1]; 196prefix = name.AsMemory()[..^1]; 261suffix = nameValue.AsMemory()[prefix.Length..];
MetadataAsSource\AbstractMetadataAsSourceService.DocCommentFormatter.cs (1)
160var split = Split(rawText.AsMemory(), "\r\n".AsSpan());
Microsoft.CodeAnalysis.Razor.Compiler (47)
Language\CodeGeneration\CodeWriter.cs (3)
206return WriteCore(value.AsMemory()); 291=> WriteCore(_newLine.AsMemory(), allowIndent: false); 300return WriteCore(value.AsMemory()).WriteLine();
Language\CodeGeneration\CodeWriter.IndentCache.cs (4)
15private static readonly ReadOnlyMemory<char> s_tabs = new string('\t', MaxTabCount).AsMemory(); 16private static readonly ReadOnlyMemory<char> s_spaces = new string(' ', MaxSpaceCount).AsMemory(); 37}).AsMemory(); 44: new string(chars.Span[0], length).AsMemory();
Language\CodeGeneration\CodeWriterExtensions.cs (6)
18private static readonly ReadOnlyMemory<char> s_true = "true".AsMemory(); 19private static readonly ReadOnlyMemory<char> s_false = "false".AsMemory(); 21private static readonly ReadOnlyMemory<char> s_zeroes = "0000000000".AsMemory(); // 10 zeros 46array[i] = i.ToString(CultureInfo.InvariantCulture).AsMemory(); 269=> writer.WriteStringLiteral(literal.AsMemory(), utf8); 352var filePathMemory = filePath.AsMemory();
Language\CodeGeneration\IntermediateNodeWriter.cs (1)
311var htmlContent = token.Content.AsMemory();
Language\Components\ComponentMarkupEncodingPass.cs (2)
134if (TryDecodeHtmlEntities(token.Content.AsMemory(), out var decoded)) 190builder.Append(replacement.AsMemory());
Language\Components\ComponentNodeWriter.cs (1)
1417if (ComponentAttributeIntermediateNode.TryGetEventCallbackArgument(typeName.AsMemory(), out var argument))
Language\Components\TypeNameHelper.cs (21)
16"bool".AsMemory(), 17"int".AsMemory(), 18"string".AsMemory(), 19"float".AsMemory(), 20"double".AsMemory(), 21"decimal".AsMemory(), 22"byte".AsMemory(), 23"short".AsMemory(), 24"long".AsMemory(), 25"char".AsMemory(), 26"object".AsMemory(), 27"dynamic".AsMemory(), 28"uint".AsMemory(), 29"ushort".AsMemory(), 30"ulong".AsMemory(), 31"sbyte".AsMemory(), 32"nint".AsMemory(), 33"nuint".AsMemory(), 63if (PredefinedTypeNames.Contains(typeName.AsMemory())) 78WriteGloballyQualifiedName(codeWriter, typeName.AsMemory()); 130var memory = typeName.AsMemory();
Language\DefaultRazorTagHelperContextDiscoveryPhase.cs (2)
67var mem = s.AsMemory(); 449var typeNamespace = component.TypeNamespace.AsMemory();
Language\Extensions\DefaultTagHelperTargetExtension.cs (1)
516var dictionaryKey = node.AttributeName.AsMemory()[node.BoundAttribute.IndexerNamePrefix.Length..];
Language\Intermediate\ComponentAttributeIntermediateNode.cs (1)
213return TryGetEventCallbackArgument(TypeName.AsMemory(), out argument);
Language\RazorHtmlWriter.cs (4)
17private static ReadOnlyMemory<char> Tildes => "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~".AsMemory(); // 32 '~' characters 18private static ReadOnlyMemory<char> CommentStart => "/*".AsMemory(); 19private static ReadOnlyMemory<char> CommentEnd => "*/".AsMemory(); 231var content = token.Content.AsMemory();
Language\RazorProjectFileSystem.cs (1)
108var pathMemory = path.AsMemory();
Microsoft.CodeAnalysis.Workspaces (3)
FindSymbols\FindReferences\Finders\AbstractReferenceFinder_GlobalSuppressions.cs (3)
269prefix = docCommentId.AsMemory()[0..3]; 276prefix = docCommentId.AsMemory()[0..2]; 290id = docCommentId.AsMemory()[prefix.Length..];
Microsoft.Data.Analysis (2)
DataFrameColumns\ArrowStringDataFrameColumn.cs (1)
594(ref ReadOnlyMemory<char> value) => value = this[cursor.Position].AsMemory();
DataFrameColumns\StringDataFrameColumn.cs (1)
505(ref ReadOnlyMemory<char> value) => value = this[cursor.Position].AsMemory();
Microsoft.Extensions.AI.Abstractions (1)
Contents\DataContent.cs (1)
93_dataUri = DataUriParser.Parse(uri.AsMemory());
Microsoft.Extensions.AI.Evaluation.NLP (1)
Common\SimpleWordTokenizer.cs (1)
30return WordTokenize(text.AsMemory());
Microsoft.Extensions.DataIngestion (1)
Chunkers\DocumentTokenChunker.cs (1)
59ReadOnlyMemory<char> contentToProcess = elementContent.AsMemory();
Microsoft.ML.AutoML.Tests (5)
ConversionTests.cs (4)
37var success = Conversions.DefaultInstance.TryParse(missingValue.AsMemory(), out value); 54var success = Conversions.DefaultInstance.TryParse(value.AsMemory(), out float _); 73var success = Conversions.DefaultInstance.TryParse(missingValue.AsMemory(), out bool _); 91var success = Conversions.DefaultInstance.TryParse(value.AsMemory(), out bool _);
Util.cs (1)
31editor.Values[i] = colNames.ElementAt(i).AsMemory();
Microsoft.ML.Core (3)
Utilities\NormStr.cs (3)
116return add ? AddCore(str.AsMemory(), hash) : null; 145return add ? AddCore(str.ToString().AsMemory(), hash) : null; 198return add ? AddCore(sb.ToString().AsMemory(), hash) : null;
Microsoft.ML.Core.Tests (19)
UnitTests\DataTypes.cs (18)
41var fValTX = textFVal.ToString().AsMemory(); 65var dValTX = textDVal.ToString().AsMemory(); 81ReadOnlyMemory<char> src = minValue.ToString().AsMemory(); 87src = maxValue.ToString().AsMemory(); 93src = (sbyte.MinValue - 1).ToString().AsMemory(); 99src = (sbyte.MaxValue + 1).ToString().AsMemory(); 121ReadOnlyMemory<char> src = minValue.ToString().AsMemory(); 127src = maxValue.ToString().AsMemory(); 133src = (minValue - 1).ToString().AsMemory(); 139src = (maxValue + 1).ToString().AsMemory(); 161ReadOnlyMemory<char> src = minValue.ToString().AsMemory(); 167src = maxValue.ToString().AsMemory(); 173src = ((long)minValue - 1).ToString().AsMemory(); 179src = ((long)maxValue + 1).ToString().AsMemory(); 201ReadOnlyMemory<char> src = minValue.ToString().AsMemory(); 207src = maxValue.ToString().AsMemory(); 213src = (minValue - 1).ToString().AsMemory(); 219src = ((ulong)maxValue + 1).ToString().AsMemory();
UnitTests\ScoreSchemaTest.cs (1)
27bufferEditor.Values[i] = string.Format($"Key-{i}").AsMemory();
Microsoft.ML.Data (91)
Data\Conversion.cs (15)
940public void Convert(in I1 src, ref TX dst) => dst = src.ToString().AsMemory(); 941public void Convert(in I2 src, ref TX dst) => dst = src.ToString().AsMemory(); 942public void Convert(in I4 src, ref TX dst) => dst = src.ToString().AsMemory(); 943public void Convert(in I8 src, ref TX dst) => dst = src.ToString().AsMemory(); 944public void Convert(in U1 src, ref TX dst) => dst = src.ToString().AsMemory(); 945public void Convert(in U2 src, ref TX dst) => dst = src.ToString().AsMemory(); 946public void Convert(in U4 src, ref TX dst) => dst = src.ToString().AsMemory(); 947public void Convert(in U8 src, ref TX dst) => dst = src.ToString().AsMemory(); 948public void Convert(in UG src, ref TX dst) => dst = string.Format("0x{0:x16}{1:x16}", src.High, src.Low).AsMemory(); 949public void Convert(in R4 src, ref TX dst) => dst = src.ToString("G7", CultureInfo.InvariantCulture).AsMemory(); 950public void Convert(in R8 src, ref TX dst) => dst = src.ToString("G17", CultureInfo.InvariantCulture).AsMemory(); 951public void Convert(in BL src, ref TX dst) => dst = src.ToString().AsMemory(); 952public void Convert(in TS src, ref TX dst) => dst = string.Format("{0:c}", src).AsMemory(); 953public void Convert(in DT src, ref TX dst) => dst = string.Format("{0:o}", src).AsMemory(); 954public void Convert(in DZ src, ref TX dst) => dst = string.Format("{0:o}", src).AsMemory();
Data\DataViewUtils.cs (2)
1381value = text.AsMemory(); 1409value = string.Format("<{0}{1}>", stringRep, suffix).AsMemory();
DataLoadSave\Binary\Codecs.cs (1)
387value = _text.AsMemory().Slice(start, (b & LengthMask) - start);
DataLoadSave\Database\DatabaseLoaderCursor.cs (3)
352return (ref ReadOnlyMemory<char> value) => value = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetString(columnIndex).AsMemory(); 659editor.Values[i] = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetString(columnIndex).AsMemory(); 665editor.Values[i++] = DataReader.IsDBNull(columnIndex) ? default : DataReader.GetString(columnIndex).AsMemory();
DataLoadSave\Text\TextLoader.cs (1)
993Parser.ParseSlotNames(parent, _header = result.AsMemory(), Infos, _slotNames);
DataLoadSave\Text\TextLoaderCursor.cs (1)
233Utils.Add(ref lines, batch.Infos[i].Text.AsMemory());
DataLoadSave\Text\TextLoaderParser.cs (3)
868var lineSpan = text.AsMemory(); 1303scan.Span = String.Empty.AsMemory(); 1305scan.Span = _sb.ToString().AsMemory();
DataLoadSave\Text\TextSaver.cs (1)
244var span = _columnName.AsMemory();
DataView\ArrayDataViewBuilder.cs (1)
447dst = src.AsMemory();
DataView\DataViewConstructionUtils.cs (4)
249return CreateConvertingArrayGetterDelegate<string, ReadOnlyMemory<char>>(peek, x => x != null ? x.AsMemory() : ReadOnlyMemory<char>.Empty); 276return CreateConvertingGetterDelegate<String, ReadOnlyMemory<char>>(peek, x => x != null ? x.AsMemory() : ReadOnlyMemory<char>.Empty); 986dstEditor.Values[i] = value[i].AsMemory(); 1012dst = ((string)(object)Value).AsMemory();
Deprecated\Instances\HeaderSchema.cs (1)
52nameList.Add(kvp.Value.AsMemory());
Evaluators\AnomalyDetectionEvaluator.cs (2)
495Names[_topExamples.Count - 1] = _topExamples.Top.Name.AsMemory(); 520_nameGetter = (ref ReadOnlyMemory<char> dst) => dst = (rowCounter++).ToString().AsMemory();
Evaluators\BinaryClassifierEvaluator.cs (2)
184labelNames = new VBuffer<ReadOnlyMemory<char>>(2, new[] { "positive".AsMemory(), "negative".AsMemory() });
Evaluators\ClusteringEvaluator.cs (1)
746editor.Values[i - 1] = $"#{i} {suffix}".AsMemory();
Evaluators\EvaluatorBase.cs (3)
188addAgg(stratColKey, agg.StratName.AsMemory(), agg); 215editor.Values[i] = dictionaries[i].ColName.AsMemory(); 311warnings.Select(s => s.AsMemory()).ToArray());
Evaluators\EvaluatorUtils.cs (11)
360namesArray[j] = string.Format("({0})", j).AsMemory(); 380(in TSrc src, ref ReadOnlyMemory<char> dst) => dst = value.AsMemory()); 494var reconciledSlotNames = new VBuffer<ReadOnlyMemory<char>>(slotNames.Count, slotNames.Keys.Select(k => k.AsMemory()).ToArray()); 587var name = kvp.Value.ToString().AsMemory(); 1034editor.Values[j] = string.Format("Label_{0}", j).AsMemory(); 1258var stratVals = foldCol >= 0 ? new[] { "".AsMemory(), "".AsMemory() } : new[] { "".AsMemory() }; 1270var foldVals = new[] { "Average".AsMemory(), "Standard Deviation".AsMemory() }; 1311names[j] = agg[iMetric + j].Name.AsMemory();
Evaluators\MulticlassClassificationEvaluator.cs (6)
115names = Enumerable.Range(0, numClasses).Select(i => i.ToString().AsMemory()).ToArray(); 537editor.Values[i] = string.Format("(class {0})", ClassNames[i]).AsMemory(); 630_classNames = Utils.BuildArray(_numClasses, i => i.ToString().AsMemory()); 655_classNames[i] = ctx.LoadNonEmptyString().AsMemory(); 658_classNames = Utils.BuildArray(_numClasses, i => i.ToString().AsMemory()); 838editor.Values[i - 1] = string.Format("#{0} {1}", i, suffix).AsMemory();
Evaluators\MultiOutputRegressionEvaluator.cs (5)
367editor.Values[i] = string.Format("(Label_{0})", i).AsMemory(); 585dst = AnnotationUtils.Const.ScoreColumnKind.MultiOutputRegression.AsMemory(); 590dst = AnnotationUtils.Const.ScoreValueKind.Score.AsMemory(); 606editor.Values[i] = string.Format("{0}_{1}", prefix, i).AsMemory(); 719labelNames[j] = string.Format("Label_{0}", j).AsMemory();
Evaluators\QuantileRegressionEvaluator.cs (2)
312quantiles[i] = ctx.LoadNonEmptyString().AsMemory(); 375editor.Values[i] = string.Format("{0} ({1})", prefix, quantiles[i]).AsMemory();
Evaluators\RankingEvaluator.cs (5)
194groupName.AddRange(agg.GroupId.Select(sb => sb.ToString().AsMemory())); 519GroupId.Add(_groupSb.ToString().AsMemory()); 537editor.Values[i] = string.Format("{0}@{1}", prefix, i + 1).AsMemory(); 546editor.Values[i] = string.Format("@{0}", i + 1).AsMemory(); 687i + 1).AsMemory();
Scorers\PredictedLabelScorerBase.cs (2)
249dst = ScoreColumnKind.AsMemory(); 256dst = AnnotationUtils.Const.ScoreValueKind.PredictedLabel.AsMemory();
Scorers\ScoreSchemaFactory.cs (7)
31(ref ReadOnlyMemory<char> value) => { value = scoreColumnKindValue.AsMemory(); }); 33(ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreValueKind.Score.AsMemory(); }); 64(ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreColumnKind.BinaryClassification.AsMemory(); }); 66(ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreValueKind.Probability.AsMemory(); }); 95bufferEditor.Values[i] = string.Format("Quantile-{0}", quantiles[i]).AsMemory(); 128(ref ReadOnlyMemory<char> value) => value = scoreColumnKindValue.AsMemory()); 130(ref ReadOnlyMemory<char> value) => value = AnnotationUtils.Const.ScoreValueKind.PredictedLabel.AsMemory());
Transforms\ColumnConcatenatingTransformer.cs (2)
641bldr.AddFeature(slot++, nameSrc.AsMemory()); 665bldr.AddFeature(slot + kvp.Key, sb.ToString().AsMemory());
Transforms\InvertHashUtils.cs (3)
205return Utils.Size(temp) > 0 ? temp.ToString().AsMemory() : String.Empty.AsMemory(); 224var retval = sb.ToString().AsMemory();
Transforms\KeyToVector.cs (1)
418editor.Values[slot++] = sb.ToString().AsMemory();
Transforms\ValueMapping.cs (3)
218editor.Values[i] = keys[i].ToString().AsMemory(); 244var converted = value.Select(x => x.ToString().AsMemory()); 876conv(string.Empty.AsMemory(), ref value);
Transforms\ValueToKeyMappingTransformer.cs (1)
533var terms = columns[iinfo].Key.AsMemory();
Transforms\ValueToKeyMappingTransformerImpl.cs (2)
239ReadOnlyMemory<char> term = sterm.AsMemory(); 796editor.Values[i] = sb.ToString().AsMemory();
Microsoft.ML.EntryPoints (1)
CrossValidationMacro.cs (1)
378dvBldr.AddColumn(MetricKinds.ColumnNames.WarningText, TextDataViewType.Instance, warn.AsMemory());
Microsoft.ML.FastTree (3)
TreeEnsembleFeaturizer.cs (3)
480editor.Values[t] = string.Format("Tree{0:000}", t).AsMemory(); 495editor.Values[i++] = string.Format("Tree{0:000}Leaf{1:000}", t, l).AsMemory(); 515editor.Values[i++] = string.Format("Tree{0:000}Node{1:000}", t, l).AsMemory();
Microsoft.ML.OnnxTransformer (2)
OnnxTransform.cs (2)
600dstEditor.Values[i] = slotsAttr.Strings[i].ToString(Encoding.UTF8).AsMemory(); 745editor.Values[i] = tensor.GetValue(i).AsMemory();
Microsoft.ML.Parquet (4)
ParquetLoader.cs (2)
711public void Conv(in string src, ref ReadOnlyMemory<char> dst) => dst = src.AsMemory(); 718public void Conv(in IList src, ref ReadOnlyMemory<char> dst) => dst = ConvertListToString(src).AsMemory();
PartitionedFileLoader.cs (2)
564_colValues[i] = values[source].AsMemory(); 570_colValues[i] = cleanPath.AsMemory();
Microsoft.ML.PerformanceTests (3)
HashBench.cs (3)
149InitMapMurmurHashV2("Hello".AsMemory(), TextDataViewType.Instance); 199var tokens = "Hello my friend, stay awhile and listen! ".Split().Select(token => token.AsMemory()).ToArray(); 249InitMapMurmurHashV1("Hello".AsMemory(), TextDataViewType.Instance);
Microsoft.ML.Samples (1)
Dynamic\SimpleDataViewImplementation.cs (1)
291=> value = _enumerator.Current.Text.AsMemory();
Microsoft.ML.TensorFlow (4)
TensorflowUtils.cs (3)
65metadataBuilder.Add(TensorflowOperatorTypeKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => value = op.OpType.AsMemory()); 72bufferEditor.Values[i] = op.inputs[i].op.name.AsMemory(); 420result[i] = (T)(object)buffer[i].AsMemory();
TensorTypeExtensions.cs (1)
24dst = (T)(object)tensor.StringData()[0].AsMemory();
Microsoft.ML.TestFramework (19)
DataPipe\TestDataPipe.cs (7)
914ReadOnlyMemory<char>[] values = { "Fred".AsMemory(), "McGriff".AsMemory(), "free".AsMemory(), "agent".AsMemory() }; 916ReadOnlyMemory<char>[] values1 = { "erythromycin".AsMemory(), "treating".AsMemory(), "pneumonia".AsMemory() };
TestSparseDataView.cs (12)
40GenericSparseDataView(new ReadOnlyMemory<char>[] { "a".AsMemory(), "b".AsMemory(), "c".AsMemory() }, 41new ReadOnlyMemory<char>[] { "aa".AsMemory(), "bb".AsMemory(), "cc".AsMemory() }); 80GenericDenseDataView(new ReadOnlyMemory<char>[] { "a".AsMemory(), "b".AsMemory(), "c".AsMemory() }, 81new ReadOnlyMemory<char>[] { "aa".AsMemory(), "bb".AsMemory(), "cc".AsMemory() });
Microsoft.ML.Tests (27)
ExpressionLanguageTests\ExpressionLanguageTests.cs (1)
254ReadOnlyMemory<char> chars = text.AsMemory().Slice(ichMin, ichLim - ichMin);
Scenarios\Api\TestApi.cs (1)
248Assert.True(retrievedReadOnlyMemory.Span.SequenceEqual(valueString.AsMemory().Span));
SvmLightTests.cs (9)
81new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(5, 1, new[] { -2f }, new[] { 4 }), Comment = " A comment! 2:3".AsMemory() }, 109new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(5, 0, new float[0], new int[0]), Comment = " A comment! 2:3".AsMemory() }, 138new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(6, 1, new[] { -2f }, new[] { 4 }), Comment = " A comment! 2:3".AsMemory() }, 162AnnotationUtils.Kinds.SlotNames, new VBuffer<ReadOnlyMemory<char>>(3, new[] { "aurora".AsMemory(), "beachwood".AsMemory(), "chagrin".AsMemory() }), 311new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(6, 1, new[] { -2f }, new[] { 4 }), Comment = " A comment! 2:3".AsMemory() }, 468new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(6, 1, new[] { -2f }, new[] { 4 }), Comment = " A comment! 2:3".AsMemory() }, 495new SvmLightOutput() { Label = 1, Weight = 1, Features = new VBuffer<float>(6, 1, new[] { -2f }, new[] { 4 }), Comment = " A comment! 2:3".AsMemory() },
Transformers\HashTests.cs (4)
295HashTestCore("".AsMemory(), TextDataViewType.Instance, 0, 0, 0, 0, 0); 296HashTestCore("hello".AsMemory(), TextDataViewType.Instance, 940, 951, 857, 770, 0); 331new HashData {Foo = "alibaba".AsMemory()}, 332new HashData {Foo = "ba ba".AsMemory()},
Transformers\ValueMappingTests.cs (12)
93var keys = new List<ReadOnlyMemory<char>>() { "foo".AsMemory(), "bar".AsMemory(), "test".AsMemory(), "wahoo".AsMemory() }; 571Assert.Equal("foo2".AsMemory(), dValue); 581Assert.Contains("foo1".AsMemory(), allowedKeyPool); 582Assert.Contains("foo2".AsMemory(), allowedKeyPool); 583Assert.Contains("foo3".AsMemory(), allowedKeyPool); 634new KeyValuePair<ReadOnlyMemory<char>,int>("foo".AsMemory(), 1), 635new KeyValuePair<ReadOnlyMemory<char>,int>("bar".AsMemory(), 2), 636new KeyValuePair<ReadOnlyMemory<char>,int>("test".AsMemory(), 3), 637new KeyValuePair<ReadOnlyMemory<char>,int>("wahoo".AsMemory(), 4)
Microsoft.ML.TimeSeries (7)
SequentialAnomalyDetectionTransformBase.cs (4)
325_slotNames = new VBuffer<ReadOnlyMemory<char>>(4, new[] { "Alert".AsMemory(), "Raw Score".AsMemory(), 326"P-Value Score".AsMemory(), "Martingale Score".AsMemory() });
SrCnnTransformBase.cs (3)
168_slotNames = new VBuffer<ReadOnlyMemory<char>>(_parent.OutputLength, new[] { "Alert".AsMemory(), "Raw Score".AsMemory(), 169"Mag".AsMemory()});
Microsoft.ML.TorchSharp (6)
AutoFormerV2\ObjectDetectionTrainer.cs (2)
759meta.Add(AnnotationUtils.Kinds.ScoreColumnKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreColumnKind.MulticlassClassification.AsMemory(); }); 761meta.Add(AnnotationUtils.Kinds.ScoreValueKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreValueKind.Score.AsMemory(); });
NasBert\NasBertTrainer.cs (2)
525meta.Add(AnnotationUtils.Kinds.ScoreColumnKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreColumnKind.MulticlassClassification.AsMemory(); }); 527meta.Add(AnnotationUtils.Kinds.ScoreValueKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreValueKind.Score.AsMemory(); });
Roberta\QATrainer.cs (2)
741meta.Add(AnnotationUtils.Kinds.ScoreColumnKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreColumnKind.MulticlassClassification.AsMemory(); }); 743meta.Add(AnnotationUtils.Kinds.ScoreValueKind, TextDataViewType.Instance, (ref ReadOnlyMemory<char> value) => { value = AnnotationUtils.Const.ScoreValueKind.Score.AsMemory(); });
Microsoft.ML.Transforms (32)
Dracula\CountTableTransformer.cs (2)
644inputSlotNames = new VBuffer<ReadOnlyMemory<char>>(1, new[] { inputCol.Name.AsMemory() }); 663editor.Values[i * nFeatures + j] = $"{slotName}_{featureNamesValues[j]}".AsMemory();
Dracula\Featurizer.cs (3)
131editor.Values[i] = $"{classNames[i]}_Count".AsMemory(); 133editor.Values[_labelBinCount + i] = $"{classNames[i]}_LogOdds".AsMemory(); 134editor.Values[NumFeatures - 1] = "IsBackoff".AsMemory();
Expression\BuiltinFunctions.cs (8)
713return sb.ToString().AsMemory(); 770return sb.ToString().AsMemory(); 909public static TX ToTX(I4 src) => src.ToString().AsMemory(); 910public static TX ToTX(I8 src) => src.ToString().AsMemory(); 911public static TX ToTX(R4 src) => src.ToString("R", CultureInfo.InvariantCulture).AsMemory(); 912public static TX ToTX(R8 src) => src.ToString("G17", CultureInfo.InvariantCulture).AsMemory(); 916return "0".AsMemory(); 918return "1".AsMemory();
Expression\Exec.cs (1)
32return str.AsMemory();
Expression\Node.cs (1)
817Value = tok.Value.AsMemory();
HashJoiningTransform.cs (2)
348var parts = ReadOnlyMemoryUtils.Split(slotMapString.AsMemory(), new[] { ';' }).ToArray(); 448dstEditor.Values[slot] = outputSlotName.ToString().AsMemory();
KeyToVectorMapping.cs (2)
274bldr.AddFeature(i, (slotNamePrefix + (_bitsPerKey[iinfo] - i - 1)).AsMemory()); 328editor.Values[slot++] = sb.ToString().AsMemory();
MissingValueIndicatorTransform.cs (4)
190editor.Values[0] = columnName.AsMemory(); 191editor.Values[1] = (columnName + IndicatorSuffix).AsMemory(); 228editor.Values[slot++] = str.AsMemory().Slice(0, len); 229editor.Values[slot++] = str.AsMemory();
MissingValueReplacing.cs (1)
417var srcTxt = srcStr.AsMemory();
PermutationFeatureImportance.cs (1)
256: string.Format("f{0}", index).AsMemory();
SvmLight\SvmLightLoader.cs (1)
519_text = line.AsMemory();
Text\NgramTransform.cs (1)
551dstEditor.Values[slot] = sb.ToString().AsMemory();
Text\StopWordsRemovingTransformer.cs (2)
172.ToDictionary(lang => lang.ToString().AsMemory(), new ReadOnlyMemoryUtils.ReadonlyMemoryCharComparer()); 933LoadStopWords(ch, stopwords.AsMemory(), dataFile, stopwordsColumn, loader, out _stopWordsMap);
Text\TextNormalizing.cs (1)
448dst = buffer.ToString().AsMemory();
Text\TokenizingByCharacters.cs (1)
327editor.Values[i] = keyValuesStr.AsMemory().Slice(keyValuesBoundaries[i], keyValuesBoundaries[i + 1] - keyValuesBoundaries[i]);
Text\WordBagTransform.cs (1)
324dst = sb.ToString().AsMemory();
Microsoft.NET.Sdk.BlazorWebAssembly.Tasks (5)
src\sdk\src\StaticWebAssetsSdk\Tasks\Data\StaticWebAssetPathPattern.cs (4)
40public StaticWebAssetPathPattern(string path) : this(path.AsMemory()) { } 226return Parse(rawPath.AsMemory(), assetIdentity); 487part.Value = tokenValue.AsMemory(); 532return stringBuilder.ToString().AsMemory();
src\sdk\src\StaticWebAssetsSdk\Tasks\Utils\OSPath.cs (1)
16public static ReadOnlyMemory<char> DirectoryPathSeparators { get; } = "/\\".AsMemory();
Microsoft.NET.Sdk.StaticWebAssets.Tasks (12)
Data\StaticWebAssetPathPattern.cs (4)
40public StaticWebAssetPathPattern(string path) : this(path.AsMemory()) { } 226return Parse(rawPath.AsMemory(), assetIdentity); 487part.Value = tokenValue.AsMemory(); 532return stringBuilder.ToString().AsMemory();
FingerprintPatternMatcher.cs (2)
42var relativePathCandidateMemory = context.PathString.AsMemory(); 76var stem = GetMatchStem(fileName, matchResult.Pattern.AsMemory().Slice(2));
Utils\Globbing\StaticWebAssetGlobMatcherBuilder.cs (5)
65var patternMemory = pattern.AsMemory(); 77segments.Add("**".AsMemory()); 153Value = "*".AsMemory() 207if (segmentSpan.Equals("**".AsMemory().Span, StringComparison.Ordinal)) 219if (segmentSpan.Equals("*".AsMemory().Span, StringComparison.Ordinal))
Utils\OSPath.cs (1)
16public static ReadOnlyMemory<char> DirectoryPathSeparators { get; } = "/\\".AsMemory();
Microsoft.NET.StringTools (1)
SpanBasedStringBuilder.cs (1)
220_spans.Add(value!.AsMemory());
NuGet.Packaging (6)
ContentModel\ContentItemCollection.cs (4)
15private static readonly ReadOnlyMemory<char> Dll = ".dll".AsMemory(); 16private static readonly ReadOnlyMemory<char> Exe = ".exe".AsMemory(); 17private static readonly ReadOnlyMemory<char> Winmd = ".winmd".AsMemory(); 306asset.Path.AsMemory().Span.StartsWith(assemblyPrefix.Span, StringComparison.Ordinal))
ContentModel\PatternTable.cs (1)
42byProp.Add(entry.Name.AsMemory(), entry.Value);
ContentModel\SelectionCriteriaBuilder.cs (1)
59if (propertyDefinition.TryLookup(value.AsMemory(), table: null, matchOnly: false, value: out valueLookup))
System.CommandLine (1)
Parsing\CommandLineParser.cs (1)
42var memory = commandLine.AsMemory();
System.Memory (1)
System\Buffers\ReadOnlySequence.Helpers.cs (1)
222var memory = (ReadOnlyMemory<T>)(object)((string)startObject).AsMemory();
System.Private.CoreLib (8)
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (3)
1172=> WriteAllTextAsync(path, contents.AsMemory(), encoding, cancellationToken); 1392await writer.WriteLineAsync(line.AsMemory(), cancellationToken).ConfigureAwait(false); 1414=> AppendAllTextAsync(path, contents.AsMemory(), encoding, cancellationToken);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (2)
742return WriteAsyncInternal(value.AsMemory(), appendNewLine: false, default); 887return WriteAsyncInternal(value.AsMemory(), appendNewLine: true, default);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StringStream.cs (1)
48_text = text.AsMemory();
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\TextWriter.cs (2)
631WriteAsync(value.AsMemory(), cancellationToken); 725WriteLineAsync(value.AsMemory(), cancellationToken);
System.Text.Json (1)
System\Text\Json\Document\JsonDocument.Parse.cs (1)
353return Parse(json.AsMemory(), options);
System.Text.RegularExpressions (8)
System\Text\RegularExpressions\Regex.Replace.cs (2)
638state.segments.Add(state.evaluator(match).AsMemory()); 657state.segments.Add(state.evaluator(match).AsMemory());
System\Text\RegularExpressions\RegexReplacement.cs (6)
132rule >= 0 ? _strings[rule].AsMemory() : // string lookup 139WholeString => match.Text.AsMemory(), 164rule >= 0 ? _strings[rule].AsMemory() : // string lookup 171WholeString => match.Text.AsMemory(), 232var state = (input, replacement, offsetAndCounts: new StructListBuilder<int>(), inputMemory: input.AsMemory(), prevat: 0, count); 298var state = (replacement: this, segments: new StructListBuilder<ReadOnlyMemory<char>>(), inputMemory: input.AsMemory(), prevat: 0, count);