<commit_before>// Copyright (c) .NET Foundation. All rights reserved. 
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 

using System;

namespace Microsoft.Extensions.Localization
{
    /// <summary>
    /// A locale specific string.
    /// </summary>
    public class LocalizedString
    {
        /// <summary>
        /// Creates a new <see cref="LocalizedString"/>.
        /// </summary>
        /// <param name="name">The name of the string in the resource it was loaded from.</param>
        /// <param name="value">The actual string.</param>
        public LocalizedString(string name, string value)
            : this(name, value, resourceNotFound: false)
        {
        }

        /// <summary>
        /// Creates a new <see cref="LocalizedString"/>.
        /// </summary>
        /// <param name="name">The name of the string in the resource it was loaded from.</param>
        /// <param name="value">The actual string.</param>
        /// <param name="resourceNotFound">Whether the string was found in a resource. Set this to <c>false</c> to indicate an alternate string value was used.</param>
        public LocalizedString(string name, string value, bool resourceNotFound)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Name = name;
            Value = value;
            ResourceNotFound = resourceNotFound;
        }

        public static implicit operator string(LocalizedString localizedString)
        {
            return localizedString.Value;
        }

        /// <summary>
        /// The name of the string in the resource it was loaded from.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// The actual string.
        /// </summary>
        public string Value { get; }

        /// <summary>
        /// Whether the string was found in a resource. If <c>false</c>, an alternate string value was used.
        /// </summary>
        public bool ResourceNotFound { get; }

        /// <summary>
        /// Returns the actual string.
        /// </summary>
        /// <returns>The actual string.</returns>
        public override string ToString() => Value;<commit_msg>Don't throw if LocalizedString is null<commit_after>// Copyright (c) .NET Foundation. All rights reserved. 
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 

using System;

namespace Microsoft.Extensions.Localization
{
    /// <summary>
    /// A locale specific string.
    /// </summary>
    public class LocalizedString
    {
        /// <summary>
        /// Creates a new <see cref="LocalizedString"/>.
        /// </summary>
        /// <param name="name">The name of the string in the resource it was loaded from.</param>
        /// <param name="value">The actual string.</param>
        public LocalizedString(string name, string value)
            : this(name, value, resourceNotFound: false)
        {
        }

        /// <summary>
        /// Creates a new <see cref="LocalizedString"/>.
        /// </summary>
        /// <param name="name">The name of the string in the resource it was loaded from.</param>
        /// <param name="value">The actual string.</param>
        /// <param name="resourceNotFound">Whether the string was found in a resource. Set this to <c>false</c> to indicate an alternate string value was used.</param>
        public LocalizedString(string name, string value, bool resourceNotFound)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Name = name;
            Value = value;
            ResourceNotFound = resourceNotFound;
        }

        public static implicit operator string(LocalizedString localizedString)
        {
            return localizedString?.Value;
        }

        /// <summary>
        /// The name of the string in the resource it was loaded from.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// The actual string.
        /// </summary>
        public string Value { get; }

        /// <summary>
        /// Whether the string was found in a resource. If <c>false</c>, an alternate string value was used.
        /// </summary>
        public bool ResourceNotFound { get; }

        /// <summary>
        /// Returns the actual string.
        /// </summary>
        /// <returns>The actual string.</returns>
        public override string ToString() => Value;
{'fraction_non_alphanumeric': 0.11723856209150327, 'fraction_numerical': 0.0008169934640522876, 'mean_word_length': 1.7666666666666666, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5629797', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1167, 'n_words': 426}