1. PS.Framework

The assembly PS.Framework.dll encapsulates common classes and functions. This passage will guide you through the namespaces and classes of the assembly.

1.1 PS.Framework.Collections
1.1.1 ThreadSafeList<T>

The ThreadSafeList<T> is an threadsafe implementation of the List<T> from .NET Framework. So the use of the ThreadSafeList<T> is similar the the use of the .NET List<T>. To get an overview about the implementation look at the source code.

1.2 PS.Framework.Xml
1.2.1 XmlSerializer<T>

The XmlSerializer<T> is an generic implementation of the XmlSerializer class from .NET Framework. It provides serialization and deserialization of any Type (except types like Dictionary) to/from a file or a stream. To get an overview about the implementation look at the source code.

1.3 PS.Framework.Extensions
1.3.1 DataTableExtesion

The static class DataTableExtension offers extension methods for working with DataTables. Currently it contains only the extension ContainsColumn.

1.3.2 StringExtensions

The static class StringExtensions contains methods for working with strings. Currently it offers three methods.
The method CanConvertTo<T> is designed for checking if a given string can be converted to another type like an Integer or a DateTime.

Example:
    string myDateInput = "10.04.2012 11:45:12";
    if(myDateInput.CanConvertTo<DateTime>())
         Console.WriteLine("Can be converted!");

    string myDoubleInput = "15.2345";
    if(myDoubleInput.CanConvertTo<Double>())
         Console.WriteLine("Can be converted!");
The method CopyToClipBoard allows to copy a given string to the clipboard. The using of this method is also very simple.

   "Some text that should be copied to clipboard".CopyToClipBoard();

Often its necessary to encrypt strings e.g. if they are representing passwords. For this case the string extensions also contains the method Encrypt, which encrypts the given string into SHA1.

An example is:
  string encryptedString = "I will be encrypted!".Encrypt();

Last edited Apr 12, 2012 at 5:41 PM by inflames2k, version 2

Comments

No comments yet.