本文整理汇总了C#中IEntity.GetIdString方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.GetIdString方法的具体用法?C# IEntity.GetIdString怎么用?C# IEntity.GetIdString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity.GetIdString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDocumentation
public string GetDocumentation(IProject project, IEntity entity)
{
string idString = entity.GetIdString();
string result;
if (_documentationCache.TryGetValue(idString, out result))
return result;
DocumentationComment documentationComment = null;
if (entity.Documentation != null)
{
// Documentation from source code
documentationComment = entity.Documentation;
}
else
{
if (entity.ParentAssembly.AssemblyName != null)
{
IDocumentationProvider docProvider =
XmlDocumentationProviderFactory.Get(project, entity.ParentAssembly.AssemblyName);
if (docProvider != null)
{
documentationComment = docProvider.GetDocumentation(entity);
}
}
}
result = documentationComment != null
? DocumentationConverter.ConvertDocumentation(documentationComment.Xml.Text)
: null;
_documentationCache.TryAdd(idString, result);
return result;
}
示例2: GetDocumentation
public DocumentationComment GetDocumentation(IEntity entity)
{
if (entity == null)
throw new System.ArgumentNullException("entity");
var idString = entity.GetIdString();
XmlDocument doc = null;
try
{
var helpTree = MonoDevelop.Projects.HelpService.HelpTree;
if (helpTree == null)
return null;
if (entity.SymbolKind == SymbolKind.TypeDefinition)
{
#pragma warning disable 612,618
doc = helpTree.GetHelpXml(idString);
#pragma warning restore 612,618
}
else
{
var parentId = entity.DeclaringTypeDefinition.GetIdString();
#pragma warning disable 612,618
try
{
doc = helpTree.GetHelpXml(parentId);
}
catch (ArgumentNullException)
{
//ignore
}
#pragma warning restore 612,618
if (doc == null)
{
return null;
}
XmlNode node = SelectNode(doc, entity);
if (node != null)
return new DocumentationComment(node.OuterXml, new SimpleTypeResolveContext(entity));
return null;
// var node = doc.SelectSingleNode ("/Type/Members/Member")
// return new DocumentationComment (doc.OuterXml, new SimpleTypeResolveContext (entity));
}
}
catch (Exception e)
{
Console.WriteLine("Error while reading monodoc file." + e);
}
if (doc == null)
{
return null;
}
return new DocumentationComment(doc.OuterXml, new SimpleTypeResolveContext(entity));
}
示例3: GetDocumentation
public DocumentationComment GetDocumentation (IEntity entity)
{
if (entity == null)
throw new System.ArgumentNullException ("entity");
// If we had an exception while getting the help xml the monodoc help provider
// shouldn't try it again. A corrupt .zip file could cause long tooltip delays otherwise.
if (hadError)
return null;
var idString = entity.GetIdString ();
DocumentationComment result;
if (commentCache.TryGetValue (idString, out result))
return result;
XmlDocument doc = null;
try {
var helpTree = MonoDevelop.Projects.HelpService.HelpTree;
if (helpTree == null)
return null;
if (entity.EntityType == EntityType.TypeDefinition) {
doc = helpTree.GetHelpXml (idString);
} else {
var parentId = entity.DeclaringTypeDefinition.GetIdString ();
doc = helpTree.GetHelpXml (parentId);
if (doc == null)
return null;
XmlNode node = SelectNode (doc, entity);
if (node != null)
return commentCache [idString] = new DocumentationComment (node.OuterXml, new SimpleTypeResolveContext (entity));
return null;
// var node = doc.SelectSingleNode ("/Type/Members/Member")
// return new DocumentationComment (doc.OuterXml, new SimpleTypeResolveContext (entity));
}
} catch (Exception e) {
hadError = true;
LoggingService.LogError ("Error while reading monodoc file.", e);
}
if (doc == null) {
commentCache [idString] = null;
return null;
}
return commentCache [idString] = new DocumentationComment (doc.OuterXml, new SimpleTypeResolveContext (entity));
}