From ddff1d83531447329ca384589c31bab8cf408c95 Mon Sep 17 00:00:00 2001 From: Markus Ewald Date: Wed, 22 Oct 2008 20:45:13 +0000 Subject: [PATCH] Moved Shared.cs from Nuclex.Math to Nuclex.Support because this class can be quite useful in other locations as well; added CPL copyright header to all files in Nuclex.Math; fixed copyright date in AssemblyInfo.cs of Nuclex.Math and Nuclex.Support git-svn-id: file:///srv/devel/repo-conversion/nusu@92 d2e56fa2-650e-0410-a79f-9358c0239efd --- Nuclex.Support.csproj | 3 ++- Properties/AssemblyInfo.cs | 2 +- Source/Shared.cs | 44 ++++++++++++++++++++++++++++++++++++++ Source/StringSegment.cs | 4 ++-- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 Source/Shared.cs diff --git a/Nuclex.Support.csproj b/Nuclex.Support.csproj index ef58cd7..c97e4d2 100644 --- a/Nuclex.Support.csproj +++ b/Nuclex.Support.csproj @@ -3,7 +3,7 @@ Debug AnyCPU - 9.0.21022 + 9.0.30729 2.0 {9118C4C7-DC1E-4BFB-A99D-2A22B7590D7F} Library @@ -111,6 +111,7 @@ + StringHelper.cs diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index b6e4be6..f16b243 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -9,7 +9,7 @@ using System.Runtime.InteropServices; [assembly: AssemblyProduct("Nuclex.Support")] [assembly: AssemblyDescription("")] [assembly: AssemblyCompany("Nuclex Development Labs")] -[assembly: AssemblyCopyright("Copyright © Nuclex Development Labs 2007")] +[assembly: AssemblyCopyright("Copyright © Nuclex Development Labs 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Source/Shared.cs b/Source/Shared.cs new file mode 100644 index 0000000..ae94b18 --- /dev/null +++ b/Source/Shared.cs @@ -0,0 +1,44 @@ +#region CPL License +/* +Nuclex Framework +Copyright (C) 2002-2008 Nuclex Development Labs + +This library is free software; you can redistribute it and/or +modify it under the terms of the IBM Common Public License as +published by the IBM Corporation; either version 1.0 of the +License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +IBM Common Public License for more details. + +You should have received a copy of the IBM Common Public +License along with this library +*/ +#endregion + +using System; + +namespace Nuclex.Support { + + /// Manages a globally shared instance of the given Type + /// + /// Type of which a globally shared instance will be provided + /// + public static class Shared where SharedType : new() { + + /// Returns the global instance of the class + public static SharedType Instance { + [System.Diagnostics.DebuggerStepThrough] + get { + return instance; + } + } + + /// Stored the globally shared instance + private static readonly SharedType instance = new SharedType(); + + } + +} // namespace Nuclex.Support diff --git a/Source/StringSegment.cs b/Source/StringSegment.cs index f425c4a..a401a61 100644 --- a/Source/StringSegment.cs +++ b/Source/StringSegment.cs @@ -64,12 +64,12 @@ namespace Nuclex.Support { } if(offset < 0) { throw new ArgumentOutOfRangeException( - "offset", "Argument out of range, non-negative number required" + "offset", "Argument out of range, non-negative number required" ); } if(count < 0) { throw new ArgumentOutOfRangeException( - "count", "Argument out of range, non-negative number required" + "count", "Argument out of range, non-negative number required" ); } if((text.Length - offset) < count) {