本文整理汇总了C#中ClassType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ClassType.ToString方法的具体用法?C# ClassType.ToString怎么用?C# ClassType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassType
的用法示例。
在下文中一共展示了ClassType.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: findClass
/// <summary> Finds a message or segment class by name and version.</summary>
/// <param name="name">the segment or message structure name
/// </param>
/// <param name="version">the HL7 version
/// </param>
/// <param name="type">'message', 'group', 'segment', or 'datatype'
/// </param>
private static Type findClass(String name, String version, ClassType type)
{
if (ParserBase.ValidVersion(version) == false)
{
throw new HL7Exception("The HL7 version " + version + " is not recognized", HL7Exception.UNSUPPORTED_VERSION_ID);
}
//get list of packages to search for the corresponding message class
List<string> packages = PackageList(version);
//get subpackage for component type
string typeString = type.ToString();
String subpackage = typeString.Substring(0, 1).ToUpper() + typeString.Substring(1);
//try to load class from each package
Type compClass = null;
int c = 0;
while (compClass == null && c < packages.Count)
{
try
{
String p = packages[c];
if (!p.EndsWith("."))
p = p + ".";
String classNameToTry = p + subpackage + "." + name;
classNameToTry = AddAssemblyName(p, classNameToTry);
if (log.DebugEnabled)
{
log.Debug("Trying to load: " + classNameToTry);
}
compClass = Type.GetType(classNameToTry);
if (log.DebugEnabled)
{
log.Debug("Loaded: " + classNameToTry + " class: " + compClass);
}
}
catch (Exception)
{
/* just try next one */
}
c++;
}
return compClass;
}