本文整理汇总了C#中System.Runtime.CompilerServices.InternalsVisibleToAttribute.InternalsVisibleToAttribute构造函数的典型用法代码示例。如果您正苦于以下问题:C# InternalsVisibleToAttribute构造函数的具体用法?C# InternalsVisibleToAttribute怎么用?C# InternalsVisibleToAttribute使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Runtime.CompilerServices.InternalsVisibleToAttribute
的用法示例。
在下文中一共展示了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;
}
}
示例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);
}
}
输出:
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();
}
}
}
示例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));
}
}