Sitecore 5.1.1 API

MainUtil Methods

The methods of the MainUtil class are listed below. For a complete list of MainUtil class members, see the MainUtil Members topic.

Public Static (Shared) Methods

AcquireLockAcquires a named lock.
AddArraysConcatenates two arrays.
AppendMissingIDBraceAppends a mssing closing brace "}" if a path starts with a brace "{".
BoolToStringConverts a boolean to "true" or "false".
BuildHashtable 
CapitalizeObsolete. Uppercases the first letter of a string and lowercases the remaining letters.
ClearBitResets a bit in an integer.
CompactArrayOverloaded. Compacts an object array by removing null values.
CompareVersionNumbersCompares two Sitecore version numbers.
ConvertArrayConverts an array to another type.
ConvertToHashtableConverts an array list to a hashtable.
ConvertToNameValuesOverloaded. Converts an array list to a name/value collection.
ConvertToStringOverloaded. Converts an array list of strings to a single string.
CopyArrayInserts an array into another array.
CreateObjectOverloaded. Creates an instance of an object.
DecodeNameDecodes an item name.
EncodeNameEncodes an item name.
EncodePathEncodes an item path.
EscapePlingEscapes plings (') or quotes (") in a HTML tag attribute value.
ExpandArrayOverloaded.  
ExpandSitecorePath 
FindStartTagFinds an end tag in a string.
FormatSizeFormats a number into a size string.
GarbageCollectPerforms garbage collection to keep memory usage down.
GenerateShortIDGenerates a short unique ID.
GetArrayListGets an array list of strings.
GetAssemblyNameGets the name of the assembly containing a type.
GetBackupFilenameGets a filename for a backup file.
GetBoolOverloaded.  
GetCallerMethodGets a reference to a method on the call stack.
GetCallerNameGets name of the calling method.
GetCallerType 
GetDotNetFolderGets the root folder of the current .NET Framework.
GetDotNetVersionGets the version of the current .NET Framework.
GetExceptionMessageGets the message from an exception.
GetExtraEntriesGets the extra entries in one hashtable compared to another.
GetFileLockObsolete. Gets file specific lock object.
GetFileTimeObsolete. Gets the last modified time of a file.
GetFileWriteTimeObsolete. Gets the last modified time of a file.
GetGuidOverloaded. Gets a guid from a string.
GetHashtableGets a Hashtable from a list of objects.
GetIDOverloaded.  
GetImageOverloaded. Gets an image HTML tag.
GetIntOverloaded. Gets the integer value of a string.
GetLongGets the integer long value of a string.
GetMemoryUsed 
GetNameValuesOverloaded. Converts a string to a name/value collection.
GetNewIDGenerates a new GUID.
GetNextSequenceGets next value of the sequencer.
GetNextVarNameSequenceGets next value of the variable name sequencer, optionally resetting it if it has reached a certain maximum.
GetObjectGets an object reference.
GetPagefileUsageGets current page file usage.
GetProcessInfoGet current process info.
GetProcessMemoryInfoWin32 memory method.
GetRequestFlagGets a boolean flag from the query string.
GetRequestIntGets an integer from the query string.
GetSequencerGets the current sequencer value.
GetSortKeyOverloaded. Generates a unique sort key.
GetSpacerOverloaded. Gets an image HTML tag with a blank image.
GetStringOverloaded. Gets the string value of an object.
GetStringListGets an array list of strings.
GetThreadIDGets the current thread ID.
GetTicks 
GetTristate 
GetUniqueIDGenerates a unique ID.
GetWebItemSourceOverloaded. Gets the web item data source from the query string.
GetWordGets n'th word from a string.
GetWorkFileNameGets a unique filename.
GetWorkingSetSizeGets size of current working set.
GuidToStringOverloaded. Converts guid to string.
HexToColor 
HexToInt 
HtmlWrites a line of HTML to the Response output stream.
IndexOfGets the index of an object in an array.
IntToHex 
IsBitSet 
IsEmpty 
IsFullPath 
IsIDChecks if string is a valid GUID.
IsTypeOverloaded. Checks if an object is of a given type
IsXPathChecks if a string contains an XPath expression.
JoinOverloaded. Joins two strings excluding any empty string from the result.
MakeFilePathOverloaded. Builds a file path from a folder and a file.
MakePathObsolete. Makes a path from two filename parts.
MapPathMaps a virtual file path to a physical file path.
MsgBoxOverloaded. Shows a message box.
NormalizeGuidOverloaded. Normalizes a GUID.
NormalizeItemNameNormalizes an item name.
OutOverloaded. Writes a line of HTML to the Response output stream.
ReadFromFileObsolete. Reads a text file.
ReleaseLockRelease a named lock
RemoveEmptyStrings 
RemoveEndRemoves a number of characters from the end of a string.
RemoveFromArray 
RemoveStartRemove the first characters from a string.
ReplaceItemIDsReplaces all item IDs in an XML document with new GUIDs.
ReplacePostfixReplaces the postfix of a string.
ReplacePrefixReplaces the prefix of a string.
SendMail 
SetBit 
SetEnvironmentVariable 
ShortenGuidShortens a GUID by removing braces and hyphens.
ShrinkArrayOverloaded.  
SplitOverloaded. Splits a string into an array of strings.
SplitPathSplits a Sitecore path into parts, optionally expanding it to include the root.
StringToBoolConverts a string to boolean.
SubstringOverloaded. Retrieves a substring from a string. The substring starts at a specified character position and has a specified length.
ThemedImageOverloaded. Gets a themed image path.
TraceWrites a message to the trace.
TraceIfConditionally writes a message to the trace.
TristateToString 
UnmapPathMaps a physical path to a virtual path.
UnquoteObsolete. Removes enclosing single and double quotes from a string.
WarnWrites a warning message to the trace.
WriteToFileOverloaded. Writes a byte array to a file.

Public Instance Methods

Equals (inherited from Object) Determines whether the specified Object is equal to the current Object.
GetHashCode (inherited from Object) Serves as a hash function for a particular type, suitable for use in hashing algorithms and data structures like a hash table.
GetType (inherited from Object) Gets the Type of the current instance.
ToString (inherited from Object) Returns a String that represents the current Object.

Protected Instance Methods

Finalize (inherited from Object) Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
MemberwiseClone (inherited from Object) Creates a shallow copy of the current Object.

See Also

MainUtil Class | Sitecore Namespace | DateUtil | FileUtil | HtmlUtil | StringUtil | WebUtil | XmlUtil