Article ID: 814358 - View products that this article applies to.
This article has been archived. It is offered "as is" and will no longer be updated.
When you try to create an instance of a PropertyItem object in a project that you try to compile, you receive one of the following error messages:
Visual Basic .NET Error
Visual Basic 2005 Error
'System.Drawing.Imaging.PropertyItem.Private Overloads Sub New()' is not accessible in this context because it is 'Private'.
Visual C# .NET Error
error BC30251: Type 'System.Drawing.Imaging.PropertyItem' has no constructors.
Visual C# 2005 Error
'System.Drawing.Imaging.PropertyItem.PropertyItem()' is inaccessible due to its protection level.
error CS0143: The type 'System.Drawing.Imaging.PropertyItem' has no constructors defined
A PropertyItem object encapsulates a metadata property to be included in an image file. A PropertyItem object is not intended to be used a stand-alone object. A PropertyItem object is intended to be used by classes that are derived from System.Drawing.Image. A PropertyItem object is used to retrieve and change the metadata of existing image files, not to create the metadata. Therefore, the PropertyItem class does not have a defined Public constructor, and you cannot create an instance of a PropertyItem object.
To work around this problem, use an existing PropertyItem object instead of creating a new instance of the PropertyItem class. To do this, use the following code sample:
Visual Basic .NET or Visual Basic 2005 Sample Code
Visual C# .NET or Visual C# 2005 Sample Code
Note For this code to work correctly, you should have a reference to the System.Drawing.dll assembly.
Steps to Reproduce the Behavior
For additional information, visit the following MSDN Web sites:
4.6 Access Types
Article ID: 814358 - Last Review: February 27, 2014 - Revision: 2.11
Contact us for more help
Connect with Answer Desk for expert help.