当前位置: 首页>>代码示例>>C#>>正文


C# InternalsVisibleToAttribute类代码示例

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


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

示例1: InternalsVisibleTo

//
// The source code should be saved in a file named Example1.cs. It 
// can be compiled at the command line as follows:
//
//    csc /t:library /keyfile:<snkfilename> Assembly1.cs
//
// The public key of the Friend1 file should be changed to the full
// public key stored in your strong-named key file.
//
using System;
using System.IO;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Friend1, PublicKey=002400000480000094" + 
                              "0000000602000000240000525341310004000" +
                              "001000100bf8c25fcd44838d87e245ab35bf7" +
                              "3ba2615707feea295709559b3de903fb95a93" +
                              "3d2729967c3184a97d7b84c7547cd87e435b5" +
                              "6bdf8621bcb62b59c00c88bd83aa62c4fcdd4" +
                              "712da72eec2533dc00f8529c3a0bbb4103282" +
                              "f0d894d5f34e9f0103c473dce9f4b457a5dee" +
                              "fd8f920d8681ed6dfcb0a81e96bd9b176525a" +
                              "26e0b3")]

public class FileUtilities
{
   internal static string AppendDirectorySeparator(string dir)
   {
      if (! dir.Trim().EndsWith(Path.DirectorySeparatorChar.ToString()))
         return dir.Trim() + Path.DirectorySeparatorChar;
      else
         return dir;
   }
}
开发者ID:.NET开发者,项目名称:System.Runtime.CompilerServices,代码行数:34,代码来源:InternalsVisibleToAttribute

示例2: Main

//
// The source code should be saved in a file named Friend1.cs. It 
// can be compiled at the command line as follows:
//
//    csc /r:Assembly1.dll /keyfile:<snkfilename> /out:Friend1.dll Friend1.cs
//
// The public key of the Friend1 assembly should correspond to the public key
// specified in the class constructor of the InternalsVisibleTo attribute in the
// Assembly1 assembly.
//
using System;

public class Example
{
   public static void Main()
   {
      string dir = @"C:\Program Files";
      dir = FileUtilities.AppendDirectorySeparator(dir);
      Console.WriteLine(dir);
   }
}
开发者ID:.NET开发者,项目名称:System.Runtime.CompilerServices,代码行数:21,代码来源:InternalsVisibleToAttribute

输出:

C:\Program Files\

示例3: InternalsVisibleToAttribute

//引入命名空间
using System;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleToAttribute("Friend2")]

namespace Utilities.StringUtilities
{
   public class StringLib
   {
      internal static bool IsFirstLetterUpperCase(String s)
      {
         string first = s.Substring(0, 1);
         return first == first.ToUpper();
      }
   }
}
开发者ID:.NET开发者,项目名称:System.Runtime.CompilerServices,代码行数:17,代码来源:InternalsVisibleToAttribute

示例4: Main

//引入命名空间
using System;
using Utilities.StringUtilities;

public class Example
{
   public static void Main()
   {
      String s = "The Sign of the Four";
      Console.WriteLine(StringLib.IsFirstLetterUpperCase(s));
   }
}
开发者ID:.NET开发者,项目名称:System.Runtime.CompilerServices,代码行数:12,代码来源:InternalsVisibleToAttribute


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