Friday, March 19, 2010

Detect if string is numeric
// Detect if a string is numeric

public static bool IsNumeric(string text)
{
return Regex.IsMatch(text,"^\\d+$");
}
-----------------------
Protect string content by marshalling
// Protect string content by marshalling

IntPtr bstr = Marshal.SecureStringToBSTR(password);

try
{
// ...
// use the bstr
// ...
}
finally
{
Marshal.ZeroFreeBSTR(bstr);
}

No comments:

Post a Comment