How to know if a type has been already declared in another source file in C#? -
i have source file in c# holds misc types project inside own namespace. example:
#define helper_file using system; namespace helper { public struct normalbalance : inormaltype { public int position { get; set; } public float normal { get; set; } } ... }
then, other files use these types. want distribute of these others in team, don't need of files, or types, data structures shared.
for example:
using system; namespace datapump { public class pumper { private helper.normalbalance[] norm; ... } ... }
but code depends on previous file containing helper.normalbalance type. want method sync files 1 knows of existence of other in c++ use #define directive in file declares type, , if client file didn't see token defined, conditionally compile type follows:
(c++ code follows)
class pumper { private: #ifndef helper_file struct normalbalance { int position; float normal; } normalbalance[] norm; #else helper.normalbalance[] norm; #endif ... } ... }
unfortunately, #define directive's scope in c# file declared. there way in c#? need know if file included in project, or if, @ least, type has been defined , if not, define again.
on .net framework, if wish share library of types, recommend packaging them single project. when built, becomes assembly can referenced other assembly. define directives used different purposes , so. less prevalent in c++ development.
Comments
Post a Comment