Reputation: 352
I have partial class as follows
public partial class ThisAddIn
{
static string MD5Hash { get; set; }
static string SHA1Hash { get; set; }
}
and two static properties. When I set the static property, I got error in static method.
public static void ComputeSHA1Hash(object filePath)
{
using (var stream = new FileStream((string)filePath, FileMode.Open, FileAccess.Read))
{
using (var sha1gen = new SHA1CryptoServiceProvider())
{
sha1gen.ComputeHash(stream);
ThisAddIn.SHA1Hash = BitConverter.ToString(sha1gen.Hash).Replace("-", "").ToLower();
}
}
}
Upvotes: 1
Views: 3434
Reputation: 11717
The problem is not the partial
keyword. Rather, you didn't have access modifiers on your class' properties. This means that they're private
by default. To solve this, simply add public
to your property declarations.
Upvotes: 7