|
|
|
|||||
|
Does anyone have an interest in having the ICE class's data members be generated in C# as properties instead of public fields? The advantage is is that you can drop a class object with properties into a property grid & easily view the data. This make debugging [realtime programs] easier. It would be a "nice to have" to have ZeroC implement this as an option [for C# & VB]
|
|
|||||
|
Having C# public properties instead of public fields is something that we can really benefit from, so I took a stab at it. below is the replacement VisitDataMember in "slice2cs\Gen.cpp file. It seems to work just fine, & the default functionality remains the same. Could this be added to your code baseline ? vb.net would be easy to do also.
THANKS Scott Emerich jscott.emerich@boeing.com Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) { int baseTypes = 0; bool isClass = false; ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); assert(cont); if(StructPtr::dynamicCast(cont) && cont->hasMetaData("clr:class")) { baseTypes = DotNet::ICloneable; } else if(ExceptionPtr::dynamicCast(cont)) { baseTypes = DotNet::ApplicationException; } else if(ClassDefPtr::dynamicCast(cont)) { baseTypes = DotNet::ICloneable; isClass = true; } _out << sp << nl; string nameS = fixId(p->name(), baseTypes, isClass); string ty = typeToString(p->type()); if (p->hasMetaData("clr:property") || cont->hasMetaData("clr:property")) { _out << "private " << ty << " _" << nameS << ";" << nl; emitAttributes(p); _out << "public " << ty << " " << nameS << nl; _out << "{ get { return _" << nameS << "; }" << nl; _out << " set { _" << nameS << " = value; } }" << nl; } else { emitAttributes(p); _out << "public " << ty << " " << nameS << ";"; } } |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deprecating Classes in ICE | kamran | Help Center | 1 | 09-07-2006 06:57 PM |
| no Slice classes in Ice-E? | n2503v | Help Center | 1 | 10-06-2005 02:30 AM |
| About Classes transmit | level | Help Center | 4 | 09-22-2004 09:21 PM |
| Classes vs. Exceptions | andreynech | Comments | 7 | 02-28-2003 11:12 AM |
| Why operations on classes? | bernard | Comments | 1 | 02-21-2003 11:36 AM |