3 Improved Formatting
source | link
    /// <summary>
    /// Represents Record Locator class
    /// </summary>
    public class RecordLocator : IRecordLocator
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            public string Name { get; private set; }

            /// <summary>
            /// Initializes a new instance of the <see cref="RecordLocator"/> class.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            private RecordLocator(string recordLocator)
            {
                    Name = recordLocator;
            }

            /// <summary>
            /// Parses the specified record locator.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            /// <returns></returns>
            public static IRecordLocator Parse(string recordLocator)
            {
                    if (string.IsNullOrEmpty(recordLocator))
                            throw new ArgumentNullException("recordLocator");

                    if (recordLocator.Length != 6)
                            throw new ArgumentException("recordLocator.Length != 6");

                    return new RecordLocator(recordLocator);
            }
    }

    /// <summary>
    /// Represents Record Locator interface
    /// </summary>
    public interface IRecordLocator : IHideObjectMembers
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            string Name { get; }
    }
  1. What is this design-pattern called? When you have a class, which instantiating itself (and probably have a private constructor)? Another example of this is System.DateTimeSystem.DateTime class of .NET framework.

  2. Is it okOK to do it like that?

    /// <summary>
    /// Represents Record Locator class
    /// </summary>
    public class RecordLocator : IRecordLocator
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            public string Name { get; private set; }

            /// <summary>
            /// Initializes a new instance of the <see cref="RecordLocator"/> class.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            private RecordLocator(string recordLocator)
            {
                    Name = recordLocator;
            }

            /// <summary>
            /// Parses the specified record locator.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            /// <returns></returns>
            public static IRecordLocator Parse(string recordLocator)
            {
                    if (string.IsNullOrEmpty(recordLocator))
                            throw new ArgumentNullException("recordLocator");

                    if (recordLocator.Length != 6)
                            throw new ArgumentException("recordLocator.Length != 6");

                    return new RecordLocator(recordLocator);
            }
    }

    /// <summary>
    /// Represents Record Locator interface
    /// </summary>
    public interface IRecordLocator : IHideObjectMembers
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            string Name { get; }
    }
  1. What is this design-pattern called? When you have a class, which instantiating itself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is it ok to do it like that?

/// <summary>
/// Represents Record Locator class
/// </summary>
public class RecordLocator : IRecordLocator
{
    /// <summary>
    /// The Record Locator string, for example: ZT8C4O
    /// </summary>
    public string Name { get; private set; }

    /// <summary>
    /// Initializes a new instance of the <see cref="RecordLocator"/> class.
    /// </summary>
    /// <param name="recordLocator">The record locator string.</param>
    private RecordLocator(string recordLocator)
    {
        Name = recordLocator;
    }

    /// <summary>
    /// Parses the specified record locator.
    /// </summary>
    /// <param name="recordLocator">The record locator string.</param>
    /// <returns></returns>
    public static IRecordLocator Parse(string recordLocator)
    {
        if (string.IsNullOrEmpty(recordLocator))
        throw new ArgumentNullException("recordLocator");

        if (recordLocator.Length != 6)
        throw new ArgumentException("recordLocator.Length != 6");

        return new RecordLocator(recordLocator);
    }
}

/// <summary>
/// Represents Record Locator interface
/// </summary>
public interface IRecordLocator : IHideObjectMembers
{
    /// <summary>
    /// The Record Locator string, for example: ZT8C4O
    /// </summary>
    string Name { get; }
}
  1. What is this design-pattern called? When you have a class, which instantiating itself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is it OK to do it like that?

    Post Closed as "primarily opinion-based" by user40980, GlenH7, Eric King, Thomas Owens
2 corrected grammar
source | link

How What is this design pattern is called?

I have asome code:

  1. HowWhat is this design-pattern is called, when? When you have a class, which instantiating himselfitself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is thisit ok to do it like that?

How this design pattern is called?

I have a code:

  1. How this design-pattern is called, when you have a class, which instantiating himself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is this ok to do like that?

What is this design pattern called?

I have some code:

  1. What is this design-pattern called? When you have a class, which instantiating itself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is it ok to do it like that?

1
source | link

How this design pattern is called?

I have a code:

    /// <summary>
    /// Represents Record Locator class
    /// </summary>
    public class RecordLocator : IRecordLocator
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            public string Name { get; private set; }

            /// <summary>
            /// Initializes a new instance of the <see cref="RecordLocator"/> class.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            private RecordLocator(string recordLocator)
            {
                    Name = recordLocator;
            }

            /// <summary>
            /// Parses the specified record locator.
            /// </summary>
            /// <param name="recordLocator">The record locator string.</param>
            /// <returns></returns>
            public static IRecordLocator Parse(string recordLocator)
            {
                    if (string.IsNullOrEmpty(recordLocator))
                            throw new ArgumentNullException("recordLocator");

                    if (recordLocator.Length != 6)
                            throw new ArgumentException("recordLocator.Length != 6");

                    return new RecordLocator(recordLocator);
            }
    }

    /// <summary>
    /// Represents Record Locator interface
    /// </summary>
    public interface IRecordLocator : IHideObjectMembers
    {
            /// <summary>
            /// The Record Locator string, for example: ZT8C4O
            /// </summary>
            string Name { get; }
    }
  1. How this design-pattern is called, when you have a class, which instantiating himself (and probably have a private constructor)? Another example of this is System.DateTime class of .NET framework.

  2. Is this ok to do like that?