Stone_Red-C-Sharp-Utilities 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Stone_Red-C-Sharp-Utilities --version 1.0.1
NuGet\Install-Package Stone_Red-C-Sharp-Utilities -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Stone_Red-C-Sharp-Utilities" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Stone_Red-C-Sharp-Utilities --version 1.0.1
#r "nuget: Stone_Red-C-Sharp-Utilities, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Stone_Red-C-Sharp-Utilities as a Cake Addin
#addin nuget:?package=Stone_Red-C-Sharp-Utilities&version=1.0.1

// Install Stone_Red-C-Sharp-Utilities as a Cake Tool
#tool nuget:?package=Stone_Red-C-Sharp-Utilities&version=1.0.1

Stone_Red-C-Sharp-Utilities

Provides useful C# methods.

Install

Package Manager

Install-Package Stone_Red-C-Sharp-Utilities

.NET CLI

dotnet add package Stone_Red-C-Sharp-Utilities

NuGet

https://www.nuget.org/packages/Stone_Red-C-Sharp-Utilities

Namespaces

Stone_Red_Utilities.ArrListExtentions

Methods:
  • Print
    • Description: Prints items of array
    • Parameters: this Array array, char delimiter, bool printToDebugConsole
    • Example usage:
      string[] yourArray = { "str1", "str2", "str3" };
      yourArray.Print(';');
      
    • Output:
      str1; str2; str3
      
  • Print<T>
    • Description: Prints items of list
    • Parameters: this List<T> list, char delimiter, bool printToDebugConsole
    • Example usage:
      List<double> yourList = new() { 1.45, 6.24, 4.14 };
      yourList.Print(';');
      
    • Output:
      1.45; 6.24; 4.14
      
  • PrintTable<T>
    • Description: Creates and prints table from 2D array
    • Parameters: this T[,] array, TableStyle tableStyle
    • Example usage:
      int[,] your2dArray =
      {
          {1,2,3 },
          {4,5,6 },
          {7,8,9 }
      };
      your2dArray.PrintTable(TableStyle.Default);
      
    • Output:
      -------------
      | 1 | 2 | 3 |
      -------------
      | 4 | 5 | 6 |
      -------------
      | 7 | 8 | 9 |
      -------------
      

Stone_Red_Utilities.ConsoleExtentions

Methods:
  • Write
    • Description: Writes the text representation of the specified object to the standard output stream.
    • Parameters: object value, ConsoleColor color
    • Example usage:
      ConsoleExt.Write("text in red", ConsoleColor.Red);
      
    • Output:
      text in red
      
      (Imagine that the text is actually red)
  • WriteLine
    • Description: Writes the text representation of the specified object, followed by the current line terminator, to the standard output stream.
    • Parameters: object value, ConsoleColor color
    • Example usage:
      ConsoleExt.WriteLine("text in green", ConsoleColor.Green);
      
    • Output:
      text in green
      
      (Imagine that the text is actually green)

Stone_Red_Utilities.BoolExtentions

Methods:
  • OneWayTrue
    • Description: Sets value to true if input is true. If input is false the value will not change.
    • Parameters: this ref bool bol, bool input
    • Example usage:
      bool bol = false;
      
      bol.OneWayTrue(false);
      Console.WriteLine(bol);
      
      bol.OneWayTrue(true);
      Console.WriteLine(bol);
      
      bol.OneWayTrue(false);
      Console.WriteLine(bol);
      
    • Output:
      False
      True
      True
      
  • OneWayFalse
    • Description: Sets value to false if input is false. If input is true the value will not change.
    • Parameters: this ref bool bol, bool input
    • Example usage:
      bool bol = true;
      
      bol.OneWayFalse(true);
      Console.WriteLine(bol);
      
      bol.OneWayFalse(false);
      Console.WriteLine(bol);
      
      bol.OneWayFalse(true);
      Console.WriteLine(bol);
      
    • Output:
      True
      False
      False
      

Stone_Red_Utilities.StringExtentions

Methods:
  • EqualsIgnoreCase
    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case.
    • Parameters: this string str, string value
    • Example usage:
      string str1 = "BIG";
      string str2 = "big";
      
      bool match = str1.EqualsIgnoreCase(str2);
      
      Console.WriteLine(match);
      
    • Output:
      True
      
  • EqualsIgnoreSpaces
    • Description: Determines whether this instance and another specified string object have the same value regardless of spaces.
    • Parameters: this string str, string value
    • Example usage:
      string str1 = "space";
      string str2 = " s p a c e ";
      
      bool match = str1.EqualsIgnoreSpaces(str2);
      
      Console.WriteLine(match);
      
    • Output:
      True
      
  • EqualsIgnoreSpacesAndCase
    • Description: Determines whether this instance and another specified string object have the same value regardless of upper and lower case and spaces.
    • Parameters: this string str, string value
    • Example usage:
      string str1 = "BIG space";
      string str2 = "big s p a c e ";
      
      bool match = str1.EqualsIgnoreSpacesAndCase(str2);
      
      Console.WriteLine(match);
      
    • Output:
      True
      

Stone_Red_Utilities.Logging

Constructors:
  • Logger
    • Initializes the logger with the default format.
    • Parameters: LogTarget logTarg, string defaultFormat
    • Example usage:
      Logger logger = new Logger(LogTarget.Console, "{<dateTime>:HH:mm:ss} | {<level>,-7} | {<source>,-15} | {<message>}");
      
  • Logger
    • Initializes the logger with the default format and a file path.
    • Parameters: LogTarget logTarg, string file, string defaultFormat
    • Example usage:
      Logger logger = new Logger(LogTarget.ConsoleAndFile, "events.log", "{<dateTime>:HH:mm:ss} | {<level>,-7} | {<source>,-15} | {<message>}");
      
Methods:
  • Log
    • Description: Log the message to the specified output
    • Parameters: string message, string source, LogSeverity logSeverity
    • Example usage:
      logger.Log("something happend", "Update manager", LogSeverity.Error);
      
    • Output (Depends on the specified log format):
      19:15:14 | Error   | Update manager  | something happend
      
  • LogIf
    • Description: Log the message to the specified output if the condition is met
    • Parameters: bool condition, string message, string source, LogSeverity logSeverity
    • Example usage:
      logger.Log(IsValid(),"something is invalid", "Setup", LogSeverity.Error);
      
    • Output (Depends on the specified log format):
      19:15:14 | Error   | Update manager  | something happend
      
  • ClearLogFile
    • Description: Clears the log file
    • Example usage:
      logger.ClearLogFile();
      
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.3.2 138 12/28/2023
1.0.3.1 569 9/23/2021
1.0.3 324 9/22/2021
1.0.2.1 334 5/12/2021
1.0.2 319 5/10/2021
1.0.1.2 293 5/4/2021
1.0.1.1 303 4/16/2021
1.0.1 345 4/14/2021
1.0.0.2 377 3/11/2021
1.0.0.1 332 3/11/2021
1.0.0 364 3/11/2021