Class wwUtils

General Utility class that contains helpers for strings Reflection, Serialization and a few other utility functions.

System.Object
  Westwind.Tools.wwUtils

public partial class wwUtils

Class Members

MemberDescription
Constructor
MemberAccess Binding Flags constant to be reused for all Reflection access methods.
CallMethod Calls a method on an object dynamically.
public static object CallMethod( object Object,
string Method,
Object[] Params );
CallMethodEx Calls a method on an object with extended . syntax (object: this Method: Entity.CalculateOrderTotal)
public static object CallMethodEx( object Parent,
string Method,
Object[] Params );
CreateInstanceFromType Creates an instance from a type by calling the parameterless constructor.
public object CreateInstanceFromType( Type TypeToCreate );
DisplayMemo Fixes a plain text field for display as HTML by replacing carriage returns with the appropriate br and p tags for breaks.
public static string DisplayMemo( string HtmlText );
DisplayMemoEncoded Method that handles handles display of text by breaking text. Unlike the non-encoded version it encodes any embedded HTML text
public static string DisplayMemoEncoded( string Text );
Empty Determines whether a string is empty (null or zero length)
public static bool Empty( string String );

public static bool Empty( object StringValue );

ExpandUrls Expands links into HTML hyperlinks inside of text or HTML.
public static string ExpandUrls( string Text,
string Target );

public static string ExpandUrls( string Text );

ExtractString Extracts a string from between a pair of delimiters. Only the first instance is found.
public static string ExtractString( string Source,
string BeginDelim,
string EndDelim,
bool CaseSensitive,
bool AllowMissingEndDelimiter );

public static string ExtractString( string Source,
string BeginDelim,
string EndDelim,
bool CaseSensitive );

public static string ExtractString( string Source,
string BeginDelim,
string EndDelim );

FixHTMLForDisplay Replaces and and Quote characters to HTML safe equivalents.
public static string FixHTMLForDisplay( string Html );
GetField Retrieve a field dynamically from an object. This is a simple implementation that's straight Reflection and doesn't support indexers.
public static object GetField( object Object,
string Property );
GetProperty Retrieve a property value from an object dynamically. This is a simple version that uses Reflection calls directly. It doesn't support indexers.
public static object GetProperty( object Object,
string Property );
GetPropertyEx Returns a property or field value using a base object and sub members including . syntax. For example, you can access: this.oCustomer.oData.Company with (this,"oCustomer.oData.Company") This method also supports indexers in the Property value such as: Customer.DataSet.Tables["Customers"].Rows[0]
public static object GetPropertyEx( object Parent,
string Property );
GetTypeFromName Helper routine that looks up a type name and tries to retrieve the full type reference in the actively executing assemblies.
public static Type GetTypeFromName( string TypeName );
Href Create an Href HTML link
public static string Href( string Text,
string Url,
string Target,
string AdditionalMarkup );

public static string Href( string Text,
string Url );

HtmlAbstract Creates an Abstract from an HTML document. Strips the HTML into plain text, then creates an abstract.
public static string HtmlAbstract( string Html,
int Length );
LogString Simple Logging method that allows quickly writing a string to a file
public static void LogString( string Output,
string Filename );
NewStringId Creates short string id based on a GUID hashcode. Not guaranteed to unique across machines, but unlikely to duplicate in medium volume situations.
public static string NewStringId();
ProperCase Return a string in proper Case format
public static string ProperCase( string Input );
SetField Sets the field on an object. This is a simple method that uses straight Reflection and doesn't support indexers.
public static void SetField( object Object,
string Property,
object Value );
SetProperty Sets the property on an object. This is a simple method that uses straight Reflection and doesn't support indexers.
public static void SetProperty( object Object,
string Property,
object Value );
SetPropertyEx Sets a value on an object. Supports . syntax for named properties (ie. Customer.Entity.Company) as well as indexers.
public static object SetPropertyEx( object Parent,
string Property,
object Value );
StringToTypedValue Turns a string into a typed value. Useful for auto-conversion routines like form variable or XML parsers.
public static object StringToTypedValue( string SourceString,
Type TargetType,
CultureInfo Culture );

public static object StringToTypedValue( string SourceString,
Type TargetType );

StripHtml Strips HTML tags out of an HTML string and returns just the text.
public static string StripHtml( string Html );
TextAbstract Returns an abstract of the provided text by returning up to Length characters of a text string. If the text is truncated a ... is appended.
public static string TextAbstract( string Text,
int Length );
TypedValueToString Converts a type to string if possible. This method supports an optional culture generically on any value. It calls the ToString() method on common types and uses a type converter on all other objects if available
public static string TypedValueToString( object RawValue,
CultureInfo Culture );

public static string TypedValueToString( object RawValue );

Requirements

Namespace: Westwind.Tools
Assembly: westwind.ajaxtoolkit.dll


  Last Updated: 7/8/2008 | © West Wind Technologies, 2008