Loop through PropertySet (GetAllProperties) C#

5541
2
02-10-2011 06:07 AM
RiverTaig1
Occasional Contributor
I'm trying to simply enumerate through the name/value pairs in a IPropertySet.  I'm trying to use IPropertySet.GetAllProperties or GetProperties, but I'm apparently doing something wrong.

 
              
ESRI.ArcGIS.esriSystem.IPropertySet ps = ds.Workspace.ConnectionProperties;
int properties = ps.Count; //There may be 2-6 properties here probably
object names = new object();
object values = new object();
ps.GetProperties(names,out values);
0 Kudos
2 Replies
RiverTaig1
Occasional Contributor
This is UGLY, but seems to work. Weird and UGLY.
                ESRI.ArcGIS.esriSystem.IPropertySet ps = ds.Workspace.ConnectionProperties;
                int properties = ps.Count;
                object[] nameArray = new object[1];
                object[] valueArray = new object[1];
                ps.GetAllProperties(out nameArray[0],out valueArray[0]);
                object[] names = (object[]) nameArray[0];
                object[] values = (object[])valueArray[0];
                for(int i  = 0; i < properties; i++)
                {
                    string nameString = names.ToString();
                    string valueString = values.ToString();
                }
 
0 Kudos
StephanAdreas
New Contributor
This is UGLY, but seems to work. Weird and UGLY.
                ESRI.ArcGIS.esriSystem.IPropertySet ps = ds.Workspace.ConnectionProperties;
                int properties = ps.Count;
                object[] nameArray = new object[1];
                object[] valueArray = new object[1];
                ps.GetAllProperties(out nameArray[0],out valueArray[0]);
                object[] names = (object[]) nameArray[0];
                object[] values = (object[])valueArray[0];
                for(int i  = 0; i < properties; i++)
                {
                    string nameString = names.ToString();
                    string valueString = values.ToString();
                }
 


Hi,

I also found this out for myself. But some fields, like charset (/metadata/dataIdInfo/dataChar/CharSetCd/@value) have no value, though it is filled in ArcCatalog. It seems like those have no value, that have "@value" at the end of the name, from that list:
https://dwrgis.water.ca.gov/documents/269784/4662491/ArcGIS+Metadata+Details.xls?targetExtension=pdf

Anyone an idea here?

thanks,
Stephan
0 Kudos