• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IReference类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IReference的典型用法代码示例。如果您正苦于以下问题:C# IReference类的具体用法?C# IReference怎么用?C# IReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IReference类属于命名空间,在下文中一共展示了IReference类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: PrintAttribute

 public virtual void PrintAttribute(IReference target, ICustomAttribute attribute, bool newLine, string targetType) {
   this.sourceEmitterOutput.Write("[", newLine);
   if (targetType != null) {
     this.sourceEmitterOutput.Write(targetType);
     this.sourceEmitterOutput.Write(": ");
   }
   this.PrintTypeReferenceName(attribute.Constructor.ContainingType);
   if (attribute.NumberOfNamedArguments > 0 || IteratorHelper.EnumerableIsNotEmpty(attribute.Arguments)) {
     this.sourceEmitterOutput.Write("(");
     bool first = true;
     foreach (var argument in attribute.Arguments) {
       if (first)
         first = false;
       else
         this.sourceEmitterOutput.Write(", ");
       this.Traverse(argument);
     }
     foreach (var namedArgument in attribute.NamedArguments) {
       if (first)
         first = false;
       else
         this.sourceEmitterOutput.Write(", ");
       this.Traverse(namedArgument);
     }
     this.sourceEmitterOutput.Write(")");
   }
   this.sourceEmitterOutput.Write("]");
   if (newLine) this.sourceEmitterOutput.WriteLine("");
 }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:29,代码来源:AttributeSourceEmitter.cs


