本文整理汇总了C#中IProject.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IProject.GetType方法的具体用法?C# IProject.GetType怎么用?C# IProject.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProject
的用法示例。
在下文中一共展示了IProject.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTargets
public Dictionary<string, Target> GetTargets(IProject project)
{
var targets = new Dictionary<string, Target>();
foreach(var m in project.GetType().GetMethods())
if(m.DeclaringType != typeof(object))
targets.Add(m.Name, new MethodTarget(project, m));
return targets;
}
示例2: GetSuitableMethods
private static IEnumerable<MethodInfo> GetSuitableMethods(IProject project)
{
var typesToExclude = new[] {typeof (Project), typeof (IProject), typeof (Object)};
return from method in project.GetType().GetMethods()
where typesToExclude.None(t => t.Equals(method.DeclaringType))
where !method.IsSpecialName
select method;
}
示例3: MergeReferences
public void MergeReferences(IProject otherProject)
{
var other = otherProject as VcppProject;
if (other == null) throw new ArgumentException("VC++ projects can only be merged with other VC++ projects. Merging with " + otherProject.GetType() + " is not supported.");
OutputWindow.WriteLine("Merging references is not yet supported for VC++ projects.");
//var references = other.VcProject.VCReferences;
//for (int i = 1; i <= references.Count; i++)
//{
// VCReference reference = references.Item(i);
// OutputWindow.WriteLine("Copying reference " + reference.Name + "...");
// VcProject.VCReferences.Add(reference);
// OutputWindow.WriteLine("Copied reference " + reference.Name + ".");
//}
}
示例4: MergeReferences
public void MergeReferences(IProject otherProject)
{
var other = otherProject as CSharpProject;
if (other == null) throw new ArgumentException("C# projects can only be merged with other C# projects. Merging with " + otherProject.GetType() + " is not supported.");
foreach (Reference reference in other.VsProject.References)
{
try
{
Reference newReference;
if (reference.SourceProject == null)
{
if (reference.Type == prjReferenceType.prjReferenceTypeActiveX)
{
OutputWindow.WriteLine("ActiveX references cannot be migrated.");
}
else if (reference.Type == prjReferenceType.prjReferenceTypeAssembly)
{
OutputWindow.WriteLine("Copying assembly reference " + reference.Name + "...");
var path = reference.Path;
newReference = VsProject.References.Add(path);
newReference.CopyLocal = reference.CopyLocal;
OutputWindow.WriteLine("Copied assembly reference " + newReference.Name + ".");
}
}
else
{
OutputWindow.WriteLine("Copying reference to project " + reference.SourceProject.Name + "...");
newReference = VsProject.References.AddProject(reference.SourceProject);
OutputWindow.WriteLine("Copied reference to project " + reference.SourceProject.Name + ".");
}
}
catch (Exception ex)
{
OutputWindow.WriteLine("Failed to merge reference " + reference.Name + ". " + ex);
}
}
}