c# - How do you save an object to a fooSettings.settings file in Visual Studio? -


Can you save an object in the settings.settings file in Visual Studio? if so, how? I think that you can make your object serialized and it should continue, but I am not sure if I am telling it right, when I try to get the object back, it is always empty.

Code:

  [Serializable ()] [XmlRoot (Elementanum = "LayTcA", isoble = False, namespace = "http://somesite.com")] Public class liercea {// This is a COM object, so I do not want to serialize it. IFeatureClass Feature Class; String fullname; String originale; Public LayerTCA () {} Public LayerTCA (IFeatureClass featureClass) {FeatureClass = featureClass; } Public IFeatureClass Feature Class {get {return featureClass; } Set {featureClass = value; FullName = featureClass.AliasName; Original name = string Helper.StringAfterLastFullStop (full name); }} [XmlAttribute (AttributeName = "BasicName")] Public String BasicName {get {return basicName; } Set {basicName = value; }} [XmlAttribute (AttributeName = "FullName")] Public String Full Name {get {return fullName; } Set {fullName = value; }} Public override string toasting () {return full name; }}  

I am using a member variable which is an IFeatureClassName I constructor IFeatureclass will accept, then enter the feature category for the IDSet and set the member variable to IDataset.FullName. It would be an INME, all INEM objects are harder through iPERSSTstream, while the xml can not be directly serialized, an IpperSstream object can be written on byte [] (via memoryblobstream). Can not recall that byte [] can come through XmlAttribute, maybe base64 should be used. It also has an open method, can only call IName. Open the membership feature, open the ClassName variable, returning the IFeatureclass.

Update: Here are some code that can help to change a feature class name from and from the string.

  Public static zero testing (IFeatureClass FC) {string guidplusbase64Name = GetFullName (IDSetset FC); Debug.Print (guidplusbase64Name); IFeatureClass fc2 = OpenDataSet (guidplusbase64Name) as IFeatureClass; Debug.Print (fc2.AliasName); } Public stable string GetFullName (IDSetset DS) {IPersistStream ps = D. Eiffersiststream as IPN; Gidde; Ps.GetClassID (g outside); IMemoryBlobStream MBS = New MemoryBlobStreamClass (); Ps.Save (MBS, 0); Object bytes; ((IMemoryBlobStreamVariant) MBS) .ExportToVariant (outside bytes); Return String.Format ("{0}; {1}", convert G, ToBase64String (byte []) bytes); } Public static IDataset OpenDataset (string guidplusbase64Name) {int idx = guidplusbase64Name.IndexOf (";"); String base64Name = guidplusbase64Name.Substring (idx + 1); String guidString = guidplusbase64Name.Substring (0, idx); Byte [] bytes = convert.Foambabs 64 string (base64Name); IMemoryBlobStream MBS = New MemoryBlobStreamClass (); ((IMemoryBlobStreamVariant MBS) .ImportFromVariant (byte); Type t = Type.GetTypeFromCLSID (new guid (guidString)); Enem N = Activiters. Create as anonymity (t); ((IPersistStream) N) .load (MBS); Idsetset ds = n. Open () IDset form; Return ds; }  

(updated to work with an IDSet, not just featureclasses) (Update 2: Connecting a cluster allows it to work with any dataset, Previous version was difficult for feature name class)

Do not ask me that ESRI is not getting around to implement.

Naming property is reserved for future use, when applied, this name will return a string representation of the local component of the object which can be issued by applications.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -