Dot Net Learning Zone Blog

A blog about to learn Dot Net

Archive for the ‘c#’ Category

How to find assembly has assigned strong name or not?

Posted by Rajesh on May 10, 2008

The Assembly Name object contains information about an assembly, which you can use to bind to that assembly.

AssemblyName asName = null;

asName = AssemblyName.GetAssemblyName(“Path of Assembly”);

if (asName.GetPublicKey() != null)

{

Console.Write(“Assembly has assigned strong name”);

}

else

{

Console.Write(“Assembly has not assigned strong name”);

}

Posted in c# | Leave a Comment »

Use Tryparse to convert string value to integer

Posted by Rajesh on March 26, 2008

If you work on visual studio 2005. Don’t use int.prase because it throws an ArgumentNullException exception.
public static int IntTryParse(string values, int defaultValue)
{
int val = defaultValue;
if (int.TryParse(values, out val))
return val;
else
return defaultValue;

}

Posted in c# | Leave a Comment »