示例2: ObjectContent

 public ObjectContent(object value, ITypeDescriptor descriptor, bool isPrimitive, IReference reference)
     : base(descriptor, isPrimitive, reference)
 {
     if (reference is ObjectReference)
         throw new ArgumentException($"An {nameof(ObjectContent)} cannot contain an {nameof(ObjectReference)}");
     this.value = value;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:ObjectContent.cs


示例3: GetReferences

        public IReference[] GetReferences(ITreeNode element, IReference[] oldReferences)
        {
            var literal = element as ILiteralExpression;
            if (literal != null && literal.ConstantValue.Value is string)
            {
                var agument = literal.Parent as IVBArgument;
                var attribute = AttributeNavigator.GetByArgument(agument);
                if (attribute != null)
                {
                    var @class = attribute.AttributeType.Reference.Resolve().DeclaredElement as IClass;
                    if (@class != null && Equals(@class.GetClrName(), DataAttributeName))
                    {
                        var typeElement = (from a in attribute.Arguments
                                           where a is INamedArgument && a.ArgumentName == TypeMemberName
                                           select GetTypeof(a.Expression as IGetTypeExpression)).FirstOrDefault();

                        var member = MethodDeclarationNavigator.GetByAttribute(attribute) as ITypeMemberDeclaration;
                        if (member != null && member.DeclaredElement != null && typeElement == null)
                            typeElement = member.DeclaredElement.GetContainingType();

                        if (typeElement == null)
                            return EmptyArray<IReference>.Instance;

                        var reference = CreateReference(typeElement, literal);

                        return oldReferences != null && oldReferences.Length == 1 && Equals(oldReferences[0], reference)
                                   ? oldReferences
                                   : new[] { reference };
                    }
                }
            }

            return EmptyArray<IReference>.Instance;
        }
开发者ID:Booksbaum,项目名称:resharper-xunit,代码行数:34,代码来源:VBMemberDataReferenceFactory.cs


示例4: GetPrimaryDeclaredElement

    public IDeclaredElement GetPrimaryDeclaredElement(IDeclaredElement declaredElement, IReference reference)
    {
      IDeclaredElement derivedElement = null;

      var method = declaredElement as IMethod;
      if (method != null)
      {
        derivedElement = DerivedDeclaredElementUtil.GetPrimaryDeclaredElementForMethod(method);
      }


      var @class = declaredElement as IClass;
      if (@class != null)
        derivedElement = DerivedDeclaredElementUtil.GetPrimaryDeclaredElementForClass(@class);

      var @interface = declaredElement as IInterface;
      if (@interface != null)
        derivedElement = DerivedDeclaredElementUtil.GetPrimaryDeclaredElementForInterface(@interface);

      if(derivedElement != null)
      {
        return derivedElement;
      }
      return declaredElement;
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:25,代码来源:PsiPrimaryDeclaredElementForRenameProvider.cs


示例5: GetReferences

        public IReference[] GetReferences(ITreeNode element, IReference[] oldReferences)
        {
            var literal = element as ILiteralExpression;
            if (literal != null && literal.ConstantValue.Value is string)
            {
                var attribute = AttributeNavigator.GetByConstructorArgumentExpression(literal as ICSharpExpression);
                if (attribute != null)
                {
                    var @class = attribute.Name.Reference.Resolve().DeclaredElement as IClass;
                    if (@class != null && Equals(@class.GetClrName(), DataAttributeName))
                    {
                        var typeElement = (from a in attribute.PropertyAssignments
                                           where a.PropertyNameIdentifier.Name == TypeMemberName
                                           select GetTypeof(a.Source as ITypeofExpression)).FirstOrDefault();

                        var member = MethodDeclarationNavigator.GetByAttribute(attribute);
                        if (member != null && member.DeclaredElement != null && typeElement == null)
                            typeElement = member.DeclaredElement.GetContainingType();

                        if (typeElement == null)
                            return EmptyArray<IReference>.Instance;

                        var reference = CreateReference(typeElement, literal);

                        return oldReferences != null && oldReferences.Length == 1 && Equals(oldReferences[0], reference)
                                   ? oldReferences
                                   : new[] {reference};
                    }
                }
            }

            return EmptyArray<IReference>.Instance;
        }
开发者ID:Booksbaum,项目名称:resharper-xunit,代码行数:33,代码来源:CSharpPropertyDataReferenceFactory.cs


示例6: VisitMethodBodyReference

        public void VisitMethodBodyReference(IReference reference)
        {
            var typeReference = reference as ITypeReference;
            if (typeReference != null)
            {
                this.typeReferenceNeedsToken = true;
                this.Visit(typeReference);
                Debug.Assert(!this.typeReferenceNeedsToken);
            }
            else
            {
                var fieldReference = reference as IFieldReference;
                if (fieldReference != null)
                {
                    if (fieldReference.IsContextualNamedEntity)
                    {
                        ((IContextualNamedEntity)fieldReference).AssociateWithMetadataWriter(this.metadataWriter);
                    }

                    this.Visit(fieldReference);
                }
                else
                {
                    var methodReference = reference as IMethodReference;
                    if (methodReference != null)
                    {
                        this.Visit(methodReference);
                    }
                }
            }
        }
开发者ID:ehsansajjad465,项目名称:roslyn,代码行数:31,代码来源:ReferenceIndexer.cs


示例7: CheckResolve

        protected override bool CheckResolve(IReference reference, IElement element)
        {
            if (reference is TableReference && !DatabaseManager.GetInstance(element.GetManager().Solution).Enabled)
                return false;

            return base.CheckResolve(reference, element);
        }
开发者ID:willrawls,项目名称:arp,代码行数:7,代码来源:NHReferencesProcessor.cs


示例8: ContentBase

 protected ContentBase(ITypeDescriptor descriptor, bool isPrimitive, IReference reference)
 {
     if (descriptor == null) throw new ArgumentNullException(nameof(descriptor));
     Reference = reference;
     Descriptor = descriptor;
     IsPrimitive = isPrimitive;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:7,代码来源:ContentBase.cs


示例9: MethodInvocation

 public MethodInvocation(IReference reference, IType type, IMethod method, ISubstitution substitution)
 {
   Reference = reference;
   Type = type;
   Method = method;
   Substitution = substitution;
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:7,代码来源:MethodInvocation.cs


示例10: From

        public static AssetLogMessage From(Package package, IReference assetReference, ILogMessage logMessage, string assetPath, int line = 0, int character = 0)
        {
            // Transform to AssetLogMessage
            var assetLogMessage = logMessage as AssetLogMessage;
            if (assetLogMessage == null)
            {
                assetLogMessage = new AssetLogMessage(null, assetReference, logMessage.Type, AssetMessageCode.CompilationMessage, assetReference?.Location, logMessage.Text)
                {
                    Exception = (logMessage as LogMessage)?.Exception
                };
            }

            // Set file (and location if available)
            assetLogMessage.File = assetPath;
            assetLogMessage.Line = line;
            assetLogMessage.Character = character;

            // Generate location (if it's a Yaml exception)
            var yamlException = (logMessage as LogMessage)?.Exception as YamlException;
            if (yamlException != null)
            {
                assetLogMessage.Line = yamlException.Start.Line;
                assetLogMessage.Character = yamlException.Start.Column;
                // We've already got everything, no need to pollute log with stack trace of exception
                assetLogMessage.Exception = null;
            }

            return assetLogMessage;
        }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:29,代码来源:AssetLogMessage.cs


示例11: ReinstallPackageOn

		public static bool ReinstallPackageOn(ILogger logger, IReference newPackage, string sourceDirectory, IEnumerable<string> installDirs)
		{
			foreach (string installDir in installDirs)
				if (!InstallPackage(logger, newPackage, installDir, sourceDirectory))
					return false;
			return true;
		}
开发者ID:monoman,项目名称:NugetCracker,代码行数:7,代码来源:BuildHelper.cs


示例12: Equals

 public bool Equals(IReference obj)
 {
     if (obj == null) return false;
     if (obj == this) return true;
     var fr = obj as ProjectReference;
     if (fr != null) return fr.Name == this.Name;
     return false;
 }
开发者ID:yanyitec,项目名称:yitec,代码行数:8,代码来源:ProjectReference.cs


示例13: DeclareHelper

 protected virtual IReference DeclareHelper(string name, IReference variable, Expression optionalInitialValue)
 {
     FuncBuilder.Instance.BindLocalVariableToRepresentation(variable, name);
       if(!ReferenceEquals(optionalInitialValue, null)) {
     Assignment.AssignAny(variable, optionalInitialValue);
       }
       return variable;
 }
开发者ID:brandongrossutti,项目名称:DotCopter,代码行数:8,代码来源:Declaration.cs


示例14: AddReference

        public void AddReference(IReference reference)
        {
            var assembly = reference.GetAssembly();

            references.Add(assembly);

            compiler.Parameters.AddAssembly(assembly);
        }
开发者ID:jagregory,项目名称:boolangstudio,代码行数:8,代码来源:BooDocumentCompiler.cs


示例15: AssetLogger

 public AssetLogger(Package package, IReference assetReference, string assetFullPath, ILogger loggerToForward)
 {
     this.package = package;
     this.assetReference = assetReference;
     this.assetFullPath = assetFullPath;
     this.loggerToForward = loggerToForward;
     ActivateLog(LogMessageType.Debug);
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:8,代码来源:AssetLogger.cs


示例16: AssetLogMessage

 /// <summary>
 /// Initializes a new instance of the <see cref="AssetLogMessage" /> class.
 /// </summary>
 /// <param name="package">The package.</param>
 /// <param name="assetReference">The asset reference.</param>
 /// <param name="type">The type.</param>
 /// <param name="messageCode">The message code.</param>
 /// <param name="arguments">The arguments.</param>
 /// <exception cref="System.ArgumentNullException">asset</exception>
 public AssetLogMessage(Package package, IReference assetReference, LogMessageType type, string text)
 {
     this.package = package;
     AssetReference = assetReference;
     Type = type;
     Related = new List<IReference>();
     Text = text;
 }
开发者ID:Kryptos-FR,项目名称:xenko-reloaded,代码行数:17,代码来源:AssetLogMessage.cs


示例17: ConstructMockProject

 public static Mock<IVsProject> ConstructMockProject(IReference[] references = null, string outputAssembly = null)
 {
     var project = new Mock<IVsProject>();
     project.Setup(proj => proj.GetBinaryReferences()).Returns(references ?? new IReference[0]);
     outputAssembly = outputAssembly ?? "randomAssemblyName" + Path.GetTempFileName();
     project.SetupGet(p => p.AssemblyName).Returns(outputAssembly);
     return project;
 }
开发者ID:modulexcite,项目名称:NuGet.Extensions,代码行数:8,代码来源:ProjectReferenceTestData.cs


示例18: Equals

 public bool Equals(IReference obj)
 {
     if (obj == null) return false;
     if (obj == this) return true;
     var fr = obj as FileReference;
     if (fr != null) return fr.Filename == this.Filename;
     return false;
 }
开发者ID:yanyitec,项目名称:yitec,代码行数:8,代码来源:FileReference.cs


示例19: StorageManager

 public StorageManager(IReference storage)
 {
     var g=CodeGenerator.Instance;
       var f=FuncBuilder.Instance;
       //don't use statics for storage
       this.storage=g.GetStaticVariableInfo(storage, false)!=null ? f.Declare.Int("temp2") : storage;
       this.temp=f.Declare.Int("temp");
 }
开发者ID:brandongrossutti,项目名称:DotCopter,代码行数:8,代码来源:StorageManager.cs


示例20: MemberContent

 public MemberContent(INodeBuilder nodeBuilder, IContent container, IMemberDescriptor member, bool isPrimitive, IReference reference)
     : base(nodeBuilder.TypeDescriptorFactory.Find(member.Type), isPrimitive, reference)
 {
     if (container == null) throw new ArgumentNullException(nameof(container));
     Member = member;
     Container = container;
     nodeContainer = nodeBuilder.NodeContainer;
 }
开发者ID:FERRERDEV,项目名称:xenko,代码行数:8,代码来源:MemberContent.cs



注:本文中的IReference类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IReflect类代码示例发布时间:2022-05-24
下一篇:
C# IRedisClientsManager类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap